const suborders = await db.query.subOrders.findMany({
where: and(isNull(subOrders.kitchenId)),
columns: {
id: true,
quantity: true,
},
with: {
order: true,
product: {
columns: {
id: true,
performancePoints: true,
prepTime: true,
},
with: {
kitchens: {
with: {
kitchen: {
columns: {
id: true,
performancePoints: true,
},
},
},
},
kitchenDependentProperties: {
columns: {
kitchenId: true,
productionPrice: true,
purchasePrice: true,
},
},
},
},
},
});
const suborders = await db.query.subOrders.findMany({
where: and(isNull(subOrders.kitchenId)),
columns: {
id: true,
quantity: true,
},
with: {
order: true,
product: {
columns: {
id: true,
performancePoints: true,
prepTime: true,
},
with: {
kitchens: {
with: {
kitchen: {
columns: {
id: true,
performancePoints: true,
},
},
},
},
kitchenDependentProperties: {
columns: {
kitchenId: true,
productionPrice: true,
purchasePrice: true,
},
},
},
},
},
});