Trying to figure out how to make this relation between two tables by doing a lookup on second table.
model Person {
personId String @id @default(uuid())
address String @unique
displayName String? @unique
emailAddress String
allow Allow[]
}
model Allow {
allowId String @id @default(uuid())
address String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
profile Profile @relation(fields: [address], references: [address])
@@unique([creatorId, address])
}
I’m trying to return a Profile object with a property of ‘canAllow’ which basically pulls back all the data for a Person with another property of ‘canAllow’ which gets set by checking if there is a matching address in the Allow table.