feat: update inventory queries to filter by product owner for improved user-specific analysis
Test Suite / test (24.15.0) (push) Has been cancelled

This commit is contained in:
Nils-Johan Gynther
2026-05-06 10:34:04 +02:00
parent 7f15f8028b
commit ea44c4fe7a
@@ -82,7 +82,7 @@ export class RecipeAnalysisService {
const pantryProductIds = new Set(pantryItems.map((p) => p.productId)); const pantryProductIds = new Set(pantryItems.map((p) => p.productId));
const userInventory = await this.prisma.inventoryItem.findMany({ const userInventory = await this.prisma.inventoryItem.findMany({
where: { userId }, where: { product: { ownerId: userId } },
select: { productId: true }, select: { productId: true },
}); });
const availableProductIds = new Set<number>([ const availableProductIds = new Set<number>([
@@ -154,7 +154,7 @@ export class RecipeAnalysisService {
} }
const inventoryItems = await this.prisma.inventoryItem.findMany({ const inventoryItems = await this.prisma.inventoryItem.findMany({
where: { productId: ingredient.productId, userId }, where: { productId: ingredient.productId, product: { ownerId: userId } },
select: { quantity: true, unit: true }, select: { quantity: true, unit: true },
}); });