From 63bd9cd8ff965c128e806f21770af90b46ebd0ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=94=B7?= Date: Sun, 3 May 2026 09:45:57 +0800 Subject: [PATCH] fix: add department_id to ReqClazz and ReqClazzRepeat structs Completes the department_id field addition across all Clazz-related structs and initializers after schema migration added the column. Co-Authored-By: Claude Opus 4.7 --- htykc/src/ws_clazz.rs | 2 ++ htykc/src/ws_clazz_repeat.rs | 1 + htykc_models/src/models.rs | 13 +++++++++++++ 3 files changed, 16 insertions(+) diff --git a/htykc/src/ws_clazz.rs b/htykc/src/ws_clazz.rs index 5a0f2a7..98f1710 100644 --- a/htykc/src/ws_clazz.rs +++ b/htykc/src/ws_clazz.rs @@ -862,6 +862,7 @@ async fn raw_create_clazz_with_repeat( is_notified: in_kecheng.is_notified.clone(), completed_at: None, org_id: in_kecheng.org_id.clone(), + department_id: in_kecheng.department_id.clone(), }; if to_create_kecheng.org_id.is_none() { to_create_kecheng.org_id = current_org_id.clone(); @@ -887,6 +888,7 @@ async fn raw_create_clazz_with_repeat( repeat_status: kecheng_repeat_copy.repeat_status.clone(), latest_clazz_created_at: kecheng_repeat_copy.latest_clazz_created_at.clone(), org_id: kecheng_repeat_copy.org_id.clone(), + department_id: kecheng_repeat_copy.department_id.clone(), }) } diff --git a/htykc/src/ws_clazz_repeat.rs b/htykc/src/ws_clazz_repeat.rs index a85f4bf..c7aedc7 100644 --- a/htykc/src/ws_clazz_repeat.rs +++ b/htykc/src/ws_clazz_repeat.rs @@ -72,6 +72,7 @@ async fn raw_create_clazz_repeat( repeat_status: in_kecheng_repeat.repeat_status.clone(), latest_clazz_created_at: in_kecheng_repeat.latest_clazz_created_at.clone(), org_id: in_kecheng_repeat.org_id.clone(), + department_id: in_kecheng_repeat.department_id.clone(), }; let created_kecheng_repeat_result = ClazzRepeat::create( diff --git a/htykc_models/src/models.rs b/htykc_models/src/models.rs index 11d41f0..d413123 100644 --- a/htykc_models/src/models.rs +++ b/htykc_models/src/models.rs @@ -52,6 +52,7 @@ pub struct Clazz { pub is_notified: Option, pub completed_at: Option, pub org_id: Option, + pub department_id: Option, } // https://weinan.io/2024/02/23/rust-diesel.html @@ -152,6 +153,7 @@ impl ReqClazzWithRepeat { is_notified: None, completed_at: None, org_id: None, + department_id: None, } }; @@ -169,6 +171,7 @@ impl ReqClazzWithRepeat { repeat_status: None, latest_clazz_created_at: None, org_id: None, + department_id: None, } }; @@ -232,6 +235,7 @@ impl Clazz { is_notified: self.is_notified.clone(), completed_at: self.completed_at.clone(), org_id: self.org_id.clone(), + department_id: self.department_id.clone(), }; req_res } @@ -453,6 +457,7 @@ pub struct ClazzRepeat { pub repeat_status: Option, pub latest_clazz_created_at: Option, pub org_id: Option, + pub department_id: Option, } impl ClazzRepeat { @@ -485,6 +490,7 @@ impl ClazzRepeat { repeat_status: self.repeat_status.clone(), latest_clazz_created_at: self.latest_clazz_created_at.clone(), org_id: self.org_id.clone(), + department_id: self.department_id.clone(), }; req_repeat } @@ -619,6 +625,7 @@ pub struct ReqClazz { pub is_notified: Option, pub completed_at: Option, pub org_id: Option, + pub department_id: Option, } impl ReqClazz { @@ -652,6 +659,7 @@ impl ReqClazz { is_notified: None, completed_at: None, org_id: None, + department_id: None, } }; @@ -689,6 +697,7 @@ impl ReqClazz { is_notified: the_kecheng.is_notified, completed_at: the_kecheng.completed_at, org_id: the_kecheng.org_id, + department_id: the_kecheng.department_id.clone(), } } } @@ -705,6 +714,7 @@ pub struct ReqClazzRepeat { pub repeat_status: Option, pub latest_clazz_created_at: Option, pub org_id: Option, + pub department_id: Option, } #[derive(Serialize, Deserialize, Debug, Clone)] @@ -1167,6 +1177,7 @@ pub struct ClazzAttendance { pub created_by: Option, pub is_delete: Option, pub org_id: Option, + pub department_id: Option, } #[derive(Insertable, Clone, Debug)] @@ -1184,6 +1195,7 @@ pub struct NewClazzAttendance { pub created_by: Option, pub is_delete: Option, pub org_id: Option, + pub department_id: Option, } #[derive(Serialize, Deserialize, Debug, Clone)] @@ -1524,6 +1536,7 @@ impl ClazzAttendance { created_by: operator_id.clone(), is_delete: Some(false), org_id: None, + department_id: None, }) .collect();