In a book rental app, to query a book that isn't returned yet (returnedAt
is either null
or undefined
):
const rented = await this.db.rental.findFirst({
where: {
book: {
uuid: params.id,
},
OR: [
{
returnedAt: null,
},
{
returnedAt: {
isSet: false,
},
},
],
},
})