const productsQuery = db.query.categories.findMany({
with: {
productsOnCategory: {
with: {
mediaOnProducts: {
with: { media: true }
}
},
where: (products, {and, eq}) => and(eq(products.isVisible, 1), eq(products.organizationId, orgId))
}
},
where: (categories, { and }) => and(eq(categories.slug, slug), eq(categories.isVisible, 1), eq(categories.organizationId, orgId))
});
const productsQuery = db.query.categories.findMany({
with: {
productsOnCategory: {
with: {
mediaOnProducts: {
with: { media: true }
}
},
where: (products, {and, eq}) => and(eq(products.isVisible, 1), eq(products.organizationId, orgId))
}
},
where: (categories, { and }) => and(eq(categories.slug, slug), eq(categories.isVisible, 1), eq(categories.organizationId, orgId))
});