import { currentSlideshow, staleAlbums } from "../../../_lib/photos"; export const dynamic = "force-dynamic"; /** 503 when any enabled album has not synced successfully for 48 hours. Probed by Prometheus. */ export async function GET() { const stale = await staleAlbums(); const { photos } = await currentSlideshow(); return Response.json( { status: stale.length ? "stale" : "ok", photos: photos.length, staleAlbums: stale.map(({ title, lastSuccessAt, lastError }) => ({ title, lastSuccessAt, lastError })) }, { status: stale.length ? 503 : 200, headers: { "Cache-Control": "no-store" } }, ); }