feat(GOV-009): 建立后端契约与健康检查

This commit is contained in:
2026-08-13 17:26:51 +08:00
parent 3fc703de0b
commit 420aa22342
32 changed files with 1625 additions and 8 deletions
@@ -0,0 +1,37 @@
import { ApiProperty } from '@nestjs/swagger';
export type HealthStatus = 'healthy' | 'unavailable';
export type DependencyStatus = HealthStatus | 'disabled';
export class DependencyHealthDto {
@ApiProperty({ type: String, enum: ['healthy', 'unavailable', 'disabled'] })
status!: DependencyStatus;
@ApiProperty({ type: String })
detail!: string;
}
export class HealthDependenciesDto {
@ApiProperty({ type: () => DependencyHealthDto })
redis!: DependencyHealthDto;
@ApiProperty({ type: () => DependencyHealthDto })
mysql!: DependencyHealthDto;
@ApiProperty({ type: () => DependencyHealthDto })
rocketMq!: DependencyHealthDto;
}
export class HealthResponseDto {
@ApiProperty({ type: String, enum: ['healthy', 'unavailable'] })
status!: HealthStatus;
@ApiProperty({ type: String, enum: ['api'] })
process!: 'api';
@ApiProperty({ type: String, format: 'date-time' })
checkedAt!: string;
@ApiProperty({ type: () => HealthDependenciesDto })
dependencies!: HealthDependenciesDto;
}