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:
parent
c9eaee7309
commit
b4bc01bc7e
1 changed files with 7 additions and 4 deletions
|
|
@ -8,19 +8,22 @@ export const dynamic = "force-dynamic"
|
||||||
|
|
||||||
export default async function AdminCompaniesPage() {
|
export default async function AdminCompaniesPage() {
|
||||||
const companiesRaw = await prisma.company.findMany({ orderBy: { name: "asc" } })
|
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,
|
id: c.id,
|
||||||
tenantId: c.tenantId,
|
tenantId: c.tenantId,
|
||||||
name: c.name,
|
name: c.name,
|
||||||
slug: c.slug,
|
slug: c.slug,
|
||||||
isAvulso: Boolean(c.isAvulso ?? false),
|
isAvulso: Boolean(extra.isAvulso ?? false),
|
||||||
contractedHoursPerMonth: c.contractedHoursPerMonth ?? null,
|
contractedHoursPerMonth: extra.contractedHoursPerMonth ?? null,
|
||||||
cnpj: c.cnpj ?? null,
|
cnpj: c.cnpj ?? null,
|
||||||
domain: c.domain ?? null,
|
domain: c.domain ?? null,
|
||||||
phone: c.phone ?? null,
|
phone: c.phone ?? null,
|
||||||
description: c.description ?? null,
|
description: c.description ?? null,
|
||||||
address: c.address ?? null,
|
address: c.address ?? null,
|
||||||
}))
|
}
|
||||||
|
})
|
||||||
return (
|
return (
|
||||||
<AppShell
|
<AppShell
|
||||||
header={
|
header={
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue