import { Controller, Get, HttpCode, HttpStatus } from '@nestjs/common'; import { ApiOperation, ApiTags } from '@nestjs/swagger'; import { Public } from '@/common/decorators/public.decorator'; import { HealthService, type HealthCheckResult } from './health.service'; @ApiTags('health') @Controller('health') export class HealthController { constructor(private readonly healthService: HealthService) {} /** * Liveness. Answers "is the process running?" and nothing else — it must not * touch the database, or a brief DB blip would make the orchestrator kill * otherwise-healthy containers. */ @Public() @Get('live') @HttpCode(HttpStatus.OK) @ApiOperation({ summary: 'Liveness probe' }) live(): { status: 'ok' } { return { status: 'ok' }; } /** Readiness / deep check: should this instance receive traffic? */ @Public() @Get() @HttpCode(HttpStatus.OK) @ApiOperation({ summary: 'Readiness probe with dependency status' }) check(): Promise { return this.healthService.check(); } }