refactor(diary): Phase 3 质量提升 — 201 状态码 + OpenAPI 文档 + DiaryEvent 类型安全
Some checks failed
Main Merge / backend (push) Has been cancelled
Main Merge / frontend (push) Has been cancelled

前端:
- fix(app): Isar native 文件直接导入 isar_database_native.dart,消除 5 个条件导出类型错误
- chore(app): build_runner 重新生成 .g.dart 文件 (102 outputs)
- fix(app): 移除 secure_token_store_factory 未使用的 kIsWeb import

后端:
- refactor(diary): 所有创建端点 POST 返回 201 Created (9 handler, 11 端点)
- feat(diary): DiaryApiDoc OpenApi derive — 42 路径 + 32 Schema 汇总到 Swagger
- feat(diary): DiaryEvent 枚举添加 event_type/payload/to_domain_event 方法 + 4 测试

测试: 84/84 erp-diary 通过, 509/509 全仓库通过, Flutter analyze 0 error
This commit is contained in:
iven
2026-06-03 17:06:03 +08:00
parent e8df3a9562
commit 38592d61ce
17 changed files with 1038 additions and 70 deletions

View File

@@ -1,61 +1,262 @@
// erp-diary 事件定义
//
// DiaryEvent 是日记模块的领域事件枚举,提供类型安全的事件构建。
// 通过 `to_domain_event(tenant_id)` 转换为基座 DomainEvent 后发布到 EventBus。
//
// 使用方式Service 层):
// use crate::event::DiaryEvent;
// let evt = DiaryEvent::JournalCreated { journal_id, author_id, class_id };
// event_bus.publish(evt.to_domain_event(tenant_id), db).await;
use serde_json::json;
use uuid::Uuid;
use erp_core::events::DomainEvent;
/// 日记模块领域事件
#[derive(Debug, Clone)]
pub enum DiaryEvent {
/// 日记创建
JournalCreated {
journal_id: uuid::Uuid,
author_id: uuid::Uuid,
class_id: Option<uuid::Uuid>,
journal_id: Uuid,
author_id: Uuid,
class_id: Option<Uuid>,
},
/// 日记更新
JournalUpdated {
journal_id: uuid::Uuid,
author_id: uuid::Uuid,
journal_id: Uuid,
author_id: Uuid,
version: i32,
},
/// 日记删除
JournalDeleted {
journal_id: uuid::Uuid,
author_id: uuid::Uuid,
journal_id: Uuid,
author_id: Uuid,
},
/// 日记分享到班级
JournalShared {
journal_id: uuid::Uuid,
author_id: uuid::Uuid,
class_id: uuid::Uuid,
journal_id: Uuid,
author_id: Uuid,
class_id: Uuid,
},
/// 班级创建
ClassCreated {
class_id: uuid::Uuid,
teacher_id: uuid::Uuid,
class_id: Uuid,
teacher_id: Uuid,
},
/// 学生加入班级
StudentJoinedClass {
class_id: uuid::Uuid,
student_id: uuid::Uuid,
class_id: Uuid,
student_id: Uuid,
},
/// 老师布置主题
TopicAssigned {
topic_id: uuid::Uuid,
class_id: uuid::Uuid,
teacher_id: uuid::Uuid,
topic_id: Uuid,
class_id: Uuid,
teacher_id: Uuid,
},
/// 老师点评
CommentCreated {
comment_id: uuid::Uuid,
journal_id: uuid::Uuid,
teacher_id: uuid::Uuid,
student_id: uuid::Uuid,
comment_id: Uuid,
journal_id: Uuid,
teacher_id: Uuid,
student_id: Uuid,
},
/// 家长绑定孩子
ParentBound {
parent_id: uuid::Uuid,
child_id: uuid::Uuid,
parent_id: Uuid,
child_id: Uuid,
},
/// 成就解锁
AchievementUnlocked {
user_id: uuid::Uuid,
user_id: Uuid,
achievement_id: String,
},
}
impl DiaryEvent {
/// 返回事件类型字符串(用于 DomainEvent.event_type
pub fn event_type(&self) -> &'static str {
match self {
Self::JournalCreated { .. } => "diary.created",
Self::JournalUpdated { .. } => "diary.updated",
Self::JournalDeleted { .. } => "diary.deleted",
Self::JournalShared { .. } => "diary.shared",
Self::ClassCreated { .. } => "diary.class.created",
Self::StudentJoinedClass { .. } => "diary.class.student_joined",
Self::TopicAssigned { .. } => "diary.topic.assigned",
Self::CommentCreated { .. } => "diary.comment.created",
Self::ParentBound { .. } => "diary.parent.binding_confirmed",
Self::AchievementUnlocked { .. } => "diary.achievement.unlocked",
}
}
/// 返回事件 payloadJSON 格式)
pub fn payload(&self) -> serde_json::Value {
match self {
Self::JournalCreated {
journal_id,
author_id,
class_id,
} => json!({
"journal_id": journal_id,
"author_id": author_id,
"class_id": class_id,
}),
Self::JournalUpdated {
journal_id,
author_id,
version,
} => json!({
"journal_id": journal_id,
"author_id": author_id,
"version": version,
}),
Self::JournalDeleted {
journal_id,
author_id,
} => json!({
"journal_id": journal_id,
"author_id": author_id,
}),
Self::JournalShared {
journal_id,
author_id,
class_id,
} => json!({
"journal_id": journal_id,
"author_id": author_id,
"class_id": class_id,
}),
Self::ClassCreated {
class_id,
teacher_id,
} => json!({
"class_id": class_id,
"teacher_id": teacher_id,
}),
Self::StudentJoinedClass {
class_id,
student_id,
} => json!({
"class_id": class_id,
"student_id": student_id,
}),
Self::TopicAssigned {
topic_id,
class_id,
teacher_id,
} => json!({
"topic_id": topic_id,
"class_id": class_id,
"teacher_id": teacher_id,
}),
Self::CommentCreated {
comment_id,
journal_id,
teacher_id,
student_id,
} => json!({
"comment_id": comment_id,
"journal_id": journal_id,
"teacher_id": teacher_id,
"student_id": student_id,
}),
Self::ParentBound {
parent_id,
child_id,
} => json!({
"parent_id": parent_id,
"child_id": child_id,
}),
Self::AchievementUnlocked {
user_id,
achievement_id,
} => json!({
"user_id": user_id,
"achievement_id": achievement_id,
}),
}
}
/// 转换为基座 DomainEvent可直接发布到 EventBus
pub fn to_domain_event(&self, tenant_id: Uuid) -> DomainEvent {
DomainEvent::new(self.event_type(), tenant_id, self.payload())
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn journal_created_event_type() {
let id = Uuid::now_v7();
let evt = DiaryEvent::JournalCreated {
journal_id: id,
author_id: id,
class_id: None,
};
assert_eq!(evt.event_type(), "diary.created");
assert_eq!(evt.payload()["journal_id"], id.to_string());
}
#[test]
fn class_created_event_type() {
let id = Uuid::now_v7();
let evt = DiaryEvent::ClassCreated {
class_id: id,
teacher_id: id,
};
assert_eq!(evt.event_type(), "diary.class.created");
}
#[test]
fn to_domain_event_preserves_fields() {
let tid = Uuid::now_v7();
let jid = Uuid::now_v7();
let aid = Uuid::now_v7();
let de = DiaryEvent::JournalCreated {
journal_id: jid,
author_id: aid,
class_id: Some(tid),
}
.to_domain_event(tid);
assert_eq!(de.event_type, "diary.created");
assert_eq!(de.tenant_id, tid);
assert_eq!(de.payload["journal_id"], jid.to_string());
assert_eq!(de.payload["author_id"], aid.to_string());
assert_eq!(de.payload["class_id"], tid.to_string());
}
#[test]
fn all_variants_have_correct_event_type() {
let id = Uuid::now_v7();
let variants: Vec<DiaryEvent> = vec![
DiaryEvent::JournalCreated { journal_id: id, author_id: id, class_id: None },
DiaryEvent::JournalUpdated { journal_id: id, author_id: id, version: 1 },
DiaryEvent::JournalDeleted { journal_id: id, author_id: id },
DiaryEvent::JournalShared { journal_id: id, author_id: id, class_id: id },
DiaryEvent::ClassCreated { class_id: id, teacher_id: id },
DiaryEvent::StudentJoinedClass { class_id: id, student_id: id },
DiaryEvent::TopicAssigned { topic_id: id, class_id: id, teacher_id: id },
DiaryEvent::CommentCreated { comment_id: id, journal_id: id, teacher_id: id, student_id: id },
DiaryEvent::ParentBound { parent_id: id, child_id: id },
DiaryEvent::AchievementUnlocked { user_id: id, achievement_id: "first_diary".into() },
];
let types: Vec<&str> = variants.iter().map(|v| v.event_type()).collect();
assert!(types.contains(&"diary.created"));
assert!(types.contains(&"diary.updated"));
assert!(types.contains(&"diary.deleted"));
assert!(types.contains(&"diary.shared"));
assert!(types.contains(&"diary.class.created"));
assert!(types.contains(&"diary.class.student_joined"));
assert!(types.contains(&"diary.topic.assigned"));
assert!(types.contains(&"diary.comment.created"));
assert!(types.contains(&"diary.parent.binding_confirmed"));
assert!(types.contains(&"diary.achievement.unlocked"));
}
}

View File

@@ -1,6 +1,7 @@
// 成就 API 处理器
use axum::extract::{Extension, FromRef, Path, State};
use axum::http::StatusCode;
use axum::response::Json;
use erp_core::error::AppError;
@@ -44,7 +45,7 @@ where
path = "/api/v1/diary/achievements/{code}/unlock",
params(("code" = String, Path, description = "成就编码")),
responses(
(status = 200, description = "解锁成功", body = ApiResponse<AchievementResp>),
(status = 201, description = "解锁成功", body = ApiResponse<AchievementResp>),
(status = 404, description = "成就不存在"),
),
security(("bearer_auth" = [])),
@@ -57,7 +58,7 @@ pub async fn unlock_achievement<S>(
State(state): State<DiaryState>,
Extension(ctx): Extension<TenantContext>,
Path(code): Path<String>,
) -> Result<Json<ApiResponse<AchievementResp>>, AppError>
) -> Result<(StatusCode, Json<ApiResponse<AchievementResp>>), AppError>
where
DiaryState: FromRef<S>,
S: Clone + Send + Sync + 'static,
@@ -73,5 +74,5 @@ where
)
.await?;
Ok(Json(ApiResponse::ok(resp)))
Ok((StatusCode::CREATED, Json(ApiResponse::ok(resp))))
}

View File

@@ -1,6 +1,7 @@
// 班级 API 处理器 — 创建班级、加入班级、查询班级
use axum::extract::{Extension, FromRef, Path, State};
use axum::http::StatusCode;
use axum::response::Json;
use uuid::Uuid;
use validator::Validate;
@@ -18,7 +19,7 @@ use crate::state::DiaryState;
path = "/api/v1/diary/classes",
request_body = CreateClassReq,
responses(
(status = 200, description = "创建成功", body = ApiResponse<ClassResp>),
(status = 201, description = "创建成功", body = ApiResponse<ClassResp>),
(status = 400, description = "验证失败"),
(status = 401, description = "未授权"),
(status = 403, description = "权限不足"),
@@ -33,7 +34,7 @@ pub async fn create_class<S>(
State(state): State<DiaryState>,
Extension(ctx): Extension<TenantContext>,
Json(req): Json<CreateClassReq>,
) -> Result<Json<ApiResponse<ClassResp>>, AppError>
) -> Result<(StatusCode, Json<ApiResponse<ClassResp>>), AppError>
where
DiaryState: FromRef<S>,
S: Clone + Send + Sync + 'static,
@@ -55,7 +56,7 @@ where
)
.await?;
Ok(Json(ApiResponse::ok(resp)))
Ok((StatusCode::CREATED, Json(ApiResponse::ok(resp))))
}
#[utoipa::path(
@@ -63,7 +64,7 @@ where
path = "/api/v1/diary/classes/join",
request_body = JoinClassReq,
responses(
(status = 200, description = "加入成功", body = ApiResponse<ClassResp>),
(status = 201, description = "加入成功", body = ApiResponse<ClassResp>),
(status = 400, description = "班级码无效或已过期"),
(status = 401, description = "未授权"),
(status = 403, description = "权限不足"),
@@ -78,7 +79,7 @@ pub async fn join_class<S>(
State(state): State<DiaryState>,
Extension(ctx): Extension<TenantContext>,
Json(req): Json<JoinClassReq>,
) -> Result<Json<ApiResponse<ClassResp>>, AppError>
) -> Result<(StatusCode, Json<ApiResponse<ClassResp>>), AppError>
where
DiaryState: FromRef<S>,
S: Clone + Send + Sync + 'static,
@@ -101,7 +102,7 @@ where
)
.await?;
Ok(Json(ApiResponse::ok(resp)))
Ok((StatusCode::CREATED, Json(ApiResponse::ok(resp))))
}
#[utoipa::path(

View File

@@ -1,6 +1,7 @@
// 评语 API 处理器 — 老师点评学生日记
use axum::extract::{Extension, FromRef, Path, State};
use axum::http::StatusCode;
use axum::response::Json;
use uuid::Uuid;
use validator::Validate;
@@ -19,7 +20,7 @@ use crate::state::DiaryState;
params(("journal_id" = Uuid, Path, description = "日记ID")),
request_body = CreateCommentReq,
responses(
(status = 200, description = "点评成功", body = ApiResponse<CommentResp>),
(status = 201, description = "点评成功", body = ApiResponse<CommentResp>),
(status = 400, description = "验证失败或内容安全检查未通过"),
(status = 401, description = "未授权"),
(status = 403, description = "权限不足或不是本班老师"),
@@ -37,7 +38,7 @@ pub async fn create_comment<S>(
Extension(ctx): Extension<TenantContext>,
Path(journal_id): Path<Uuid>,
Json(req): Json<CreateCommentReq>,
) -> Result<Json<ApiResponse<CommentResp>>, AppError>
) -> Result<(StatusCode, Json<ApiResponse<CommentResp>>), AppError>
where
DiaryState: FromRef<S>,
S: Clone + Send + Sync + 'static,
@@ -59,7 +60,7 @@ where
)
.await?;
Ok(Json(ApiResponse::ok(resp)))
Ok((StatusCode::CREATED, Json(ApiResponse::ok(resp))))
}
#[utoipa::path(

View File

@@ -1,6 +1,7 @@
// 日记 API 处理器 — CRUD + 列表
use axum::extract::{Extension, FromRef, Path, Query, State};
use axum::http::StatusCode;
use axum::response::Json;
use serde::Deserialize;
use utoipa::IntoParams;
@@ -39,7 +40,7 @@ pub struct JournalListParams {
path = "/api/v1/diary/journals",
request_body = CreateJournalReq,
responses(
(status = 200, description = "创建成功", body = ApiResponse<JournalResp>),
(status = 201, description = "创建成功", body = ApiResponse<JournalResp>),
(status = 400, description = "验证失败"),
(status = 401, description = "未授权"),
(status = 403, description = "权限不足"),
@@ -54,7 +55,7 @@ pub async fn create_journal<S>(
State(state): State<DiaryState>,
Extension(ctx): Extension<TenantContext>,
Json(req): Json<CreateJournalReq>,
) -> Result<Json<ApiResponse<JournalResp>>, AppError>
) -> Result<(StatusCode, Json<ApiResponse<JournalResp>>), AppError>
where
DiaryState: FromRef<S>,
S: Clone + Send + Sync + 'static,
@@ -76,7 +77,7 @@ where
)
.await?;
Ok(Json(ApiResponse::ok(resp)))
Ok((StatusCode::CREATED, Json(ApiResponse::ok(resp))))
}
#[utoipa::path(

View File

@@ -1,6 +1,7 @@
// 家长中心 API 处理器 — PIPL 合规: 绑定/查阅/导出/删除
use axum::extract::{Extension, FromRef, Path, Query, State};
use axum::http::StatusCode;
use axum::response::Json;
use serde::{Deserialize, Serialize};
use utoipa::{IntoParams, ToSchema};
@@ -71,7 +72,7 @@ pub struct DeleteResultResp {
path = "/api/v1/diary/parent/bind",
request_body = BindChildReq,
responses(
(status = 200, description = "绑定成功", body = ApiResponse<BindingResp>),
(status = 201, description = "绑定成功", body = ApiResponse<BindingResp>),
(status = 400, description = "已绑定该孩子"),
(status = 401, description = "未授权"),
(status = 403, description = "权限不足"),
@@ -86,7 +87,7 @@ pub async fn bind_child<S>(
State(state): State<DiaryState>,
Extension(ctx): Extension<TenantContext>,
Json(req): Json<BindChildReq>,
) -> Result<Json<ApiResponse<BindingResp>>, AppError>
) -> Result<(StatusCode, Json<ApiResponse<BindingResp>>), AppError>
where
DiaryState: FromRef<S>,
S: Clone + Send + Sync + 'static,
@@ -102,11 +103,11 @@ where
)
.await?;
Ok(Json(ApiResponse::ok(BindingResp {
Ok((StatusCode::CREATED, Json(ApiResponse::ok(BindingResp {
binding_id: binding.id,
child_id: binding.child_id,
verified_at: binding.verified_at,
})))
}))))
}
#[utoipa::path(
@@ -357,7 +358,7 @@ where
path = "/api/v1/diary/parent/bindings/{binding_id}/confirm",
params(("binding_id" = Uuid, Path, description = "绑定请求ID")),
responses(
(status = 200, description = "确认成功", body = ApiResponse<BindingResp>),
(status = 201, description = "确认成功", body = ApiResponse<BindingResp>),
(status = 401, description = "未授权"),
(status = 403, description = "无权确认此绑定"),
(status = 404, description = "绑定请求不存在"),
@@ -372,7 +373,7 @@ pub async fn confirm_binding<S>(
State(state): State<DiaryState>,
Extension(ctx): Extension<TenantContext>,
Path(binding_id): Path<Uuid>,
) -> Result<Json<ApiResponse<BindingResp>>, AppError>
) -> Result<(StatusCode, Json<ApiResponse<BindingResp>>), AppError>
where
DiaryState: FromRef<S>,
S: Clone + Send + Sync + 'static,
@@ -386,11 +387,11 @@ where
)
.await?;
Ok(Json(ApiResponse::ok(BindingResp {
Ok((StatusCode::CREATED, Json(ApiResponse::ok(BindingResp {
binding_id: binding.id,
child_id: binding.parent_id,
verified_at: binding.verified_at,
})))
}))))
}
#[utoipa::path(

View File

@@ -1,6 +1,7 @@
// 贴纸与模板 API 处理器
use axum::extract::{Extension, FromRef, Path, Query, State};
use axum::http::StatusCode;
use axum::response::Json;
use serde::Deserialize;
use utoipa::IntoParams;
@@ -91,7 +92,7 @@ where
path = "/api/v1/diary/sticker-packs",
request_body = CreateStickerPackReq,
responses(
(status = 200, description = "创建成功", body = ApiResponse<StickerPackResp>),
(status = 201, description = "创建成功", body = ApiResponse<StickerPackResp>),
(status = 400, description = "验证失败"),
(status = 401, description = "未授权"),
(status = 403, description = "权限不足"),
@@ -106,7 +107,7 @@ pub async fn create_sticker_pack<S>(
State(state): State<DiaryState>,
Extension(ctx): Extension<TenantContext>,
Json(req): Json<CreateStickerPackReq>,
) -> Result<Json<ApiResponse<StickerPackResp>>, AppError>
) -> Result<(StatusCode, Json<ApiResponse<StickerPackResp>>), AppError>
where
DiaryState: FromRef<S>,
S: Clone + Send + Sync + 'static,
@@ -126,7 +127,7 @@ where
)
.await?;
Ok(Json(ApiResponse::ok(resp)))
Ok((StatusCode::CREATED, Json(ApiResponse::ok(resp))))
}
#[utoipa::path(
@@ -216,7 +217,7 @@ where
params(("pack_id" = Uuid, Path, description = "贴纸包ID")),
request_body = CreateStickerReq,
responses(
(status = 200, description = "创建成功", body = ApiResponse<StickerResp>),
(status = 201, description = "创建成功", body = ApiResponse<StickerResp>),
(status = 400, description = "验证失败"),
(status = 401, description = "未授权"),
(status = 403, description = "权限不足"),
@@ -233,7 +234,7 @@ pub async fn create_sticker<S>(
Extension(ctx): Extension<TenantContext>,
Path(pack_id): Path<Uuid>,
Json(req): Json<CreateStickerReq>,
) -> Result<Json<ApiResponse<StickerResp>>, AppError>
) -> Result<(StatusCode, Json<ApiResponse<StickerResp>>), AppError>
where
DiaryState: FromRef<S>,
S: Clone + Send + Sync + 'static,
@@ -254,7 +255,7 @@ where
)
.await?;
Ok(Json(ApiResponse::ok(resp)))
Ok((StatusCode::CREATED, Json(ApiResponse::ok(resp))))
}
#[derive(Debug, Deserialize, IntoParams)]
pub struct TemplateQuery {

View File

@@ -1,6 +1,7 @@
// 主题布置 API 处理器 — 老师布置/查询主题
use axum::extract::{Extension, FromRef, Path, State};
use axum::http::StatusCode;
use axum::response::Json;
use uuid::Uuid;
use validator::Validate;
@@ -19,7 +20,7 @@ use crate::state::DiaryState;
params(("class_id" = Uuid, Path, description = "班级ID")),
request_body = CreateTopicReq,
responses(
(status = 200, description = "布置成功", body = ApiResponse<TopicResp>),
(status = 201, description = "布置成功", body = ApiResponse<TopicResp>),
(status = 400, description = "验证失败"),
(status = 401, description = "未授权"),
(status = 403, description = "权限不足"),
@@ -36,7 +37,7 @@ pub async fn assign_topic<S>(
Extension(ctx): Extension<TenantContext>,
Path(class_id): Path<Uuid>,
Json(req): Json<CreateTopicReq>,
) -> Result<Json<ApiResponse<TopicResp>>, AppError>
) -> Result<(StatusCode, Json<ApiResponse<TopicResp>>), AppError>
where
DiaryState: FromRef<S>,
S: Clone + Send + Sync + 'static,
@@ -58,7 +59,7 @@ where
)
.await?;
Ok(Json(ApiResponse::ok(resp)))
Ok((StatusCode::CREATED, Json(ApiResponse::ok(resp))))
}
#[utoipa::path(

View File

@@ -3,6 +3,9 @@ use utoipa::OpenApi;
use crate::{ApiDoc, AuthApiDoc, ConfigApiDoc, MessageApiDoc, WorkflowApiDoc};
#[cfg(feature = "diary")]
use crate::DiaryApiDoc;
/// GET /docs/openapi.json
///
/// 返回 OpenAPI 3.0 规范 JSON 文档,合并所有模块的路径和 schema。
@@ -15,6 +18,10 @@ pub async fn openapi_spec() -> Response {
spec.merge(ConfigApiDoc::openapi());
spec.merge(WorkflowApiDoc::openapi());
spec.merge(MessageApiDoc::openapi());
#[cfg(feature = "diary")]
spec.merge(DiaryApiDoc::openapi());
Json(serde_json::to_value(spec).unwrap_or_default()).into_response()
}

View File

@@ -161,6 +161,90 @@ struct WorkflowApiDoc;
)]
struct MessageApiDoc;
/// Diary 模块的 OpenAPI 路径收集
#[cfg(feature = "diary")]
#[derive(OpenApi)]
#[openapi(
paths(
erp_diary::handler::journal_handler::create_journal,
erp_diary::handler::journal_handler::get_journal,
erp_diary::handler::journal_handler::update_journal,
erp_diary::handler::journal_handler::delete_journal,
erp_diary::handler::journal_handler::list_journals,
erp_diary::handler::class_handler::create_class,
erp_diary::handler::class_handler::join_class,
erp_diary::handler::class_handler::get_class,
erp_diary::handler::class_handler::list_members,
erp_diary::handler::class_handler::my_classes,
erp_diary::handler::class_handler::list_all_classes,
erp_diary::handler::class_handler::update_class,
erp_diary::handler::class_handler::deactivate_class,
erp_diary::handler::class_handler::reset_class_code,
erp_diary::handler::comment_handler::create_comment,
erp_diary::handler::comment_handler::list_comments,
erp_diary::handler::comment_handler::delete_comment,
erp_diary::handler::topic_handler::assign_topic,
erp_diary::handler::topic_handler::list_topics,
erp_diary::handler::topic_handler::update_topic,
erp_diary::handler::topic_handler::deactivate_topic,
erp_diary::handler::sticker_handler::list_sticker_packs,
erp_diary::handler::sticker_handler::list_stickers_in_pack,
erp_diary::handler::sticker_handler::create_sticker_pack,
erp_diary::handler::sticker_handler::update_sticker_pack,
erp_diary::handler::sticker_handler::delete_sticker_pack,
erp_diary::handler::sticker_handler::create_sticker,
erp_diary::handler::sticker_handler::list_templates,
erp_diary::handler::sticker_handler::get_template,
erp_diary::handler::achievement_handler::list_achievements,
erp_diary::handler::achievement_handler::unlock_achievement,
erp_diary::handler::stats_handler::get_mood_stats,
erp_diary::handler::sync_handler::sync_journals,
erp_diary::handler::parent_handler::bind_child,
erp_diary::handler::parent_handler::list_children,
erp_diary::handler::parent_handler::get_child_journals,
erp_diary::handler::parent_handler::export_child_data,
erp_diary::handler::parent_handler::delete_child_data,
erp_diary::handler::parent_handler::unbind_child,
erp_diary::handler::parent_handler::list_pending_bindings,
erp_diary::handler::parent_handler::confirm_binding,
erp_diary::handler::parent_handler::reject_binding,
),
components(schemas(
erp_diary::dto::CreateJournalReq,
erp_diary::dto::UpdateJournalReq,
erp_diary::dto::JournalResp,
erp_diary::dto::CreateClassReq,
erp_diary::dto::JoinClassReq,
erp_diary::dto::UpdateClassReq,
erp_diary::dto::ResetClassCodeResp,
erp_diary::dto::ClassResp,
erp_diary::dto::SyncReq,
erp_diary::dto::SyncResp,
erp_diary::dto::ConflictInfo,
erp_diary::dto::ClassMemberResp,
erp_diary::dto::CreateTopicReq,
erp_diary::dto::TopicResp,
erp_diary::dto::UpdateTopicReq,
erp_diary::dto::CreateCommentReq,
erp_diary::dto::CommentResp,
erp_diary::dto::NotificationPayload,
erp_diary::dto::MoodStatsResp,
erp_diary::dto::MoodCount,
erp_diary::dto::StickerPackResp,
erp_diary::dto::StickerResp,
erp_diary::dto::TemplateResp,
erp_diary::dto::AchievementResp,
erp_diary::dto::CreateStickerPackReq,
erp_diary::dto::UpdateStickerPackReq,
erp_diary::dto::CreateStickerReq,
erp_diary::handler::parent_handler::BindChildReq,
erp_diary::handler::parent_handler::DeleteChildDataReq,
erp_diary::handler::parent_handler::BindingResp,
erp_diary::handler::parent_handler::DeleteResultResp,
))
)]
struct DiaryApiDoc;
use axum::Router;
use axum::middleware as axum_middleware;
use config::AppConfig;