33 lines
844 B
TypeScript
33 lines
844 B
TypeScript
import { prisma } from "@/lib/prisma"
|
|
import { NextResponse } from "next/server"
|
|
|
|
export async function GET(req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
const { id } = await params
|
|
const manager = await prisma.shiftManager.findUnique({
|
|
where: { id }
|
|
})
|
|
|
|
return NextResponse.json(manager)
|
|
}
|
|
|
|
export async function PUT(req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
const { id } = await params
|
|
const body = await req.json()
|
|
|
|
const manager = await prisma.shiftManager.update({
|
|
where: { id },
|
|
data: body
|
|
})
|
|
|
|
return NextResponse.json(manager)
|
|
}
|
|
|
|
export async function DELETE(req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
const { id } = await params
|
|
await prisma.shiftManager.delete({
|
|
where: { id }
|
|
})
|
|
|
|
return NextResponse.json({ success: true })
|
|
}
|