taskboard_core_lib/
commands.rs

1#![deny(missing_docs)]
2use crate::task::Task;
3use serde::{Deserialize, Serialize};
4use uuid::Uuid;
5
6/// Command for adding a new task to an existing project
7#[derive(Clone, Debug, Deserialize, Serialize)]
8pub struct CreateTaskCommand {
9    /// Id for the project to add the task to
10    pub project_id: Uuid,
11    /// Title of the task to create
12    pub title: String,
13    /// The number of hours the task is estimated to take
14    pub estimate: Option<u8>,
15}
16
17/// Command for updating an existing task
18#[derive(Clone, Debug, Deserialize, Serialize)]
19pub struct UpdateTaskCommand {
20    /// Id for the project that the task is a part of
21    pub project_id: Uuid,
22    /// The updated task
23    pub updated_task: Task,
24}
25
26/// Command for updating the status of a task to reflect work has started
27#[derive(Clone, Debug, Deserialize, Serialize)]
28pub struct StartTaskCommand {
29    /// Id for the project that the task is a part of
30    pub project_id: Uuid,
31    /// Task number identifying the task
32    pub task_number: usize,
33}
34
35/// Command for updating the status of a task to completed
36#[derive(Clone, Debug, Deserialize, Serialize)]
37pub struct CompleteTaskCommand {
38    /// Id for the project that the task is a part of
39    pub project_id: Uuid,
40    /// Task number identifying the task
41    pub task_number: usize,
42}
43
44/// Command for creating a new project
45#[derive(Clone, Debug, Deserialize, Serialize)]
46pub struct CreateProjectCommand {
47    /// The name of the project
48    pub name: String,
49}