diff --git a/apps/backend/src/routes/businessAnalytics.ts b/apps/backend/src/routes/businessAnalytics.ts index 284e0ea..d5eae5b 100644 --- a/apps/backend/src/routes/businessAnalytics.ts +++ b/apps/backend/src/routes/businessAnalytics.ts @@ -662,6 +662,7 @@ export const businessAnalyticsRoute = new Elysia({ prefix: "/business-analytics" // ── 3. GET Master Products & Variants List (For Selection Dropdown) ───────── .get("/products-list", async () => { const products = await prisma.product.findMany({ + where: { isDeleted: false }, include: { category: { select: { id: true, name: true } }, brand: { select: { id: true, name: true } }, diff --git a/apps/backend/src/routes/categories.ts b/apps/backend/src/routes/categories.ts index 0a8e95f..0f340ab 100644 --- a/apps/backend/src/routes/categories.ts +++ b/apps/backend/src/routes/categories.ts @@ -25,7 +25,7 @@ export const categoriesRoute = new Elysia({ prefix: "/categories" }) include: { translations: true, _count: { - select: { products: true }, + select: { products: { where: { isDeleted: false } } }, }, }, }); diff --git a/apps/backend/src/routes/tools.ts b/apps/backend/src/routes/tools.ts index 33e55d4..b594e88 100644 --- a/apps/backend/src/routes/tools.ts +++ b/apps/backend/src/routes/tools.ts @@ -6,6 +6,7 @@ export const toolsRoute = new Elysia({ prefix: "/tools" }) // ── 1. GET Master Product Variants (For mapping dropdown/picker) ──────────── .get("/marketplace-products/master-variants", async () => { const variants = await prisma.productVariant.findMany({ + where: { product: { isDeleted: false } }, include: { product: { select: {