fix: align next config with next 15.5.5
This commit is contained in:
parent
0cf1892256
commit
91d0608838
8 changed files with 642 additions and 510 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import { NextResponse } from "next/server"
|
||||
|
||||
import { Prisma } from "@prisma/client"
|
||||
import { prisma } from "@/lib/prisma"
|
||||
import { assertStaffSession } from "@/lib/auth-server"
|
||||
import { isAdmin } from "@/lib/authz"
|
||||
import { PrismaClientKnownRequestError } from "@prisma/client/runtime/library"
|
||||
|
||||
export const runtime = "nodejs"
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ export async function PATCH(request: Request, { params }: { params: Promise<{ id
|
|||
return NextResponse.json({ company })
|
||||
} catch (error) {
|
||||
console.error("Failed to update company", error)
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === "P2002") {
|
||||
if (error instanceof PrismaClientKnownRequestError && error.code === "P2002") {
|
||||
return NextResponse.json({ error: "Já existe uma empresa com este slug." }, { status: 409 })
|
||||
}
|
||||
return NextResponse.json({ error: "Falha ao atualizar empresa" }, { status: 500 })
|
||||
|
|
@ -95,7 +95,7 @@ export async function DELETE(_: Request, { params }: { params: Promise<{ id: str
|
|||
await prisma.company.delete({ where: { id: company.id } })
|
||||
return NextResponse.json({ ok: true })
|
||||
} catch (error) {
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError && error.code === "P2003") {
|
||||
if (error instanceof PrismaClientKnownRequestError && error.code === "P2003") {
|
||||
return NextResponse.json(
|
||||
{ error: "Não é possível remover esta empresa pois existem registros vinculados." },
|
||||
{ status: 409 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue