fix(app): 全链路验证修复 — 编译错误/CORS/迁移/启动脚本
Some checks failed
Main Merge / backend (push) Has been cancelled
Main Merge / frontend (push) Has been cancelled

前端修复:
- calendar_page: 移除不存在的 JournalEntry.content getter
- responsive_scaffold: 移除不存在的 notchThickness 参数
- splash_page: SingleTickerProvider → TickerProvider (多 AnimationController)
- profile_page: UserRoleType.name → .code (修复运行时崩溃)
- 导入缺失的 user.dart

后端修复:
- class_service: generate_class_code 取 UUID 后6位(随机部分)避免碰撞
- diary_role_seed: 移除不存在的 id 列,使用复合主键 ON CONFLICT

基础设施:
- config/default.toml: CORS 改为通配符(开发模式)
- scripts/dev.sh: 统一启动脚本(自动清理端口)
- docs/opendesign/: Open Design 设计规格 HTML 原型稿

验证结果: flutter analyze 0 error, cargo test 77/77 通过, 17个页面全部渲染正常
This commit is contained in:
iven
2026-06-02 01:03:58 +08:00
parent 749ef55b89
commit b320641d9c
56 changed files with 20696 additions and 239 deletions

View File

@@ -341,11 +341,17 @@ impl ClassService {
/// 生成 6 位班级码UUID 前 6 位字符)
fn generate_class_code() -> String {
// UUID v7 毫秒级时间戳前缀在紧凑循环中可能重复
// 取后 6 位(随机部分)而非前 6 位(时间戳部分)
Uuid::now_v7()
.to_string()
.replace("-", "")
.chars()
.rev()
.take(6)
.collect::<String>()
.chars()
.rev()
.collect()
}

View File

@@ -49,14 +49,15 @@ impl MigrationTrait for Migration {
];
for (role_code, perm_code) in &role_permissions {
// role_permissions 表主键为 (role_id, permission_id),无 id 列
let sql = format!(
r#"INSERT INTO role_permissions (id, role_id, permission_id, tenant_id, created_at, updated_at, created_by, updated_by, version)
SELECT gen_random_uuid(), r.id, p.id, r.tenant_id, now(), now(), {tid}, {tid}, 1
r#"INSERT INTO role_permissions (role_id, permission_id, tenant_id, created_at, updated_at, created_by, updated_by, version)
SELECT r.id, p.id, r.tenant_id, now(), now(), {tid}, {tid}, 1
FROM roles r
JOIN permissions p ON p.tenant_id = r.tenant_id
WHERE r.code = '{role_code}' AND r.tenant_id = {tid} AND r.deleted_at IS NULL
AND p.code = '{perm_code}' AND p.deleted_at IS NULL
ON CONFLICT DO NOTHING"#,
ON CONFLICT (role_id, permission_id) DO NOTHING"#,
);
conn.execute(sea_orm::Statement::from_string(
sea_orm::DatabaseBackend::Postgres,