chore: scaffold turbo monorepo with hono api and react admin web
This commit is contained in:
23
apps/api/src/modules/health/get-status/use-case.ts
Normal file
23
apps/api/src/modules/health/get-status/use-case.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Ok, type Result, type ProblemDetails } from '@superlist/shared'
|
||||
|
||||
export type HealthStatus = {
|
||||
status: 'ok'
|
||||
uptimeSeconds: number
|
||||
timestamp: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the liveness status of the process.
|
||||
* No dependencies and no failure mode: it must always succeed.
|
||||
*/
|
||||
export class GetStatus {
|
||||
constructor(private readonly now: () => Date = () => new Date()) {}
|
||||
|
||||
execute(): Result<HealthStatus, ProblemDetails> {
|
||||
return Ok({
|
||||
status: 'ok',
|
||||
uptimeSeconds: Math.round(process.uptime()),
|
||||
timestamp: this.now().toISOString(),
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user