feat(api): 搭建 API 与 Worker 骨架及契约基线

NestJS 11 + Fastify 统一错误体与 trace_id,/health 真实探活 DB/Redis,OpenAPI 3.1 契约含 20 个错误码;shared 包提供错误码、权限点、ULID、分页与通用 schema;worker 完成队列进程骨架。
This commit is contained in:
Stev_Wang committed 2026-11-02 17:20:46 +08:00
1 parent 09dbb27b66
commit 23067edb8f
70 files changed
+2445

No files matched your search

@@ -0,0 +1,25 @@
import { Controller, Get, Inject } from '@nestjs/common';
import { ApiOkResponse, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { HealthService } from './health.service';
import { type HealthReport, HealthResponseDto } from './health.types';
@ApiTags('platform')
@Controller('health')
export class HealthController {
constructor(@Inject(HealthService) private readonly healthService: HealthService) {}
@Get()
@ApiOperation({
summary: '健康检查',
description: '真实检查 PostgreSQL 与 Redis;任一不可用返回 503 与统一错误体。',
})
@ApiOkResponse({ type: HealthResponseDto, description: '全部依赖健康' })
@ApiResponse({
status: 503,
description: '依赖不可用(错误码 50002),details 内附各依赖检查结果',
})
async check(): Promise<HealthReport> {
return this.healthService.check();
}
}