feat: replace Redis with PostgreSQL for caching, rate limiting, SMS codes, and token blacklist

- Add 4 PG entities: VerificationCode, RateLimitEntry, TokenBlacklistEntry, CacheEntry
- Add 4 services: VerificationService, RateLimitService, TokenBlacklistService, CacheService
- Add CleanupBackgroundService for periodic expired data cleanup
- Add MigrationHelper for safe schema migration without data loss
- Update AuthController: real SMS code generation, rate limiting, logout endpoint with JWT blacklist
- Update JwtProvider: add JTI claim for token revocation
- Update Program.cs: register new services, JWT blacklist validation, DB migration
- Remove StackExchange.Redis NuGet package and all Redis config references
- Update start-dev.bat: 6→5 services, remove Redis startup
- Update docs: remove Redis references from all documentation
- Fix: logout button spacing on profile page
- Fix: .gitignore data/→/data/ to not ignore Infrastructure/Data/
This commit is contained in:
MingNian
2026-05-26 13:48:53 +08:00
parent 39ab6062b5
commit d5f167167a
25 changed files with 613 additions and 47 deletions

View File

@@ -234,7 +234,6 @@ GET /api/health-records/export?format=pdf
需要安装的东西和本地一样:
- PostgreSQL 18
- Redis
- MinIO
- .NET 10 Runtime
- Nginx作为反代和静态文件服务
@@ -417,8 +416,8 @@ POST /api/auth/send-sms → 调短信平台API → 用户手机收到验证码
#### 8.2 健康检查
```
GET /health → 检查数据库连接、Redis连接、MinIO连接
返回 { status: "healthy", db: "ok", redis: "ok", minio: "ok" }
GET /health → 检查数据库连接、MinIO连接
返回 { status: "healthy", db: "ok", minio: "ok" }
```
自动化监控:每 30 秒检查一次,挂了自动发短信/邮件报警。