feat(GOV-009): 建立后端契约与健康检查
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user