chore(types): remove explicit any, fix hook deps, and unused vars across admin/api/tickets; tighten zod server schemas; adjust UI types; fix pdf export expression; minor cleanup

This commit is contained in:
Esdras Renan 2025-10-09 22:43:39 -03:00
parent 0556502685
commit 6ffd6c6392
17 changed files with 104 additions and 59 deletions

View file

@ -19,7 +19,17 @@ export async function POST(request: Request) {
const session = await assertAdminSession()
if (!session) return NextResponse.json({ error: "Não autorizado" }, { status: 401 })
const body = await request.json()
const body = (await request.json()) as Partial<{
name: string
slug: string
isAvulso: boolean
cnpj: string | null
domain: string | null
phone: string | null
description: string | null
address: string | null
contractedHoursPerMonth: number | string | null
}>
const { name, slug, isAvulso, cnpj, domain, phone, description, address, contractedHoursPerMonth } = body ?? {}
if (!name || !slug) {
return NextResponse.json({ error: "Nome e slug são obrigatórios" }, { status: 400 })
@ -27,7 +37,7 @@ export async function POST(request: Request) {
try {
const company = await prisma.company.create({
data: ({
data: {
tenantId: session.user.tenantId ?? "tenant-atlas",
name: String(name),
slug: String(slug),
@ -38,7 +48,7 @@ export async function POST(request: Request) {
phone: phone ? String(phone) : null,
description: description ? String(description) : null,
address: address ? String(address) : null,
} as any),
},
})
return NextResponse.json({ company })
} catch (error) {