| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
use chrono::{DateTime, Utc}; |
| 11 |
use serde::{Deserialize, Serialize}; |
| 12 |
use strum_macros::EnumString; |
| 13 |
use crate::constants::{ |
| 14 |
DAYS_THRESHOLD_SHORT_FORMAT, URGENCY_HIGH_THRESHOLD, URGENCY_MEDIUM_THRESHOLD, |
| 15 |
}; |
| 16 |
use crate::id_types::{TaskId, ProjectId, MilestoneId, ContactId, EmailId, AnnotationId, SubtaskId}; |
| 17 |
use super::time_session::TimeSession; |
| 18 |
use super::shared::{CssClass, DbValue, ParseableEnum, Recurrence, RecurrenceRule, SortDirection}; |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default, EnumString)] |
| 24 |
pub enum TaskStatus { |
| 25 |
|
| 26 |
#[strum(serialize = "Pending")] |
| 27 |
#[default] |
| 28 |
Pending, |
| 29 |
|
| 30 |
#[strum(serialize = "Started")] |
| 31 |
Started, |
| 32 |
|
| 33 |
#[strum(serialize = "Completed")] |
| 34 |
Completed, |
| 35 |
|
| 36 |
#[strum(serialize = "Deleted")] |
| 37 |
Deleted, |
| 38 |
} |
| 39 |
|
| 40 |
impl TaskStatus { |
| 41 |
|
| 42 |
pub fn as_str(&self) -> &'static str { |
| 43 |
match self { |
| 44 |
TaskStatus::Pending => "Pending", |
| 45 |
TaskStatus::Started => "Started", |
| 46 |
TaskStatus::Completed => "Completed", |
| 47 |
TaskStatus::Deleted => "Deleted", |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
} |
| 52 |
|
| 53 |
impl ParseableEnum for TaskStatus {} |
| 54 |
|
| 55 |
impl DbValue for TaskStatus { |
| 56 |
fn db_value(&self) -> &'static str { |
| 57 |
self.as_str() |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
impl CssClass for TaskStatus { |
| 62 |
fn css_class(&self) -> &'static str { |
| 63 |
match self { |
| 64 |
TaskStatus::Pending => "task-pending", |
| 65 |
TaskStatus::Started => "task-started", |
| 66 |
TaskStatus::Completed => "task-completed", |
| 67 |
TaskStatus::Deleted => "task-deleted", |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default, EnumString)] |
| 74 |
pub enum Priority { |
| 75 |
|
| 76 |
#[strum(serialize = "High")] |
| 77 |
High, |
| 78 |
|
| 79 |
#[strum(serialize = "Medium")] |
| 80 |
#[default] |
| 81 |
Medium, |
| 82 |
|
| 83 |
#[strum(serialize = "Low")] |
| 84 |
Low, |
| 85 |
} |
| 86 |
|
| 87 |
impl Priority { |
| 88 |
|
| 89 |
pub fn as_str(&self) -> &'static str { |
| 90 |
match self { |
| 91 |
Priority::High => "H", |
| 92 |
Priority::Medium => "M", |
| 93 |
Priority::Low => "L", |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
#[allow(clippy::should_implement_trait)] |
| 103 |
pub fn from_str_or_default(s: &str) -> Self { |
| 104 |
match s { |
| 105 |
"High" | "H" | "high" | "h" => Priority::High, |
| 106 |
"Medium" | "M" | "medium" | "m" | "Med" | "med" => Priority::Medium, |
| 107 |
"Low" | "L" | "low" | "l" => Priority::Low, |
| 108 |
_ => Priority::default(), |
| 109 |
} |
| 110 |
} |
| 111 |
} |
| 112 |
|
| 113 |
impl DbValue for Priority { |
| 114 |
fn db_value(&self) -> &'static str { |
| 115 |
match self { |
| 116 |
Priority::High => "High", |
| 117 |
Priority::Medium => "Medium", |
| 118 |
Priority::Low => "Low", |
| 119 |
} |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
impl CssClass for Priority { |
| 124 |
fn css_class(&self) -> &'static str { |
| 125 |
match self { |
| 126 |
Priority::High => "priority-high", |
| 127 |
Priority::Medium => "priority-medium", |
| 128 |
Priority::Low => "priority-low", |
| 129 |
} |
| 130 |
} |
| 131 |
} |
| 132 |
|
| 133 |
|
| 134 |
#[derive(Debug, Clone, Serialize, Deserialize)] |
| 135 |
#[serde(rename_all = "camelCase")] |
| 136 |
pub struct Annotation { |
| 137 |
|
| 138 |
pub id: AnnotationId, |
| 139 |
|
| 140 |
#[serde(skip_serializing)] |
| 141 |
pub task_id: TaskId, |
| 142 |
|
| 143 |
pub timestamp: DateTime<Utc>, |
| 144 |
|
| 145 |
pub note: String, |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
#[derive(Debug, Clone, Serialize, Deserialize)] |
| 158 |
#[serde(rename_all = "camelCase")] |
| 159 |
pub struct Subtask { |
| 160 |
|
| 161 |
pub id: SubtaskId, |
| 162 |
|
| 163 |
#[serde(skip_serializing)] |
| 164 |
pub task_id: TaskId, |
| 165 |
|
| 166 |
pub text: String, |
| 167 |
|
| 168 |
|
| 169 |
pub linked_task_id: Option<TaskId>, |
| 170 |
|
| 171 |
pub is_completed: bool, |
| 172 |
|
| 173 |
#[serde(rename = "sortOrder")] |
| 174 |
pub position: i32, |
| 175 |
} |
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
#[derive(Debug, Clone, Serialize, Deserialize)] |
| 183 |
#[serde(rename_all = "camelCase")] |
| 184 |
pub struct Task { |
| 185 |
|
| 186 |
pub id: TaskId, |
| 187 |
|
| 188 |
pub project_id: Option<ProjectId>, |
| 189 |
|
| 190 |
pub project_name: Option<String>, |
| 191 |
|
| 192 |
pub milestone_id: Option<MilestoneId>, |
| 193 |
|
| 194 |
pub contact_id: Option<ContactId>, |
| 195 |
|
| 196 |
pub contact_name: Option<String>, |
| 197 |
|
| 198 |
pub description: String, |
| 199 |
|
| 200 |
pub status: TaskStatus, |
| 201 |
|
| 202 |
pub priority: Priority, |
| 203 |
|
| 204 |
pub due: Option<DateTime<Utc>>, |
| 205 |
|
| 206 |
pub tags: Vec<String>, |
| 207 |
|
| 208 |
pub urgency: f64, |
| 209 |
|
| 210 |
pub recurrence: Recurrence, |
| 211 |
|
| 212 |
pub recurrence_rule: Option<RecurrenceRule>, |
| 213 |
|
| 214 |
pub recurrence_parent_id: Option<TaskId>, |
| 215 |
|
| 216 |
pub source_email_id: Option<EmailId>, |
| 217 |
|
| 218 |
pub snoozed_until: Option<DateTime<Utc>>, |
| 219 |
|
| 220 |
pub waiting_for_response: bool, |
| 221 |
|
| 222 |
pub waiting_since: Option<DateTime<Utc>>, |
| 223 |
|
| 224 |
pub expected_response_date: Option<DateTime<Utc>>, |
| 225 |
|
| 226 |
pub scheduled_start: Option<DateTime<Utc>>, |
| 227 |
|
| 228 |
pub scheduled_duration: Option<i32>, |
| 229 |
|
| 230 |
pub annotations: Vec<Annotation>, |
| 231 |
|
| 232 |
pub subtasks: Vec<Subtask>, |
| 233 |
|
| 234 |
pub estimated_minutes: Option<i32>, |
| 235 |
|
| 236 |
pub actual_minutes: i32, |
| 237 |
|
| 238 |
#[serde(skip_serializing_if = "Option::is_none")] |
| 239 |
pub active_session: Option<TimeSession>, |
| 240 |
|
| 241 |
pub created_at: DateTime<Utc>, |
| 242 |
|
| 243 |
pub completed_at: Option<DateTime<Utc>>, |
| 244 |
|
| 245 |
pub is_focus: bool, |
| 246 |
|
| 247 |
pub focus_set_at: Option<DateTime<Utc>>, |
| 248 |
} |
| 249 |
|
| 250 |
impl Task { |
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
pub fn due_formatted(&self) -> String { |
| 255 |
match &self.due { |
| 256 |
Some(dt) => { |
| 257 |
let now = Utc::now(); |
| 258 |
let days = (dt.date_naive() - now.date_naive()).num_days(); |
| 259 |
|
| 260 |
if days < 0 { |
| 261 |
format!("{}d ago", -days) |
| 262 |
} else if days == 0 { |
| 263 |
"today".to_string() |
| 264 |
} else if days == 1 { |
| 265 |
"tomorrow".to_string() |
| 266 |
} else if days < DAYS_THRESHOLD_SHORT_FORMAT { |
| 267 |
format!("+{}d", days) |
| 268 |
} else { |
| 269 |
dt.format("%Y-%m-%d").to_string() |
| 270 |
} |
| 271 |
} |
| 272 |
None => "-".to_string(), |
| 273 |
} |
| 274 |
} |
| 275 |
|
| 276 |
|
| 277 |
pub fn annotation_count(&self) -> usize { |
| 278 |
self.annotations.len() |
| 279 |
} |
| 280 |
|
| 281 |
|
| 282 |
pub fn has_annotations(&self) -> bool { |
| 283 |
!self.annotations.is_empty() |
| 284 |
} |
| 285 |
|
| 286 |
|
| 287 |
pub fn has_recurrence(&self) -> bool { |
| 288 |
self.recurrence_rule.is_some() || self.recurrence != Recurrence::None |
| 289 |
} |
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
pub fn effective_recurrence_rule(&self) -> Option<RecurrenceRule> { |
| 294 |
RecurrenceRule::effective(self.recurrence_rule.as_ref(), &self.recurrence) |
| 295 |
} |
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
pub fn project_name_or_dash(&self) -> &str { |
| 300 |
self.project_name.as_deref().unwrap_or("-") |
| 301 |
} |
| 302 |
|
| 303 |
|
| 304 |
pub fn project_name_or_empty(&self) -> &str { |
| 305 |
self.project_name.as_deref().unwrap_or("") |
| 306 |
} |
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
pub fn due_timestamp(&self) -> i64 { |
| 312 |
self.due.map(|d| d.timestamp()).unwrap_or(0) |
| 313 |
} |
| 314 |
|
| 315 |
|
| 316 |
pub fn urgency_formatted(&self) -> String { |
| 317 |
format!("{:.1}", self.urgency) |
| 318 |
} |
| 319 |
|
| 320 |
|
| 321 |
pub fn is_overdue(&self) -> bool { |
| 322 |
match self.due { |
| 323 |
Some(due) => due < Utc::now(), |
| 324 |
None => false, |
| 325 |
} |
| 326 |
} |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
pub fn urgency_class(&self) -> &'static str { |
| 331 |
|
| 332 |
if self.is_overdue() { |
| 333 |
"urgency-overdue" |
| 334 |
} else if self.urgency >= URGENCY_HIGH_THRESHOLD { |
| 335 |
"urgency-high" |
| 336 |
} else if self.urgency >= URGENCY_MEDIUM_THRESHOLD { |
| 337 |
"urgency-medium" |
| 338 |
} else { |
| 339 |
"urgency-low" |
| 340 |
} |
| 341 |
} |
| 342 |
|
| 343 |
|
| 344 |
pub fn subtask_count(&self) -> usize { |
| 345 |
self.subtasks.len() |
| 346 |
} |
| 347 |
|
| 348 |
|
| 349 |
pub fn subtasks_completed(&self) -> usize { |
| 350 |
self.subtasks.iter().filter(|s| s.is_completed).count() |
| 351 |
} |
| 352 |
|
| 353 |
|
| 354 |
pub fn has_subtasks(&self) -> bool { |
| 355 |
!self.subtasks.is_empty() |
| 356 |
} |
| 357 |
|
| 358 |
|
| 359 |
pub fn subtasks_progress(&self) -> String { |
| 360 |
format!("{}/{}", self.subtasks_completed(), self.subtask_count()) |
| 361 |
} |
| 362 |
|
| 363 |
|
| 364 |
pub fn has_source_email(&self) -> bool { |
| 365 |
self.source_email_id.is_some() |
| 366 |
} |
| 367 |
|
| 368 |
|
| 369 |
pub fn is_snoozed(&self) -> bool { |
| 370 |
self.snoozed_until |
| 371 |
.map(|until| until > Utc::now()) |
| 372 |
.unwrap_or(false) |
| 373 |
} |
| 374 |
|
| 375 |
|
| 376 |
pub fn is_waiting(&self) -> bool { |
| 377 |
self.waiting_for_response |
| 378 |
} |
| 379 |
|
| 380 |
|
| 381 |
pub fn is_response_overdue(&self) -> bool { |
| 382 |
self.waiting_for_response |
| 383 |
&& self.expected_response_date |
| 384 |
.map(|date| date < Utc::now()) |
| 385 |
.unwrap_or(false) |
| 386 |
} |
| 387 |
|
| 388 |
|
| 389 |
pub fn is_focused(&self) -> bool { |
| 390 |
self.is_focus |
| 391 |
} |
| 392 |
|
| 393 |
|
| 394 |
pub fn time_progress(&self) -> Option<u8> { |
| 395 |
self.estimated_minutes.map(|est| { |
| 396 |
if est <= 0 { |
| 397 |
return 0; |
| 398 |
} |
| 399 |
((self.actual_minutes as f64 / est as f64) * 100.0).round().min(100.0) as u8 |
| 400 |
}) |
| 401 |
} |
| 402 |
|
| 403 |
|
| 404 |
pub fn is_over_estimate(&self) -> bool { |
| 405 |
match self.estimated_minutes { |
| 406 |
Some(est) if est > 0 => self.actual_minutes > est, |
| 407 |
_ => false, |
| 408 |
} |
| 409 |
} |
| 410 |
|
| 411 |
|
| 412 |
pub fn has_active_timer(&self) -> bool { |
| 413 |
self.active_session.is_some() |
| 414 |
} |
| 415 |
} |
| 416 |
|
| 417 |
|
| 418 |
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] |
| 419 |
pub enum TaskSortColumn { |
| 420 |
|
| 421 |
Description, |
| 422 |
|
| 423 |
Project, |
| 424 |
|
| 425 |
Priority, |
| 426 |
|
| 427 |
Due, |
| 428 |
|
| 429 |
#[default] |
| 430 |
Urgency, |
| 431 |
} |
| 432 |
|
| 433 |
impl TaskSortColumn { |
| 434 |
|
| 435 |
pub fn from_str_or_default(s: &str) -> Self { |
| 436 |
match s.to_lowercase().as_str() { |
| 437 |
"description" => Self::Description, |
| 438 |
"project" => Self::Project, |
| 439 |
"priority" => Self::Priority, |
| 440 |
"due" => Self::Due, |
| 441 |
"urgency" => Self::Urgency, |
| 442 |
_ => Self::default(), |
| 443 |
} |
| 444 |
} |
| 445 |
} |
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
#[derive(Debug, Clone, Default)] |
| 450 |
pub struct TaskFilterQuery { |
| 451 |
|
| 452 |
pub status: Option<TaskStatus>, |
| 453 |
|
| 454 |
pub project_id: Option<ProjectId>, |
| 455 |
|
| 456 |
pub milestone_id: Option<MilestoneId>, |
| 457 |
|
| 458 |
pub priority: Option<Priority>, |
| 459 |
|
| 460 |
pub show_snoozed: bool, |
| 461 |
|
| 462 |
pub waiting_only: bool, |
| 463 |
|
| 464 |
pub offset: Option<i64>, |
| 465 |
|
| 466 |
pub limit: Option<i64>, |
| 467 |
|
| 468 |
pub sort_column: Option<TaskSortColumn>, |
| 469 |
|
| 470 |
pub sort_direction: Option<SortDirection>, |
| 471 |
} |
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
#[derive(Debug, Clone, Serialize, Deserialize)] |
| 477 |
pub struct NewTask { |
| 478 |
|
| 479 |
pub project_id: Option<ProjectId>, |
| 480 |
|
| 481 |
pub milestone_id: Option<MilestoneId>, |
| 482 |
|
| 483 |
pub contact_id: Option<ContactId>, |
| 484 |
|
| 485 |
pub description: String, |
| 486 |
|
| 487 |
pub priority: Priority, |
| 488 |
|
| 489 |
pub due: Option<DateTime<Utc>>, |
| 490 |
|
| 491 |
pub tags: Vec<String>, |
| 492 |
|
| 493 |
pub recurrence: Recurrence, |
| 494 |
|
| 495 |
pub recurrence_rule: Option<RecurrenceRule>, |
| 496 |
|
| 497 |
pub urgency: f64, |
| 498 |
|
| 499 |
pub source_email_id: Option<EmailId>, |
| 500 |
|
| 501 |
pub scheduled_start: Option<DateTime<Utc>>, |
| 502 |
|
| 503 |
pub scheduled_duration: Option<i32>, |
| 504 |
|
| 505 |
pub estimated_minutes: Option<i32>, |
| 506 |
|
| 507 |
pub recurrence_parent_id: Option<TaskId>, |
| 508 |
} |
| 509 |
|
| 510 |
impl NewTask { |
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
pub fn builder(description: impl Into<String>) -> NewTaskBuilder { |
| 526 |
NewTaskBuilder::new(description) |
| 527 |
} |
| 528 |
} |
| 529 |
|
| 530 |
|
| 531 |
#[derive(Debug, Clone)] |
| 532 |
pub struct NewTaskBuilder { |
| 533 |
description: String, |
| 534 |
project_id: Option<ProjectId>, |
| 535 |
milestone_id: Option<MilestoneId>, |
| 536 |
contact_id: Option<ContactId>, |
| 537 |
priority: Priority, |
| 538 |
due: Option<DateTime<Utc>>, |
| 539 |
tags: Vec<String>, |
| 540 |
recurrence: Recurrence, |
| 541 |
recurrence_rule: Option<RecurrenceRule>, |
| 542 |
urgency: f64, |
| 543 |
source_email_id: Option<EmailId>, |
| 544 |
scheduled_start: Option<DateTime<Utc>>, |
| 545 |
scheduled_duration: Option<i32>, |
| 546 |
estimated_minutes: Option<i32>, |
| 547 |
recurrence_parent_id: Option<TaskId>, |
| 548 |
} |
| 549 |
|
| 550 |
impl NewTaskBuilder { |
| 551 |
|
| 552 |
pub fn new(description: impl Into<String>) -> Self { |
| 553 |
Self { |
| 554 |
description: description.into(), |
| 555 |
project_id: None, |
| 556 |
milestone_id: None, |
| 557 |
contact_id: None, |
| 558 |
priority: Priority::default(), |
| 559 |
due: None, |
| 560 |
tags: Vec::new(), |
| 561 |
recurrence: Recurrence::default(), |
| 562 |
recurrence_rule: None, |
| 563 |
urgency: 0.0, |
| 564 |
source_email_id: None, |
| 565 |
scheduled_start: None, |
| 566 |
scheduled_duration: None, |
| 567 |
estimated_minutes: None, |
| 568 |
recurrence_parent_id: None, |
| 569 |
} |
| 570 |
} |
| 571 |
|
| 572 |
|
| 573 |
pub fn project_id(mut self, project_id: ProjectId) -> Self { |
| 574 |
self.project_id = Some(project_id); |
| 575 |
self |
| 576 |
} |
| 577 |
|
| 578 |
|
| 579 |
pub fn milestone_id(mut self, milestone_id: MilestoneId) -> Self { |
| 580 |
self.milestone_id = Some(milestone_id); |
| 581 |
self |
| 582 |
} |
| 583 |
|
| 584 |
|
| 585 |
pub fn contact_id(mut self, contact_id: ContactId) -> Self { |
| 586 |
self.contact_id = Some(contact_id); |
| 587 |
self |
| 588 |
} |
| 589 |
|
| 590 |
|
| 591 |
pub fn priority(mut self, priority: Priority) -> Self { |
| 592 |
self.priority = priority; |
| 593 |
self |
| 594 |
} |
| 595 |
|
| 596 |
|
| 597 |
pub fn due(mut self, due: DateTime<Utc>) -> Self { |
| 598 |
self.due = Some(due); |
| 599 |
self |
| 600 |
} |
| 601 |
|
| 602 |
|
| 603 |
pub fn tag(mut self, tag: impl Into<String>) -> Self { |
| 604 |
self.tags.push(tag.into()); |
| 605 |
self |
| 606 |
} |
| 607 |
|
| 608 |
|
| 609 |
pub fn tags(mut self, tags: Vec<String>) -> Self { |
| 610 |
self.tags = tags; |
| 611 |
self |
| 612 |
} |
| 613 |
|
| 614 |
|
| 615 |
pub fn recurrence(mut self, recurrence: Recurrence) -> Self { |
| 616 |
self.recurrence = recurrence; |
| 617 |
self |
| 618 |
} |
| 619 |
|
| 620 |
|
| 621 |
pub fn recurrence_rule(mut self, rule: RecurrenceRule) -> Self { |
| 622 |
self.recurrence_rule = Some(rule); |
| 623 |
self |
| 624 |
} |
| 625 |
|
| 626 |
|
| 627 |
pub fn urgency(mut self, urgency: f64) -> Self { |
| 628 |
self.urgency = urgency; |
| 629 |
self |
| 630 |
} |
| 631 |
|
| 632 |
|
| 633 |
pub fn source_email_id(mut self, email_id: EmailId) -> Self { |
| 634 |
self.source_email_id = Some(email_id); |
| 635 |
self |
| 636 |
} |
| 637 |
|
| 638 |
|
| 639 |
pub fn scheduled_start(mut self, start: DateTime<Utc>) -> Self { |
| 640 |
self.scheduled_start = Some(start); |
| 641 |
self |
| 642 |
} |
| 643 |
|
| 644 |
|
| 645 |
pub fn scheduled_duration(mut self, duration: i32) -> Self { |
| 646 |
self.scheduled_duration = Some(duration); |
| 647 |
self |
| 648 |
} |
| 649 |
|
| 650 |
|
| 651 |
pub fn estimated_minutes(mut self, minutes: i32) -> Self { |
| 652 |
self.estimated_minutes = Some(minutes); |
| 653 |
self |
| 654 |
} |
| 655 |
|
| 656 |
|
| 657 |
pub fn recurrence_parent_id(mut self, id: TaskId) -> Self { |
| 658 |
self.recurrence_parent_id = Some(id); |
| 659 |
self |
| 660 |
} |
| 661 |
|
| 662 |
|
| 663 |
pub fn build(self) -> NewTask { |
| 664 |
NewTask { |
| 665 |
project_id: self.project_id, |
| 666 |
milestone_id: self.milestone_id, |
| 667 |
contact_id: self.contact_id, |
| 668 |
description: self.description, |
| 669 |
priority: self.priority, |
| 670 |
due: self.due, |
| 671 |
tags: self.tags, |
| 672 |
recurrence: self.recurrence, |
| 673 |
recurrence_rule: self.recurrence_rule, |
| 674 |
urgency: self.urgency, |
| 675 |
source_email_id: self.source_email_id, |
| 676 |
scheduled_start: self.scheduled_start, |
| 677 |
scheduled_duration: self.scheduled_duration, |
| 678 |
estimated_minutes: self.estimated_minutes, |
| 679 |
recurrence_parent_id: self.recurrence_parent_id, |
| 680 |
} |
| 681 |
} |
| 682 |
} |
| 683 |
|
| 684 |
|
| 685 |
#[derive(Debug, Clone)] |
| 686 |
pub struct TaskUpdateContext { |
| 687 |
pub created_at: DateTime<Utc>, |
| 688 |
pub status: TaskStatus, |
| 689 |
pub completed_at: Option<DateTime<Utc>>, |
| 690 |
pub scheduled_start: Option<DateTime<Utc>>, |
| 691 |
pub scheduled_duration: Option<i32>, |
| 692 |
} |
| 693 |
|
| 694 |
|
| 695 |
#[derive(Debug, Clone, Serialize, Deserialize)] |
| 696 |
pub struct UpdateTask { |
| 697 |
|
| 698 |
pub project_id: Option<ProjectId>, |
| 699 |
|
| 700 |
pub milestone_id: Option<MilestoneId>, |
| 701 |
|
| 702 |
pub contact_id: Option<ContactId>, |
| 703 |
|
| 704 |
pub description: String, |
| 705 |
|
| 706 |
pub status: TaskStatus, |
| 707 |
|
| 708 |
pub priority: Priority, |
| 709 |
|
| 710 |
pub due: Option<DateTime<Utc>>, |
| 711 |
|
| 712 |
pub tags: Vec<String>, |
| 713 |
|
| 714 |
pub recurrence: Recurrence, |
| 715 |
|
| 716 |
pub urgency: f64, |
| 717 |
|
| 718 |
pub scheduled_start: Option<DateTime<Utc>>, |
| 719 |
|
| 720 |
pub scheduled_duration: Option<i32>, |
| 721 |
|
| 722 |
pub estimated_minutes: Option<i32>, |
| 723 |
} |
| 724 |
|