feat: implement recipe analysis service and data models
Test Suite / test (24.15.0) (push) Has been cancelled
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:
@@ -0,0 +1,50 @@
|
||||
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 {};
|
||||
Reference in New Issue
Block a user