feat(shopping-list): add shopping list feature with flyer integration
This commit introduces a comprehensive shopping list feature with the following key changes: Backend: - Added ShoppingListItem model with relations to User, Product, and Category - Added new fields to FlyerSession for source file metadata - Added categoryId field to FlyerItem model - Implemented session source file retrieval endpoint - Added endpoint for updating flyer session items with category assignment - Added endpoint for planning flyer selections to shopping list - Implemented backfillCategoriesMine for AI-assisted category assignment - Added ShoppingListModule and integrated with FlyerSelectionModule Frontend: - Added ShoppingListScreen and navigation route - Implemented API paths and client methods for shopping list operations - Added category tree loading for shopping list item creation - Integrated shopping list functionality in flyer import tab - Added category backfill trigger in inventory screen - Updated FlyerImportItem model with categoryId support - Added methods for updating flyer session items and retrieving source files Database: - Added new Prisma migration for flyer source metadata and shopping list items - Updated schema with new relations and indexes The shopping list feature allows users to: 1. Plan flyer selections directly to their shopping list 2. View and manage their shopping list items 3. Update flyer session items with proper categorization 4. Retrieve original flyer source files 5. Automatically backfill categories for uncategorized products
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
export type FlyerImportMatchVia = 'alias' | 'exact' | 'token' | 'none';
|
||||
|
||||
export type FlyerImportItem = {
|
||||
flyerItemId: number | null;
|
||||
rawName: string;
|
||||
normalizedName: string;
|
||||
category: string | null;
|
||||
export type FlyerImportItem = {
|
||||
flyerItemId: number | null;
|
||||
rawName: string;
|
||||
normalizedName: string;
|
||||
category: string | null;
|
||||
categoryId: number | null;
|
||||
price: number | null;
|
||||
priceUnit: string | null;
|
||||
comparisonPrice: number | null;
|
||||
@@ -21,10 +22,14 @@ export type FlyerImportItem = {
|
||||
matchReasons: string[];
|
||||
};
|
||||
|
||||
export type FlyerImportResponse = {
|
||||
sessionId: number | null;
|
||||
retailer: 'willys';
|
||||
parserVersion: 'v1';
|
||||
items: FlyerImportItem[];
|
||||
warnings: string[];
|
||||
};
|
||||
export type FlyerImportResponse = {
|
||||
sessionId: number | null;
|
||||
retailer: 'willys';
|
||||
parserVersion: 'v1';
|
||||
sourceAvailable: boolean;
|
||||
sourceFileName: string | null;
|
||||
sourceMimeType: string | null;
|
||||
sourceFileSize: number | null;
|
||||
items: FlyerImportItem[];
|
||||
warnings: string[];
|
||||
};
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsInt, IsOptional, IsString, MaxLength, Min } from 'class-validator';
|
||||
|
||||
export class UpdateFlyerItemDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(191)
|
||||
rawName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => {
|
||||
if (value === null || value === undefined || value === '') return null;
|
||||
if (typeof value === 'number') return value;
|
||||
const parsed = Number(value);
|
||||
return Number.isFinite(parsed) ? parsed : value;
|
||||
})
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
categoryId?: number | null;
|
||||
}
|
||||
Reference in New Issue
Block a user