feat: implement club admin dashboard with activity feed and settings
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
/**
|
||||
@@ -6,10 +6,22 @@ import { prisma } from "@/lib/prisma";
|
||||
*
|
||||
* Get all players with their user associations
|
||||
* This is a public endpoint (no authentication required)
|
||||
* Supports search query parameter
|
||||
*/
|
||||
export async function GET() {
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const { searchParams } = new URL(request.url)
|
||||
const search = searchParams.get('search') || ''
|
||||
const limit = parseInt(searchParams.get('limit') || '50')
|
||||
const offset = parseInt(searchParams.get('offset') || '0')
|
||||
|
||||
const where: any = {}
|
||||
if (search) {
|
||||
where.name = { contains: search, mode: 'insensitive' }
|
||||
}
|
||||
|
||||
const players = await prisma.player.findMany({
|
||||
where,
|
||||
include: {
|
||||
user: {
|
||||
select: {
|
||||
@@ -17,7 +29,9 @@ export async function GET() {
|
||||
},
|
||||
},
|
||||
},
|
||||
orderBy: { name: "asc" },
|
||||
orderBy: { currentElo: 'desc' },
|
||||
take: limit,
|
||||
skip: offset,
|
||||
});
|
||||
|
||||
return NextResponse.json(players);
|
||||
|
||||
Reference in New Issue
Block a user