feat: implement recipe analysis service and data models
Test Suite / test (24.15.0) (push) Has been cancelled

- Added RecipeAnalysisService to handle recipe ingredient analysis, including methods for checking ingredient availability and calculating quantities.
- Introduced new TypeScript definitions for recipe analysis results, including ingredient status and summary.
- Created corresponding Dart models for recipe analysis, including RecipeIngredientAnalysis, RecipeAnalysisSummary, and RecipeShoppingCandidate.
- Updated Flutter UI to reflect changes in ingredient availability status.
- Fixed color opacity issue in recipe image card.
This commit is contained in:
Nils-Johan Gynther
2026-05-06 07:54:03 +02:00
parent 969dafdbc6
commit 9fe85a719c
23 changed files with 1271 additions and 693 deletions
+8 -2
View File
@@ -29,6 +29,12 @@ let RecipesService = RecipesService_1 = class RecipesService {
throwRecipeNotFound(id) {
throw new common_1.NotFoundException(`Recipe with id ${id} not found`);
}
normalizeIngredientName(value) {
const trimmed = value.trim();
if (!trimmed)
return trimmed;
return `${trimmed.charAt(0).toUpperCase()}${trimmed.slice(1)}`;
}
async assertProductsActive(productIds) {
if (productIds.length === 0)
return;
@@ -299,7 +305,7 @@ let RecipesService = RecipesService_1 = class RecipesService {
ingredients: {
create: updateRecipeDto.ingredients.map((ingredient) => ({
productId: ingredient.productId ?? null,
rawName: ingredient.rawName,
rawName: this.normalizeIngredientName(ingredient.rawName),
rawLine: ingredient.rawLine ?? null,
quantity: ingredient.quantity ?? null,
unit: ingredient.unit?.trim() ? ingredient.unit : null,
@@ -443,7 +449,7 @@ let RecipesService = RecipesService_1 = class RecipesService {
ingredients: {
create: createRecipeDto.ingredients.map((ingredient) => ({
productId: ingredient.productId ?? null,
rawName: ingredient.rawName,
rawName: this.normalizeIngredientName(ingredient.rawName),
rawLine: ingredient.rawLine ?? null,
quantity: ingredient.quantity ?? null,
unit: ingredient.unit?.trim() ? ingredient.unit : null,