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

@@ -6,12 +6,11 @@ echo ==========================================
echo HealthManager Dev Environment
echo ==========================================
set "REDIS=C:\Program Files\Redis\redis-server.exe"
set "PG_DATA=D:\APP\data\pgdata"
set "PG_BIN=D:\PostgreSQL\18\pgsql\bin"
set "MINIO_DATA=D:\APP\data\minio"
echo.
echo [1/6] Starting PostgreSQL...
echo [1/5] Starting PostgreSQL...
if exist "%PG_BIN%\pg_ctl.exe" (
"%PG_BIN%\pg_ctl.exe" -D "%PG_DATA%" -l "%PG_DATA%\pg.log" start 2>nul
if errorlevel 1 (
@@ -24,17 +23,7 @@ if exist "%PG_BIN%\pg_ctl.exe" (
)
echo.
echo [2/6] Starting Redis...
tasklist /fi "imagename eq redis-server.exe" | find /i "redis-server.exe" >nul
if errorlevel 1 (
start "Redis" /MIN "%REDIS%" "%ProgramFiles%\Redis\redis.windows.conf"
echo Redis started
) else (
echo Redis is already running
)
echo.
echo [3/6] Starting MinIO...
echo [2/5] Starting MinIO...
tasklist /fi "imagename eq minio.exe" | find /i "minio.exe" >nul
if errorlevel 1 (
if not exist "%MINIO_DATA%" mkdir "%MINIO_DATA%"
@@ -45,7 +34,7 @@ if errorlevel 1 (
)
echo.
echo [4/6] Starting Backend API...
echo [3/5] Starting Backend API...
cd /d "%~dp0backend"
start "HealthManager API" dotnet run --project src\HealthManager.WebApi --urls "http://localhost:5000" --environment Development
echo Backend API starting (http://localhost:5000)
@@ -54,12 +43,12 @@ echo Waiting 15s for backend to boot...
timeout /t 15 /nobreak >nul
echo.
echo [5/6] Starting Patient Frontend...
echo [4/5] Starting Patient Frontend...
start "Patient Frontend" cmd.exe /c "cd /d %~dp0frontend-patient && npm run dev"
echo Patient Frontend starting on http://localhost:5173
echo.
echo [6/6] Starting Doctor Frontend...
echo [5/5] Starting Doctor Frontend...
start "Doctor Frontend" cmd.exe /c "cd /d %~dp0frontend-doctor && npm run dev"
echo Doctor Frontend starting on http://localhost:5174
@@ -73,10 +62,9 @@ echo Backend API: http://localhost:5000
echo Swagger: http://localhost:5000/swagger
echo MinIO: http://localhost:9001
echo PostgreSQL: localhost:5432
echo Redis: localhost:6379
echo ==========================================
echo.
echo All 6 services started. Close the 3 new
echo All 5 services started. Close the 3 new
echo windows to stop the apps.
echo.
pause