1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#![deny(missing_docs)]
use crate::task::Task;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

/// Command for adding a new task to an existing project
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CreateTaskCommand {
    /// Id for the project to add the task to
    pub project_id: Uuid,
    /// Title of the task to create
    pub title: String,
    /// The number of hours the task is estimated to take
    pub estimate: Option<u8>,
}

/// Command for updating an existing task
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct UpdateTaskCommand {
    /// Id for the project that the task is a part of
    pub project_id: Uuid,
    /// The updated task
    pub updated_task: Task,
}

/// Command for updating the status of a task to reflect work has started
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct StartTaskCommand {
    /// Id for the project that the task is a part of
    pub project_id: Uuid,
    /// Task number identifying the task
    pub task_number: usize,
}

/// Command for updating the status of a task to completed
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CompleteTaskCommand {
    /// Id for the project that the task is a part of
    pub project_id: Uuid,
    /// Task number identifying the task
    pub task_number: usize,
}

/// Command for creating a new project
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CreateProjectCommand {
    /// The name of the project
    pub name: String,
}