28 lines
717 B
TypeScript
28 lines
717 B
TypeScript
import { apiJson } from "@/lib/api";
|
|
import { prisma } from "@/lib/prisma";
|
|
|
|
// Public REST API — website teams (staff ranks). Mirrors src/app/staff/page.tsx:
|
|
// visible ranks (hiddenRank=false) ordered by id.
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET(_req: Request) {
|
|
try {
|
|
const rows = await prisma.websiteTeams.findMany({
|
|
where: { hiddenRank: false },
|
|
select: {
|
|
id: true,
|
|
rankName: true,
|
|
badge: true,
|
|
jobDescription: true,
|
|
staffColor: true,
|
|
},
|
|
orderBy: { id: "asc" },
|
|
});
|
|
|
|
// apiJson serialises BigInt ids → string automatically.
|
|
return apiJson({ data: rows }, { status: 200 });
|
|
} catch {
|
|
return apiJson({ data: [] }, { status: 200 });
|
|
}
|
|
}
|