9fe85a719c
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.
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { PrismaService } from '../prisma/prisma.service';
|
|
type AnalysisStatus = 'exact_match' | 'covered_by_pantry' | 'substitutable' | 'missing';
|
|
export declare class RecipeAnalysisService {
|
|
private readonly prisma;
|
|
constructor(prisma: PrismaService);
|
|
private getAccessibleRecipe;
|
|
private calculateAvailableQuantity;
|
|
analyzeRecipeIngredients(id: number, userId: number): Promise<{
|
|
recipeId: number;
|
|
ingredients: ({
|
|
ingredientId: any;
|
|
rawName: any;
|
|
quantity: number;
|
|
unit: any;
|
|
note: any;
|
|
status: AnalysisStatus;
|
|
matchedProductId: any;
|
|
matchedProductName: any;
|
|
source: string;
|
|
availableQuantity: number;
|
|
missingQuantity: number;
|
|
} | {
|
|
ingredientId: any;
|
|
rawName: any;
|
|
quantity: number;
|
|
unit: any;
|
|
note: any;
|
|
status: AnalysisStatus;
|
|
matchedProductId: any;
|
|
matchedProductName: any;
|
|
source: null;
|
|
availableQuantity: number;
|
|
missingQuantity: number;
|
|
})[];
|
|
summary: {
|
|
exactCount: number;
|
|
pantryCount: number;
|
|
substituteCount: number;
|
|
missingCount: number;
|
|
};
|
|
shoppingListCandidates: {
|
|
ingredientId: any;
|
|
rawName: any;
|
|
quantity: number;
|
|
unit: any;
|
|
missingQuantity: number;
|
|
}[];
|
|
}>;
|
|
}
|
|
export {};
|