© 2026 Hedgehog Software, LLC
model Loan { id String @id @default(uuid()) user User @relation(fields: [userId], references: [id]) userId String number Int customer Customer @relation(fields: [customerId], references: [id]) customerId String ornaments String grossWeight Decimal netWeight Decimal estimatedAmount Int loanAmount Int interestRate Decimal date DateTime dueDate DateTime createdAt DateTime @default(now()) updatedAt DateTime @updatedAt repayment Repayment? @relation(fields: [repaymentId], references: [id]) repaymentId String? @@unique([userId, number]) } model Repayment { id String @id @default(uuid()) user User @relation(fields: [userId], references: [id]) userId String number Int date DateTime createdAt DateTime @default(now()) updatedAt DateTime @updatedAt loans Loan[] @@unique([userId, number]) }
const outstanding = await prisma.loan.findMany({ where: { user: { email }, repaymentId: null }, });
Type 'null' is not assignable to type 'string | StringFilter<"Loan"> | undefined'.