- Added new API path for unit mappings in `api_paths.dart`. - Implemented `upsertUnitMapping` method in `ImportRepository` to handle unit mapping creation. - Updated `ReceiptImportTab` to learn and save unit mappings during receipt import. - Created DTO for unit mapping with validation in `create-unit-mapping.dto.ts`. - Added SQL migration for `UnitMapping` table creation with necessary constraints.
This commit is contained in:
+2
-1
@@ -77,6 +77,7 @@ let RecipeAnalysisService = class RecipeAnalysisService {
|
||||
});
|
||||
const pantryProductIds = new Set(pantryItems.map((p) => p.productId));
|
||||
const userInventory = await this.prisma.inventoryItem.findMany({
|
||||
where: { product: { ownerId: userId } },
|
||||
select: { productId: true },
|
||||
});
|
||||
const availableProductIds = new Set([
|
||||
@@ -142,7 +143,7 @@ let RecipeAnalysisService = class RecipeAnalysisService {
|
||||
};
|
||||
}
|
||||
const inventoryItems = await this.prisma.inventoryItem.findMany({
|
||||
where: { productId: ingredient.productId },
|
||||
where: { productId: ingredient.productId, product: { ownerId: userId } },
|
||||
select: { quantity: true, unit: true },
|
||||
});
|
||||
const availableQuantity = this.calculateAvailableQuantity(inventoryItems, requiredUnit);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user