37 Commits

Author SHA1 Message Date
WangDL
df56a76079 feat: 知识库新模型 — KnowledgeSource/KnowledgeChunk/ImportCandidate/BackupJob/MembershipPlan
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 1m16s
2026-05-19 22:09:44 +08:00
6db19c8ac8 fix: COS region changed from ap-guangzhou to ap-beijing
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 59s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 16:35:04 +08:00
01df2453d7 fix: add global /api prefix to match nginx proxy; exclude health endpoint
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 54s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 15:29:36 +08:00
4b11010c65 fix: use double quotes for MYSQL_PASS variable expansion in mysql exec
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 15s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 15:26:03 +08:00
90b07179a3 fix: remove Dockerfile auto-resolve to prevent restart loop; deploy script handles cleanup
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 15s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 15:22:53 +08:00
ebcace0baf fix: auto-resolve failed Prisma migration on container startup
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 16s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 15:14:27 +08:00
6488049923 fix: resolve failed Prisma migration — cleanup partial state before re-deploy
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 15s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 15:00:59 +08:00
9e5fb7cb40 fix: add backend health check + HTTPS nginx config with SSL support
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 12s
2026-05-18 14:44:39 +08:00
33f1cc1859 feat: P2 infrastructure — Docker Compose, shutdown hooks, Prisma migration
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 1m1s
- B20: docker-compose.yml with MySQL 8.0, Redis 7, API, BullMQ Worker, Nginx
- B20: Dockerfile.worker + worker.module.ts + worker.main.ts for standalone worker
- B20: nginx/nginx.conf reverse proxy with gzip, /api/* routes, health check
- B21: app.enableShutdownHooks() in main.ts for graceful SIGTERM handling
- B22: migration adding objectKey/bucket to UploadedFile, AiUsageLog, WaitlistEntry

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 10:50:59 +08:00
82fcaa1f2f fix: replace RateLimitService with global RateLimitGuard
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 59s
RateLimitService could not be injected into feature modules due to
NestJS DI module isolation. Replaced with a global Guard that uses
@RateLimit() decorator metadata to apply per-endpoint limits.

- RateLimitGuard: checks Redis counters, throws 429 on exceed
- Decorators: LoginRateLimit, FeedbackRateLimit, AiAnalysisRateLimit,
  FileUploadRateLimit
- Applied to: auth (login), feedback, ai-analysis, files endpoints

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 10:23:19 +08:00
b1a6160d29 feat: implement P1 async — AI analysis + document import via BullMQ workers
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 59s
B12: AI analysis now async — POST /ai-analysis queues job, returns immediately.
     Worker supports both active-recall and feynman-evaluation types.
B13: DocumentImportWorker fully implemented — all processing moved from
     service to worker. Service only queues and returns.
B14: NotificationWorker already complete (no changes needed).
B15: All 3 workers now fully functional.

New endpoint: GET /ai-analysis/jobs/:id for job status polling.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 10:17:06 +08:00
597c7b2310 feat: implement P1 AI workflows (B7-B10)
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 59s
B7 Feynman evaluation: POST /ai-analysis/feynman
B8 Knowledge import: replaces DocumentImport setTimeout mock with AI
B9 Review card generation: POST /reviews/generate-cards
B10 Learning trend analysis: GET /activity/trend

4 workflows, 4 prompts, 4 schemas, all registered in AiModule.
AiAnalysisRepository made generic to handle varied result shapes.
DocumentImportService now calls KnowledgeImportWorkflow + saves to DB.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 10:07:57 +08:00
bced62c8f6 fix: add missing redis client connect call in onModuleInit
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 58s
ioredis with lazyConnect: true requires explicit .connect() — without it
the client never connects and isHealthy() always returns false.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 23:00:11 +08:00
3137d58a5d fix: 移除 FilesService 中的 RateLimitService 注入
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 56s
RateLimitService 未在 @Global Module 中,feature module 无法注入。
限流后续通过 Guard/Interceptor 统一处理。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 22:52:27 +08:00
ca90d34b22 fix: 将 RateLimitService 注入从 StorageService 移到 FilesService
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 56s
StorageService 在 @Global StorageModule 中,无法注入 AppModule 的 RateLimitService。
将限流调用上移到 FilesService.requestUploadUrl 中。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 22:50:31 +08:00
c30f7cdb63 fix: Docker CMD 添加 prisma migrate deploy,启动时自动应用迁移
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 2s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 22:43:19 +08:00
6d7cbffc3b feat: COS 对象存储接入 — CosStorageProvider + FilesModule
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 3m0s
- 安装 cos-nodejs-sdk-v5,封装 CosStorageProvider(upload/download/delete/healthCheck)
- 重写 StorageService,新增 createUploadUrl/verifyUpload/getDownloadUrl/deleteObject
- 创建 FilesModule:POST /files/upload-url, POST /files/complete, GET /files/:id, DELETE /files/:id
- UploadedFile 新增 objectKey/bucket 字段
- 对象键格式 {userId}/{YYYYMM}/{sanitizedName}.{ext}
- 接入文件类型校验(ALLOWED_FILE_TYPES)+ 上传限流(10次/小时/用户)
- 配置文件 cos.longde.cloud → zhixi-1259685406 / ap-guangzhou

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 22:30:14 +08:00
08f31dd5b6 feat: P0 后端补全 — BullMQ Workers 注册 + 用户 Profile API + 角色权限
- AppModule 注册 3 个 BullMQ Workers (AiAnalysis/DocumentImport/Notification)
- Users 模块新增 GET/PATCH /users/me/profile 端点:
  - GET 读取 UserProfile (learningIdentity, learningDirection, bio, currentGoal)
  - PATCH upsert UserProfile
  - GET /users/me 返回 profile + preferences (include join)
- 新增 RolesGuard + @Roles() 装饰器 (UserRole enum)
- QueueModule/QueueService 改进
- 各模块 controller/repository/service 完善

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 19:08:07 +08:00
277c375f82 docs: 更新 Swagger 文档说明、补充 Basic Auth 保护信息
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 20s
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 00:50:59 +08:00
007b56dad5 feat: AI三层架构 + 全局JwtAuthGuard + 12个Repository迁Prisma
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 1m0s
- AI: 新三层架构 Provider→Gateway→Workflow(15文件,DeepSeek+MiniMax)
- Auth: 全局JwtAuthGuard + @Public()装饰器白名单路由
- DB: 12个Repository从Map/Array迁到Prisma
- Schema: 新增AiUsageLog、WaitlistEntry模型
- API: /api-docs-json加Basic Auth保护
- 清理: 删除infrastructure/ai、docs/旧文档

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-17 00:39:46 +08:00
fa69749884 refactor(auth): restructure auth system, align with iOS login flow spec
- Split AuthService into AppleAuthService, TokenService, AuthService
- Add dev-login endpoint (dev-only, disabled in production)
- AppleLoginDto: authorizationCode optional, add userIdentifier/email/fullName/nonce
- Login/refresh responses now include user object
- logout: single-token revoke + JwtAuthGuard protection
- users.repository: switch from in-memory Map to Prisma persistence
- JWT payload includes role, guards attach full user info to request
- Dual JWT secret support (JWT_ACCESS_SECRET / JWT_REFRESH_SECRET)
- Replace jwks-rsa+jsonwebtoken with jose library
- Prisma User model: add role field
- Independent DTO files with @Transform for empty string safety
- Add 5 iOS login flow documentation files
2026-05-13 17:31:50 +08:00
387785bd1e ci: deploy workflow 加 Apple 登录环境变量
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 19s
2026-05-13 15:54:59 +08:00
77c62599b1 feat: Apple 登录真实验签 - jwks-rsa + jsonwebtoken 验签 Apple identityToken
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 2m13s
2026-05-13 15:35:41 +08:00
a16871fdc5 chore: 再次排除敏感文件
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 19s
2026-05-09 21:08:55 +08:00
8ba754daad ci: 改用 host 模式 runner + 纯 shell workflow
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 2m1s
2026-05-09 21:05:03 +08:00
d424175754 ci: 触发 CI/CD 测试
Some checks are pending
Deploy API Server / build-and-deploy (push) Waiting to run
2026-05-09 20:57:21 +08:00
9a4041109e chore: 从远程仓库删除 credentials.md 和 AI回答.md,加入 .gitignore
Some checks are pending
Deploy API Server / build-and-deploy (push) Waiting to run
2026-05-09 20:47:16 +08:00
4435e4a8ab docs: 补移 AI回答.md 到 docs/
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 11s
2026-05-09 20:33:33 +08:00
3e653dc1af docs: 整理文档到 docs/ 文件夹 + 新增 credentials.md 凭据汇总
Some checks failed
Deploy API Server / build-and-deploy (push) Has been cancelled
2026-05-09 20:31:23 +08:00
be29a11a54 fix: mock 模式检查同时看 NODE_ENV 和 AI_PROVIDER
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 10m5s
2026-05-09 19:49:50 +08:00
7e308b01cc fix: Prisma binaryTargets linux-musl-openssl-3.0.x + Dockerfile 精简
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 1m31s
2026-05-09 19:37:15 +08:00
0df5b67a84 fix: Dockerfile 切回 alpine + openssl1.1-compat 兼容 Prisma musl 引擎
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 31s
2026-05-09 19:32:07 +08:00
f0af46dbfe fix: Dockerfile 改用 node:22-slim + openssl 兼容 Prisma
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 1m31s
2026-05-09 19:28:40 +08:00
07d6b889ef feat: Dockerfile + CI/CD deploy workflow + @prisma/client 移入 production deps
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 10m2s
2026-05-09 19:05:48 +08:00
ef7c1f1bc9 feat: 安全基线 + 4个安全漏洞修复 - JWT AuthGuard/OptionalAuthGuard, StrictValidationPipe, 全局异常过滤器, Redis限流429, Apple登录mock模式, BigInt精度修复, SECURITY.md 2026-05-09 18:57:33 +08:00
35de65e99b feat: 重构 api-server 为模块化单体架构,接入 MySQL + Redis
- 按 BACKEND-PLAN.md 将项目重构为 4 层架构:
  config/ -> common/ -> infrastructure/ -> modules/
- 15 个业务模块,遵循 Controller → Service → Repository 分层
- infrastructure: PrismaService / RedisService / QueueService / AiService / StorageService
- common: guards / interceptors / filters / pipes / decorators / dto / types / utils
- Prisma schema 含 27 张表,MySQL 8.0 服务器 db push 成功
- Redis 7 接入: 限流/任务状态/分布式锁/队列预留
- ai-analysis 模块: 每日 50 次限流 + 重复提交锁 + 异步任务状态追踪
- document-import 模块: 异步导入流程 + 进度追踪
- notifications 模块: BullMQ notification 队列预留
- /health 端点实时返回 database + redis 连接状态
- Swagger 注册 15 个 tag,67 个路由全部映射
2026-05-09 18:25:04 +08:00
bd44b7e138 feat: init api-server v0.1
- NestJS + TypeScript 后端 API
- 用户认证 (auth)
- 用户管理 (users)
- 学习路径与课程 (learning)
- AI 分析与对话 (ai)
- 用户反馈 (feedback)
- 等待名单 (waitlist)
- 知识库 (knowledge)
- Swagger API 文档(中文、访问控制)
- Basic Auth 保护生产环境文档
2026-05-04 16:09:01 +08:00