04b1fc3024
Test Suite / test (24.15.0) (push) Has been cancelled
- Added a new API path for rematching recipe ingredients in `api_paths.dart`. - Implemented a manual product creation dialog in `inventory_screen.dart` to allow users to create new products directly. - Integrated the rematch functionality in `recipe_repository.dart` to handle rematching of recipe ingredients. - Updated the recipe detail screen to include a button for triggering the rematch process. - Introduced a new `RecipeMatchingService` in the backend to handle ingredient matching logic. - Added database migration to include `aiEngineEnabled` column in the User table. Co-authored-by: Copilot <copilot@github.com>
94 lines
2.8 KiB
TypeScript
94 lines
2.8 KiB
TypeScript
import { PrismaService } from '../prisma/prisma.service';
|
|
import { AiService } from '../ai/ai.service';
|
|
type AnalysisStatus = 'exact_match' | 'covered_by_pantry' | 'substitutable' | 'missing';
|
|
export declare class RecipeAnalysisService {
|
|
private readonly prisma;
|
|
private readonly aiService;
|
|
constructor(prisma: PrismaService, aiService: AiService);
|
|
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;
|
|
}[];
|
|
}>;
|
|
rematchRecipeIngredients(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 {};
|