4553f63deb
- monorepo (npm workspaces): apps/api (Fastify+Prisma+TS), apps/web (Vite+React+TS), packages/shared (zod schemas) - SSO via auth.queo.ru: jose+JWKS plugin, requireDocPermission(viewer|user|admin) - DEV_BYPASS_AUTH for local development (hard-checked off in production) - M2: organization upsert, clients CRUD with search, services catalog with soft-delete - BigInt -> Number serializer for Prisma money columns - Embedded Postgres + npm run dev:demo for one-command local boot - Docker compose for queoserver: postgres + api + web (nginx as ingress proxying /api -> api:3030) - First migration 0_init committed (prisma migrate diff) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
17 lines
509 B
TypeScript
17 lines
509 B
TypeScript
import type { FastifyInstance } from 'fastify';
|
|
import { prisma } from '../db.js';
|
|
|
|
export async function healthRoutes(app: FastifyInstance) {
|
|
app.get('/health', async () => ({ ok: true, ts: new Date().toISOString() }));
|
|
|
|
app.get('/health/db', async (_req, reply) => {
|
|
try {
|
|
await prisma.$queryRaw`SELECT 1`;
|
|
return { ok: true };
|
|
} catch (e) {
|
|
app.log.error({ err: e }, 'db health check failed');
|
|
reply.code(503).send({ ok: false, error: 'db_unavailable' });
|
|
}
|
|
});
|
|
}
|