This commit is contained in:
Morten Olsen
2025-12-09 20:32:08 +01:00
commit 2cfd54c344
54 changed files with 8794 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import type { FastifyPluginAsyncZod } from 'fastify-type-provider-zod';
import { z } from 'zod';
import { DatabaseService } from '#root/services/database/database.ts';
const systemEndpoints: FastifyPluginAsyncZod = async (instance) => {
instance.route({
method: 'GET',
url: '/ready',
schema: {
tags: ['system'],
operationId: 'GET/system/ready',
summary: 'Get system ready state',
response: {
200: z.object({
status: z.literal('ok'),
}),
},
},
handler: async (_, reply) => {
const { services } = instance;
const databaseService = services.get(DatabaseService);
const db = await databaseService.getInstance();
await db.raw('SELECT 1=1');
await reply.send({
status: 'ok',
});
},
});
};
export { systemEndpoints };