Luis Kuper
02/23/2022, 9:42 AMupdatedAt DateTime @updatedAt
instead of the in the docs mentioned version
column?
The code would then look like this:
const availableSeat = await client.seat.findFirst({
where: {
Movie: {
name: movieName,
},
claimedBy: null,
},
})
if (!availableSeat) {
throw new Error(`Oh no! ${movieName} is all booked.`)
}
const seats = await client.seat.updateMany({
data: {
claimedBy: userEmail,
},
where: {
id: availableSeat.id,
updatedAt: availableSeat.updatedAt,
},
})