This commit is contained in:
1 parent
8efd032cc6
commit
df38dccbf1
735 files changed
+128321
-120870
No files matched your search
@@ -8,27 +8,27 @@ import { siteSettings } from "@/lib/services/site-settings";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET(_req: Request) {
|
||||
try {
|
||||
const raw = await siteSettings.get("radio_current_dj_id", "");
|
||||
const id = Number(raw);
|
||||
try {
|
||||
const raw = await siteSettings.get("radio_current_dj_id", "");
|
||||
const id = Number(raw);
|
||||
|
||||
// No DJ configured (empty / non-numeric / zero).
|
||||
if (!raw || !Number.isFinite(id) || id <= 0) {
|
||||
return apiJson({ dj: null });
|
||||
}
|
||||
// No DJ configured (empty / non-numeric / zero).
|
||||
if (!raw || !Number.isFinite(id) || id <= 0) {
|
||||
return apiJson({ dj: null });
|
||||
}
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id },
|
||||
select: { username: true, look: true },
|
||||
});
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id },
|
||||
select: { username: true, look: true },
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
return apiJson({ dj: null });
|
||||
}
|
||||
if (!user) {
|
||||
return apiJson({ dj: null });
|
||||
}
|
||||
|
||||
return apiJson({ dj: { username: user.username, look: user.look } });
|
||||
} catch {
|
||||
// DB / settings unavailable — no DJ rather than a 500.
|
||||
return apiJson({ dj: null }, { status: 200 });
|
||||
}
|
||||
return apiJson({ dj: { username: user.username, look: user.look } });
|
||||
} catch {
|
||||
// DB / settings unavailable — no DJ rather than a 500.
|
||||
return apiJson({ dj: null }, { status: 200 });
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user