const result = await db.query.property.findFirst({
with: {
content: {
with: {
photos: {
orderBy: (photos, { desc }) => [desc(photos.priority)]},
facilities: true
}
},
room_type: {
with: {
rate_plans: true
}
},
},
where: (property, { eq }) => eq(property.slug, slug),
});
const result = await db.query.property.findFirst({
with: {
content: {
with: {
photos: {
orderBy: (photos, { desc }) => [desc(photos.priority)]},
facilities: true
}
},
room_type: {
with: {
rate_plans: true
}
},
},
where: (property, { eq }) => eq(property.slug, slug),
});