sagar lama
12/23/2021, 5:04 AMmodel User {
id Int @id @default(autoincrement())
email String @unique
first_name String
last_name String
signup_token SignUpToken?
}
model SignUpToken {
id Int @id @default(autoincrement())
token Int
user User @relation(fields: [userId], references: [id])
userId Int @unique
created_at DateTime
updated_at DateTime @default(now())
}
Can the following two queries be combined into one?
const user = await this.prismaService.user.findFirst({
where: {
email: resendTokenInput.email
}
});
await this.prismaService.signUpToken.delete({
where: {
userId: user.id
}
});
Chris Tsongas
12/23/2021, 8:37 AMawait this.prismaService.signUpToken.delete({
where: {
user: {
email: resendTokenInput.email
}
}
});
Chris Tsongas
12/23/2021, 8:39 AM