feat: add player name editing functionality in admin UI and fix site_admin access to admin dashboard

This commit is contained in:
2026-03-30 21:58:30 -07:00
parent 9201b2c437
commit db782ff504
4 changed files with 264 additions and 29 deletions
+32
View File
@@ -0,0 +1,32 @@
import { NextResponse } from "next/server";
import { prisma } from "@/lib/prisma";
/**
* GET /api/players
*
* Get all players with their user associations
* This is a public endpoint (no authentication required)
*/
export async function GET() {
try {
const players = await prisma.player.findMany({
include: {
user: {
select: {
email: true,
},
},
},
orderBy: { name: "asc" },
});
return NextResponse.json(players);
} catch (error: unknown) {
console.error("Error fetching players:", error);
const message = error instanceof Error ? error.message : "Failed to fetch players";
return NextResponse.json(
{ error: message },
{ status: 500 }
);
}
}