Aman Tiwari
01/09/2022, 9:31 PMconst enquiry = await db.enquiry.findFirst({
where: { id },
include: {
users: {
include: {
user: true,
},
},
},
})
if (!enquiry) throw new NotFoundError()
const partner = enquiry.users.filter((arr) => arr.user.role === "PARTNER")[0]
const customer = enquiry.users.filter((arr) => arr.user.role === "USER")[0]
return { ...enquiry, partner, customer }
is this good idea? what are the other way to do?