- Fix missing await in pets API route causing empty responses - Fix updateSetting to use upsert pattern instead of update-only - Create missing /api/admin/sounds/upload route (upload was broken) - Wire bulk delete actions in catalog table - Replace native confirm() with useConfirmDialog() across rooms and clone pages - Add error logging to silent catch blocks in radio actions and audit route - Add graceful degradation to devops health endpoint - Add cache eviction to clone icon route to prevent memory leak - Internationalize hardcoded Italian strings to English - Remove placeholder created_at fields from prefix API responses - Remove dead code and fix type errors in translations and import pages - Standardize PERMS import path in analytics export route
35 lines
909 B
TypeScript
35 lines
909 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { fetchOpsHealth } from "@/lib/admin/ops-health";
|
|
import { withAdmin } from "@/lib/api-handler";
|
|
import { logger } from "@/lib/logger";
|
|
import { PERMS } from "@/lib/permissions";
|
|
|
|
export const GET = withAdmin({ permission: PERMS.DEVOPS_VIEW }, async () => {
|
|
try {
|
|
const health = await fetchOpsHealth();
|
|
|
|
return NextResponse.json({
|
|
database: health.dbOk,
|
|
dbLatency: health.dbLatencyMs,
|
|
redis: health.redisOk,
|
|
emulator: health.emulatorOk,
|
|
onlineUsers: health.onlineUsers,
|
|
timestamp: new Date().toISOString(),
|
|
});
|
|
} catch (err) {
|
|
logger.error("Health check failed", { err });
|
|
return NextResponse.json(
|
|
{
|
|
database: false,
|
|
dbLatency: null,
|
|
redis: false,
|
|
emulator: false,
|
|
onlineUsers: 0,
|
|
timestamp: new Date().toISOString(),
|
|
error: "Health check partially failed",
|
|
},
|
|
{ status: 503 },
|
|
);
|
|
}
|
|
});
|