From ea44c4fe7a6f614c3356bacc45a1ad0d2d2d9297 Mon Sep 17 00:00:00 2001 From: Nils-Johan Gynther Date: Wed, 6 May 2026 10:34:04 +0200 Subject: [PATCH] feat: update inventory queries to filter by product owner for improved user-specific analysis --- backend/src/recipes/recipe-analysis.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/recipes/recipe-analysis.service.ts b/backend/src/recipes/recipe-analysis.service.ts index a4922719..6b5f0afd 100644 --- a/backend/src/recipes/recipe-analysis.service.ts +++ b/backend/src/recipes/recipe-analysis.service.ts @@ -82,7 +82,7 @@ export class RecipeAnalysisService { const pantryProductIds = new Set(pantryItems.map((p) => p.productId)); const userInventory = await this.prisma.inventoryItem.findMany({ - where: { userId }, + where: { product: { ownerId: userId } }, select: { productId: true }, }); const availableProductIds = new Set([ @@ -154,7 +154,7 @@ export class RecipeAnalysisService { } const inventoryItems = await this.prisma.inventoryItem.findMany({ - where: { productId: ingredient.productId, userId }, + where: { productId: ingredient.productId, product: { ownerId: userId } }, select: { quantity: true, unit: true }, });