model Client {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
email String @unique
name String?
lastName String?
password String?
profile ClientProfile?
franchise Franchise @relation(fields: [franchiseId], references: [id])
franchiseId Int
Records Record[]
}
model ClientProfile {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
photo String?
age DateTime?
sex String?
birthDate DateTime?
phone String?
alternativePhone String?
documentType String?
documentNumber String?
taxIdentificationNumber String?
frontPhotoID String?
IdPhotoBack String?
nationality String?
province String?
city String?
note String?
country String?
address String?
clientId Int? @unique
client Client? @relation(fields: [clientId], references: [id])
}
我的目标是检索具有特定特许经营权ID和特定文档编号的用户.我正在try 使用Prisma客户端查询来实现这一点:
const client = await this.prisma.userClient.findUnique({
where: {
franchiseId: 1,
clientProfile: {
documentNumber: "23212123221"
}
}
});
我正在将NodeJS与Prisma客户端一起使用