feat: update inventory queries to filter by product owner for improved user-specific analysis
Test Suite / test (24.15.0) (push) Has been cancelled
Test Suite / test (24.15.0) (push) Has been cancelled
This commit is contained in:
@@ -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 },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user