added sale item count to db, and to be shown in "Flyers" area
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m22s

This commit is contained in:
2025-12-03 10:35:21 -08:00
parent 5f3de95d0e
commit 29484b61c2
9 changed files with 62 additions and 13 deletions

View File

@@ -97,6 +97,7 @@ CREATE TABLE IF NOT EXISTS public.flyers (
valid_from DATE,
valid_to DATE,
store_address TEXT,
item_count INTEGER DEFAULT 0 NOT NULL,
uploaded_by UUID REFERENCES public.users(user_id) ON DELETE SET NULL,
created_at TIMESTAMPTZ DEFAULT now() NOT NULL,
updated_at TIMESTAMPTZ DEFAULT now() NOT NULL
@@ -111,6 +112,7 @@ COMMENT ON COLUMN public.flyers.store_id IS 'Foreign key linking this flyer to a
COMMENT ON COLUMN public.flyers.valid_from IS 'The start date of the sale period for this flyer, extracted by the AI.';
COMMENT ON COLUMN public.flyers.valid_to IS 'The end date of the sale period for this flyer, extracted by the AI.';
COMMENT ON COLUMN public.flyers.store_address IS 'The physical store address if it was successfully extracted from the flyer image.';
COMMENT ON COLUMN public.flyers.item_count IS 'A cached count of the number of items in this flyer, maintained by a trigger.';
COMMENT ON COLUMN public.flyers.uploaded_by IS 'The user who uploaded the flyer. Can be null for anonymous or system uploads.';
CREATE INDEX IF NOT EXISTS idx_flyers_created_at ON public.flyers (created_at DESC);