fix(types): guard prisma Company fields (isAvulso, contractedHoursPerMonth) with optional casting to accommodate outdated generated types; keep TS strict without any

This commit is contained in:
Esdras Renan 2025-10-09 22:58:24 -03:00
parent c9eaee7309
commit b4bc01bc7e

View file

@ -8,19 +8,22 @@ export const dynamic = "force-dynamic"
export default async function AdminCompaniesPage() {
const companiesRaw = await prisma.company.findMany({ orderBy: { name: "asc" } })
const companies = companiesRaw.map((c) => ({
const companies = companiesRaw.map((c) => {
const extra = c as unknown as { isAvulso?: boolean; contractedHoursPerMonth?: number | null }
return {
id: c.id,
tenantId: c.tenantId,
name: c.name,
slug: c.slug,
isAvulso: Boolean(c.isAvulso ?? false),
contractedHoursPerMonth: c.contractedHoursPerMonth ?? null,
isAvulso: Boolean(extra.isAvulso ?? false),
contractedHoursPerMonth: extra.contractedHoursPerMonth ?? null,
cnpj: c.cnpj ?? null,
domain: c.domain ?? null,
phone: c.phone ?? null,
description: c.description ?? null,
address: c.address ?? null,
}))
}
})
return (
<AppShell
header={