summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-12 16:05:22 +0000
committersoryu <soryu@soryu.co>2026-02-12 16:05:22 +0000
commit5183658ed7ec2622b2f849c00b74095dc71ed993 (patch)
treec4ed7b9d0b1b7a3fae172f2e94267fea12605f69
parent355f10964c4dbec24a244a00caba5c17ed23fc65 (diff)
downloadsoryu-makima/makima-jp--add-rust-backend-models-for-orders-5cd8a7ce.tar.gz
soryu-makima/makima-jp--add-rust-backend-models-for-orders-5cd8a7ce.zip
feat: makima.jp: Add Rust backend models for ordersmakima/makima-jp--add-rust-backend-models-for-orders-5cd8a7ce
-rw-r--r--makima/src/db/models.rs116
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>,
+}