四端上传

This commit is contained in:
tianmo committed 2026-09-29 15:25:40 +08:00
1 parent 25bbb5f9c8
commit c6e2cb4d5b
276 files changed
+17812 -3

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
import { Controller, Get } from '@nestjs/common';
import { Public } from './common/auth';
import { PrismaService } from './prisma/prisma.service';
@Controller()
export class HealthController {
constructor(private readonly prisma: PrismaService) {}
/** 探活。数据库不可用时不返回 500,只标记 db 状态,便于区分进程挂掉与数据库挂掉。 */
@Public()
@Get('healthz')
async health() {
let db = 'ok';
try {
await this.prisma.$queryRaw`SELECT 1`;
} catch {
db = 'down';
}
return { status: 'ok', db, time: new Date().toISOString() };
}
}