Commit Graph

4 Commits

Author SHA1 Message Date
1b142f2866 feat: 添加题目批量发布、归档和删除接口
- 新增 batchUpdateStatus 通用方法,带状态流转校验和 BatchResult 报告
- 改造 batchPublish 使用新方法,返回成功/失败详情
- 新增 batchArchive 和 batch-delete 端点(软删除)
- 使用 inArray 批量查询和更新,优化数据库往返
- 更新 API 文档,补充三个批量接口说明
2026-04-11 22:19:02 +08:00
6a5490dea4 feat: 添加题目状态变更接口(带流转校验)
新增 PATCH /admin/questions/:id/status 接口,支持题目状态流转并校验合法性:
- draft → reviewing, archived
- reviewing → published, draft, archived
- published → archived
- archived → draft
2026-04-11 21:17:34 +08:00
b872b1cad9 feat: implement Phase 1b core features and Phase 1c commercialization
Phase 1b — Core Features:
- Huawei ID Kit login (token exchange + user info) with guest mode
- Quiz engine: randomized questions, distractor shuffling, answer verification
- XP service with combo bonuses (3/5/10-hit streaks), daily reset
- Streak service: >=3 correct/day, freeze, UTC date handling
- Hearts service: 5/day, 30min auto-restore, Pro unlimited
- 50 quiz questions across 3 categories (history/drama/crosstalk)
- 13 skill tree chapters with linear progression
- Idempotent seed import script (categories → skill tree → questions)
- 7 admin CRUD services (questions, categories, knowledge cards,
  skill tree, users, stats, feedback) with Zod validation
- All routes use Zod schema validation, /auth/me endpoint

Phase 1c — Commercialization:
- Leaderboard with live XP ranking, 10 tiers, weekly settlement
- Achievement system with 15 seed achievements and condition checking
- Huawei IAP receipt verification + subscription management
- Differentiated rate limiting (auth 10/min, quiz 60/min)
- Admin audit logging middleware

Infrastructure:
- Vitest test framework with DB mock utilities (19 tests passing)
- 12 DB tables (5 new: question_ratings, user_feedback, achievements,
  user_achievements, leaderboard_snapshots, subscriptions, admin_audit_log)
- TypeScript strict mode: zero errors
2026-04-09 00:12:12 +08:00
f6e7be324e feat: initialize duoqi-api project skeleton
Set up Fastify + TypeScript + Drizzle ORM backend with:
- Database schema (7 tables: users, categories, questions, knowledge_cards, user_progress, skill_tree, user_chapter_progress)
- JWT auth middleware + admin token auth
- Route structure for auth, quiz, progress, gamification, payment, and admin
- Service stubs for Phase 1b implementation
- Zod-validated env config, custom error classes
2026-04-08 21:24:15 +08:00