- Remove unnecessary clone on Copy type (navigator) - Allow dead_code for THEME_KEY constant Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
120 lines
4.3 KiB
JSON
120 lines
4.3 KiB
JSON
{
|
||
"project": "Blog Auth System",
|
||
"source": "consensus plan from deep-interview + omc-plan",
|
||
"planPath": ".omc/plans/blog-auth-consensus.md",
|
||
"stories": [
|
||
{
|
||
"id": "US-001",
|
||
"title": "数据库配置与建表",
|
||
"description": "添加依赖、配置 deadpool 连接池、创建 PostgreSQL 用户表和 session 表",
|
||
"acceptanceCriteria": [
|
||
"Cargo.toml 包含所有必要依赖",
|
||
"src/db/mod.rs 和 src/db/pool.rs 存在,使用 std::sync::LazyLock 全局初始化 deadpool",
|
||
"migrations/001_init.sql 存在,包含 users 表、sessions 表、idx_one_admin 部分唯一索引",
|
||
"SQL 文件可成功在 PostgreSQL 中执行"
|
||
],
|
||
"filesExpected": [
|
||
"Cargo.toml",
|
||
".env",
|
||
"src/db/mod.rs",
|
||
"src/db/pool.rs",
|
||
"migrations/001_init.sql"
|
||
],
|
||
"passes": true
|
||
},
|
||
{
|
||
"id": "US-002",
|
||
"title": "用户模型与认证模块",
|
||
"description": "创建 User/Session 模型和认证工具函数(密码哈希、session 管理)",
|
||
"acceptanceCriteria": [
|
||
"src/models/user.rs 定义 User 结构体和 UserRole 枚举",
|
||
"src/models/session.rs 定义 Session 结构体",
|
||
"src/auth/password.rs 实现 argon2 密码哈希和验证",
|
||
"src/auth/session.rs 实现 UUID v4 token 生成和过期检查",
|
||
"cargo check 在此阶段无编译错误"
|
||
],
|
||
"filesExpected": [
|
||
"src/models/mod.rs",
|
||
"src/models/user.rs",
|
||
"src/models/session.rs",
|
||
"src/auth/mod.rs",
|
||
"src/auth/password.rs",
|
||
"src/auth/session.rs"
|
||
],
|
||
"passes": true
|
||
},
|
||
{
|
||
"id": "US-003",
|
||
"title": "认证 API (Server Functions)",
|
||
"description": "实现 register, login, logout, get_current_user 四个 Dioxus server function",
|
||
"acceptanceCriteria": [
|
||
"register(): 输入验证 + 首个用户 admin + 后续关闭注册",
|
||
"login(): 验证密码 + session 创建 + token 返回",
|
||
"logout(): session 清理",
|
||
"get_current_user(): 查询有效 session 返回 Option<User>",
|
||
"所有函数处理 pool.get().await 超时错误"
|
||
],
|
||
"filesExpected": [
|
||
"src/api/mod.rs",
|
||
"src/api/auth.rs"
|
||
],
|
||
"passes": true
|
||
},
|
||
{
|
||
"id": "US-004",
|
||
"title": "前端页面 - 注册与登录",
|
||
"description": "使用 Tailwind CSS 实现注册页和登录页,支持暗色/亮色主题",
|
||
"acceptanceCriteria": [
|
||
"src/pages/register.rs: 注册表单 + 前端验证 + 错误提示",
|
||
"src/pages/login.rs: 登录表单 + cookie 设置 + 跳转",
|
||
"src/pages/admin.rs: 认证检查 + 欢迎信息 + 登出",
|
||
"src/theme.rs: 暗色/亮色主题切换 + localStorage 持久化",
|
||
"Tailwind CSS CDN + dark: modifier 实现主题"
|
||
],
|
||
"filesExpected": [
|
||
"src/pages/mod.rs",
|
||
"src/pages/register.rs",
|
||
"src/pages/login.rs",
|
||
"src/pages/admin.rs",
|
||
"src/theme.rs"
|
||
],
|
||
"passes": true
|
||
},
|
||
{
|
||
"id": "US-005",
|
||
"title": "后台页面与路由整合",
|
||
"description": "Admin页面、路由定义、session清理任务、main.rs整合",
|
||
"acceptanceCriteria": [
|
||
"src/router.rs: Dioxus 路由定义 (/login, /register, /admin, /)",
|
||
"src/main.rs: 整合所有模块 + server block 启动 dotenvy + session 清理任务",
|
||
"src/tasks/session_cleanup.rs: 每小时清理过期 session",
|
||
"cargo check --features server 无错误",
|
||
"cargo check --target wasm32-unknown-unknown 无错误"
|
||
],
|
||
"filesExpected": [
|
||
"src/router.rs",
|
||
"src/main.rs",
|
||
"src/tasks/session_cleanup.rs",
|
||
"src/tasks/mod.rs"
|
||
],
|
||
"passes": true
|
||
},
|
||
{
|
||
"id": "US-006",
|
||
"title": "验证",
|
||
"description": "端到端验证所有功能",
|
||
"acceptanceCriteria": [
|
||
"启动 PostgreSQL,运行 migration",
|
||
"注册首个用户 -> role=admin",
|
||
"再次注册 -> 收到 'Registration is closed'",
|
||
"登录 -> 返回 token",
|
||
"get_current_user (带 cookie) -> 返回用户信息",
|
||
"错误密码 -> 显示 'Invalid credentials'",
|
||
"Server 和 WASM 目标均编译通过"
|
||
],
|
||
"filesExpected": [],
|
||
"passes": true
|
||
}
|
||
]
|
||
}
|