21 lines
441 B
TypeScript
21 lines
441 B
TypeScript
import { prisma } from "@/lib/prisma"
|
|
import { NextResponse } from "next/server"
|
|
|
|
export async function GET(req: Request) {
|
|
const { searchParams } = new URL(req.url)
|
|
const teamId = searchParams.get('teamId')
|
|
|
|
const where: any = { status: "active" }
|
|
|
|
if (teamId) {
|
|
where.teamId = teamId
|
|
}
|
|
|
|
const workers = await prisma.worker.findMany({
|
|
where,
|
|
orderBy: { empNo: "asc" }
|
|
})
|
|
|
|
return NextResponse.json(workers)
|
|
}
|