diff options
| -rw-r--r-- | makima/src/db/models.rs | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs index 169f468..bd045a8 100644 --- a/makima/src/db/models.rs +++ b/makima/src/db/models.rs @@ -2887,3 +2887,119 @@ pub struct DirectiveMemoryListResponse { pub memories: Vec<DirectiveMemory>, pub total: i64, } + +// ============================================================================= +// Orders — Work item cards +// ============================================================================= + +/// An order — a work item card that tracks tasks, bugs, features, etc. +#[derive(Debug, Clone, FromRow, Serialize, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct Order { + pub id: Uuid, + pub owner_id: Uuid, + pub title: String, + pub description: Option<String>, + pub order_type: String, + pub status: String, + pub priority: String, + pub directive_id: Option<Uuid>, + pub contract_id: Option<Uuid>, + pub repository_url: Option<String>, + pub version: i32, + pub created_at: DateTime<Utc>, + pub updated_at: DateTime<Utc>, +} + +/// Summary for order list views (includes computed label_count). +#[derive(Debug, Clone, FromRow, Serialize, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct OrderSummary { + pub id: Uuid, + pub owner_id: Uuid, + pub title: String, + pub description: Option<String>, + pub order_type: String, + pub status: String, + pub priority: String, + pub directive_id: Option<Uuid>, + pub contract_id: Option<Uuid>, + pub repository_url: Option<String>, + pub version: i32, + pub created_at: DateTime<Utc>, + pub updated_at: DateTime<Utc>, + pub label_count: i64, +} + +/// Request to create a new order. +#[derive(Debug, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct CreateOrderRequest { + pub title: String, + pub description: Option<String>, + pub order_type: Option<String>, + pub priority: Option<String>, + pub directive_id: Option<Uuid>, + pub contract_id: Option<Uuid>, + pub repository_url: Option<String>, +} + +/// Request to update an order. +#[derive(Debug, Default, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct UpdateOrderRequest { + pub title: Option<String>, + pub description: Option<String>, + pub order_type: Option<String>, + pub status: Option<String>, + pub priority: Option<String>, + pub directive_id: Option<Option<Uuid>>, + pub contract_id: Option<Option<Uuid>>, + pub repository_url: Option<String>, + pub version: Option<i32>, +} + +/// List response for orders. +#[derive(Debug, Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct OrderListResponse { + pub orders: Vec<OrderSummary>, + pub total: i64, +} + +/// A label that can be assigned to orders. +#[derive(Debug, Clone, FromRow, Serialize, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct OrderLabel { + pub id: Uuid, + pub owner_id: Uuid, + pub name: String, + pub color: String, + pub created_at: DateTime<Utc>, +} + +/// Request to create a new order label. +#[derive(Debug, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct CreateOrderLabelRequest { + pub name: String, + pub color: Option<String>, +} + +/// List response for order labels. +#[derive(Debug, Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct OrderLabelListResponse { + pub labels: Vec<OrderLabel>, +} + +/// Query parameters for filtering orders. +#[derive(Debug, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct OrderListQuery { + pub status: Option<String>, + pub order_type: Option<String>, + pub priority: Option<String>, + pub directive_id: Option<Uuid>, + pub contract_id: Option<Uuid>, +} |
