21 lines
678 B
TypeScript
21 lines
678 B
TypeScript
import { getSessionAccount } from "@/lib/auth/require-session";
|
|
import { canReadPage } from "@/lib/auth/permissions";
|
|
import { listEarlyPlayerEmails } from "@/lib/card-gen/early-player-emails";
|
|
|
|
export const runtime = "nodejs";
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET() {
|
|
const account = await getSessionAccount();
|
|
if (!account || !canReadPage(account, "founders-card")) {
|
|
return Response.json({ error: "Unauthorized" }, { status: 401 });
|
|
}
|
|
|
|
const result = await listEarlyPlayerEmails();
|
|
if ("error" in result) {
|
|
return Response.json({ error: result.error }, { status: 500 });
|
|
}
|
|
|
|
return Response.json({ emails: result.rows });
|
|
}
|