feat(profile): refine student creation workflow

This commit is contained in:
2026-07-21 16:59:06 +08:00
parent 26e4ec3271
commit 12a000845a
10 changed files with 144 additions and 87 deletions

View File

@@ -23,8 +23,8 @@ use crate::{
type SharedState = Arc<AppState>;
const DEFAULT_GRADE: &str = "艺术类";
const DEFAULT_SUBJECT: &str = "美术";
const DEFAULT_GRADE: &str = "初一";
const DEFAULT_SUBJECT: &str = "数学";
const DEFAULT_DURATION_MINUTES: i16 = 60;
pub fn router() -> (Router<SharedState>, OpenApi) {
@@ -469,8 +469,8 @@ async fn delete_profile(
/// 当前用户的新建档案预设。
#[derive(Debug, Serialize, FromRow, ToSchema)]
#[schema(example = json!({
"grade": "艺术类",
"subject": "美术",
"grade": "初一",
"subject": "数学",
"lesson_duration_minutes": 60,
"updated_at": "2026-07-15T10:00:00Z"
}))]
@@ -488,8 +488,8 @@ struct ProfileDefaults {
/// 保存档案预设的请求体。
#[derive(Debug, Deserialize, ToSchema)]
#[schema(example = json!({
"grade": "艺术类",
"subject": "美术",
"grade": "初一",
"subject": "数学",
"lesson_duration_minutes": 60
}))]
struct ProfileDefaultsInput {
@@ -507,7 +507,7 @@ struct ProfileDefaultsInput {
path = "/api/v1/profile-defaults",
tag = "档案预设",
summary = "读取档案预设",
description = "读取当前用户的预设;尚未保存时直接返回艺术类、美术、60 分钟的系统默认值。",
description = "读取当前用户的预设;尚未保存时直接返回初一、数学、60 分钟的系统默认值。",
params(
("Authorization" = String, Header, description = "Bearer 会话令牌", example = "Bearer <access-token>")
),
@@ -551,8 +551,8 @@ async fn get_defaults(
description = "要保存的档案预设",
content_type = "application/json",
example = json!({
"grade": "艺术类",
"subject": "美术",
"grade": "初一",
"subject": "数学",
"lesson_duration_minutes": 60
})
),