init: minimum from lab2

This commit is contained in:
2026-11-01 13:37:02 +03:00
parent 0ab3a341aa
commit b4d1497d1c
66 changed files with 13594 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import { Controller, Get } from '@nestjs/common';
import { ApiError } from '../common/filters/api-error';
import { PrismaService } from '../db/prisma.service';
@Controller('health')
export class HealthController {
constructor(private readonly prisma: PrismaService) {}
@Get('live')
live(): { status: 'ok' } {
return { status: 'ok' };
}
@Get('ready')
async ready(): Promise<{ status: 'ok' }> {
try {
await this.prisma.$queryRaw`SELECT 1`;
} catch {
throw new ApiError('unavailable', 'database unavailable');
}
return { status: 'ok' };
}
}