diff --git a/backend/services/authorization-service/.claude/settings.local.json b/backend/services/authorization-service/.claude/settings.local.json new file mode 100644 index 00000000..13383c27 --- /dev/null +++ b/backend/services/authorization-service/.claude/settings.local.json @@ -0,0 +1,20 @@ +{ + "permissions": { + "allow": [ + "Bash(dir:*)", + "Bash(npm install)", + "Bash(npx prisma:*)", + "Bash(npm test:*)", + "Bash(npm run build:*)", + "Bash(wsl -e bash -c:*)", + "Bash(if exist dist rmdir /s /q dist)", + "Bash(if exist nul del /f /q nul)", + "Bash(if exist coverage rmdir /s /q coverage)", + "Bash(git add:*)", + "Bash(git restore:*)", + "Bash(git commit:*)" + ], + "deny": [], + "ask": [] + } +} diff --git a/backend/services/authorization-service/src/api/controllers/health.controller.ts b/backend/services/authorization-service/src/api/controllers/health.controller.ts new file mode 100644 index 00000000..3ca0be2b --- /dev/null +++ b/backend/services/authorization-service/src/api/controllers/health.controller.ts @@ -0,0 +1,16 @@ +import { Controller, Get } from '@nestjs/common' +import { ApiTags, ApiOperation } from '@nestjs/swagger' + +@ApiTags('Health') +@Controller('health') +export class HealthController { + @Get() + @ApiOperation({ summary: '健康检查' }) + check() { + return { + status: 'ok', + service: 'authorization-service', + timestamp: new Date().toISOString(), + } + } +} diff --git a/backend/services/authorization-service/src/api/controllers/index.ts b/backend/services/authorization-service/src/api/controllers/index.ts index 7992725a..98b5f0c9 100644 --- a/backend/services/authorization-service/src/api/controllers/index.ts +++ b/backend/services/authorization-service/src/api/controllers/index.ts @@ -1,2 +1,3 @@ export * from './authorization.controller' export * from './admin-authorization.controller' +export * from './health.controller' diff --git a/backend/services/authorization-service/src/app.module.ts b/backend/services/authorization-service/src/app.module.ts index c518f25d..6a930fc1 100644 --- a/backend/services/authorization-service/src/app.module.ts +++ b/backend/services/authorization-service/src/app.module.ts @@ -25,7 +25,7 @@ import { AuthorizationApplicationService, REFERRAL_REPOSITORY, TEAM_STATISTICS_R import { MonthlyAssessmentScheduler } from '@/application/schedulers' // API -import { AuthorizationController, AdminAuthorizationController } from '@/api/controllers' +import { AuthorizationController, AdminAuthorizationController, HealthController } from '@/api/controllers' // Shared import { JwtStrategy } from '@/shared/strategies' @@ -69,7 +69,7 @@ const MockTeamStatisticsRepository = { RedisModule, KafkaModule, ], - controllers: [AuthorizationController, AdminAuthorizationController], + controllers: [AuthorizationController, AdminAuthorizationController, HealthController], providers: [ // Prisma PrismaService, diff --git a/backend/services/docker-compose.yml b/backend/services/docker-compose.yml index 7d82a27a..38bf381f 100644 --- a/backend/services/docker-compose.yml +++ b/backend/services/docker-compose.yml @@ -270,7 +270,7 @@ services: kafka: condition: service_started healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:3004/health"] + test: ["CMD", "curl", "-f", "http://localhost:3004/api/v1/health"] interval: 30s timeout: 3s retries: 3 @@ -453,7 +453,7 @@ services: kafka: condition: service_started healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:3009/health"] + test: ["CMD", "curl", "-f", "http://localhost:3009/api/v1/health"] interval: 30s timeout: 3s retries: 3