Help with findFirst and none relations
I'm working on seeding my database for a self storage and I'm trying to randomly select a customer with no leases and assign them a lease. This is my code and it's alway returning the same customer:
When I seed the database one customer ends up with all the leases. I assume from the docs that this is how I should be searching for a customer with no leases so I don't understand what I'm doing wrong. Any help would be greatly appreciated
const customer = await prisma.user.findFirst({
where: {
customerLeases: {
none: {}
}
},
select: {
id: true,
contactInfo: true,
},
});When I seed the database one customer ends up with all the leases. I assume from the docs that this is how I should be searching for a customer with no leases so I don't understand what I'm doing wrong. Any help would be greatly appreciated