T-HUB/apps/api/src/health/health.controller.ts
glass beadian aa5e262f3a Tactical Media Broadcast Hub — initial release
Self-hosted multi-platform broadcast newsroom for activist collectives:
publishing pipeline with group approval and DST-proof scheduling, TweetDeck-style
column wall with hostile-content-safe rendering, live control room with Auto
Director, bridged chat governance with polls and quorum, distributed sandboxed
transcode workers, encrypted content-addressed archive, monthly analytics.

MIT licensed. See README.md and docs/.
2026-10-10 11:56:42 +00:00

26 lines
867 B
TypeScript

import { Controller, Get, Res, Inject } from "@nestjs/common";
import type { Response } from "express";
import { HealthService, type ComponentHealth } from "./health.service";
interface ReadinessBody {
status: "ready" | "degraded";
components: Record<string, ComponentHealth>;
}
@Controller()
export class HealthController {
constructor(@Inject(HealthService) private readonly health: HealthService) {}
@Get("healthz")
liveness(@Res() res: Response): void {
res.status(200).json({ status: "alive" });
}
@Get("readyz")
async readiness(@Res() res: Response): Promise<void> {
const components = await this.health.components();
const ready = Object.values(components).every((c) => c.status === "up");
const body: ReadinessBody = { status: ready ? "ready" : "degraded", components };
res.status(ready ? 200 : 503).json(body);
}
}