Files
stash/packages/server/src/endpoints/system/system.ts
2025-12-10 10:26:14 +01:00

30 lines
709 B
TypeScript

import type { FastifyPluginAsyncZod } from 'fastify-type-provider-zod';
import { z } from 'zod';
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 { runtime } = instance;
const db = await runtime.database.getInstance();
await db.raw('SELECT 1=1');
await reply.send({
status: 'ok',
});
},
});
};
export { systemEndpoints };