Skip to content

Commit

Permalink
refactor: update health check logic
Browse files Browse the repository at this point in the history
  • Loading branch information
solufa committed Dec 18, 2023
1 parent 5d0cff2 commit cecd472
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions server/api/health/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ export default defineController(() => ({
status: 200,
body: {
server: 'ok',
db: await prismaClient.task
.count()
.then(() => 'ok' as const)
.catch(() => 'ng' as const),
db: await prismaClient.$queryRaw`SELECT CURRENT_TIMESTAMP;`.then(() => 'ok' as const),
},
}),
}));
2 changes: 1 addition & 1 deletion server/api/health/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import type { DefineMethods } from 'aspida';

export type Methods = DefineMethods<{
get: {
resBody: Record<'server' | 'db', 'ok' | 'ng'>;
resBody: Record<'server' | 'db', 'ok'>;
};
}>;

0 comments on commit cecd472

Please sign in to comment.