Commit Graph

59 Commits

Author SHA1 Message Date
Nils-Johan Gynther 67a7590525 feat(ai): add AI trace tracking and admin panel
Test Suite / backend-pr-quick (push) Has been skipped
Test Suite / quick-import-pr-quick (push) Has been skipped
Test Suite / backend-full (push) Successful in 12m45s
Test Suite / flutter-quality (push) Failing after 7m24s
- Add AiTrace model to Prisma schema with relations to User
- Implement AiTraceService with CRUD operations for AI traces
- Add new admin panel for AI traces with filtering and detail views
- Integrate trace persistence in receipt import flow
- Add API endpoints for listing and retrieving AI traces
- Update Flutter admin UI with new AI tab and navigation
- Add new domain models for AI traces and details
- Add migration for AiTrace table creation

BREAKING CHANGE: None
2026-05-21 17:33:21 +02:00
Nils-Johan Gynther a1a2c33427 feat(shopping-list): add shopping list feature with flyer integration
Test Suite / backend-pr-quick (push) Has been skipped
Test Suite / quick-import-pr-quick (push) Has been skipped
Test Suite / backend-full (push) Successful in 5m8s
Test Suite / flutter-quality (push) Failing after 1m41s
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
2026-05-20 09:07:30 +02:00
Nils-Johan Gynther f6ccdd859f ci(github): add linting and improve CI workflow
Test Suite / backend-pr-quick (push) Has been skipped
Test Suite / quick-import-pr-quick (push) Has been skipped
Test Suite / backend-full (push) Successful in 5m14s
Test Suite / flutter-quality (push) Failing after 1m36s
- Add ESLint configuration for backend TypeScript code
- Include linting step in backend quality checks
- Add linting step to GitHub Actions CI workflow
- Enable configurable Prisma query logging via PRISMA_LOG_QUERIES environment variable
- Update PrismaService to support dynamic log levels based on PRISMA_LOG_QUERIES
- Replace BadRequestException with UnauthorizedException in receipt import security tests
2026-05-18 23:01:29 +02:00
Nils-Johan Gynther d5f903db98 chore(import): improve error handling and add flyer integration
Test Suite / backend-pr-quick (push) Has been skipped
Test Suite / quick-import-pr-quick (push) Has been skipped
Test Suite / backend-full (push) Failing after 3m41s
Test Suite / flutter-quality (push) Successful in 2m3s
- Replace BadRequestException with UnauthorizedException for authentication failures in flyer-import and flyer-selection controllers
- Add bulk selection endpoint in FlyerSelectionController for creating multiple selections in one request
- Update FlyerSelectionModule to include new FlyerSelectionMatcherService and FlyerSelectionSyncController
- Extend FlyerSelectionService with createMany method for bulk operations
- Add new DTOs for bulk selection and receipt matching functionality
- Update ReceiptImportService to accept FlyerSelectionService dependency and track successful rows
- Extend SaveReceiptResponse with flyerAutoSync field for receipt-to-flyer matching results
- Add new API paths for flyer import and selection endpoints
- Update Flutter UI to include Flyer import tab and adjust tab controller length
- Add new domain models and repository methods for flyer import functionality
- Update test files to include new FlyerSelectionService dependency
- Modify .kilo plan documentation to reflect current system architecture
2026-05-18 22:51:27 +02:00
Nils-Johan Gynther 0784c1a032 feat: add tests for QuickImportService and ReceiptImportService parse flow
Test Suite / backend-pr-quick (24.15.0) (push) Has been skipped
Test Suite / quick-import-pr-quick (24.15.0) (push) Has been skipped
Test Suite / backend-full (24.15.0) (push) Failing after 27s
Test Suite / flutter-quality (push) Failing after 4s
2026-05-12 20:56:13 +02:00
Nils-Johan Gynther 44ea3cdd7e feat: add unit tests for ReceiptImportService.saveReceipt method
Test Suite / backend-pr-quick (24.15.0) (push) Has been skipped
Test Suite / backend-full (24.15.0) (push) Failing after 21s
Test Suite / flutter-quality (push) Failing after 4s
2026-05-12 20:01:30 +02:00
Nils-Johan Gynther 1db30c9b6f test(security): add and refactor api security/idor coverage
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-11 16:40:16 +02:00
Nils-Johan Gynther 65137b41fb feat: implement alias strategy for receipt import with user-scoped and global fallback, enhance validation and normalization, and update UI components
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-09 23:41:42 +02:00
Nils-Johan Gynther d2f651fa2c feat: enhance error handling in prepareMatchingContext with logging for category loading issues
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-09 16:07:22 +02:00
Nils-Johan Gynther b09ea28ff0 feat: remove deprecated refreshCategories endpoint and refactor matching logic for improved clarity and performance
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-09 15:38:08 +02:00
Nils-Johan Gynther 4d5c55f459 feat: deprecate matchProducts and enrichWithAiCategories methods, update categorization logic with unified matcher
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-09 15:27:24 +02:00
Nils-Johan Gynther 97e7b09bcd feat: simplify receipt import matching logic and enhance trace logging
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-09 15:17:00 +02:00
Nils-Johan Gynther 1966a92a87 feat: implement unified matching and categorization for receipt items with detailed debug information
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-09 15:11:06 +02:00
Nils-Johan Gynther 8354abbc8f feat: implement save receipt functionality with transaction handling and DTOs
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-09 15:04:23 +02:00
Nils-Johan Gynther 853e853e5e feat: enhance ingredient matching rules with keyword matching and add chocolate detection
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-08 17:36:06 +02:00
Nils-Johan Gynther d92272e554 feat: implement matchedVia tracking for receipt items and enhance user alias management
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-07 13:57:41 +02:00
Nils-Johan Gynther a68a0ca86f feat: add unit mapping functionality
Test Suite / test (24.15.0) (push) Has been cancelled
- Added new API path for unit mappings in `api_paths.dart`.
- Implemented `upsertUnitMapping` method in `ImportRepository` to handle unit mapping creation.
- Updated `ReceiptImportTab` to learn and save unit mappings during receipt import.
- Created DTO for unit mapping with validation in `create-unit-mapping.dto.ts`.
- Added SQL migration for `UnitMapping` table creation with necessary constraints.
2026-05-07 10:00:42 +02:00
Nils-Johan Gynther 7d63b615b6 feat: add unit mapping functionality and confirmation dialog for unit changes in import process
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-07 08:10:56 +02:00
Nils-Johan Gynther 04b1fc3024 feat: add rematch functionality for recipe ingredients and enhance inventory management
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>
2026-05-06 09:20:31 +02:00
Nils-Johan Gynther 64b06435cf feat: implement user-scoped receipt aliases with global fallback; enhance alias management in admin panel
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-04 19:43:13 +02:00
Nils-Johan Gynther 7c382dbf2e fix: forward 503 from importer-api as ServiceUnavailableException instead of 400
Test Suite / test (24.15.0) (push) Has been cancelled
2026-05-03 22:15:33 +02:00
Nils-Johan Gynther 5b6d44b555 feat(receipt-import): enhance receipt processing with new category rules and add unit tests
Co-authored-by: Copilot <copilot@github.com>
2026-05-03 19:55:32 +02:00
Nils-Johan Gynther a555e74201 feat(receipt-import): add function to ignore specific receipt names and filter out ignored items
Co-authored-by: Copilot <copilot@github.com>
2026-05-03 18:18:07 +02:00
Nils-Johan Gynther fa7f225ee5 feat(receipt-import): enhance bread category detection and improve session management
Co-authored-by: Copilot <copilot@github.com>
2026-05-03 16:34:15 +02:00
Nils-Johan Gynther 2612a64ca5 fix(receipt-import): add missing UseGuards import in receipt-import.controller.ts
Co-authored-by: Copilot <copilot@github.com>
2026-05-03 10:54:36 +02:00
Nils-Johan Gynther b2eb870ec7 feat(receipt-import): add refresh categories endpoint and UI integration
Co-authored-by: Copilot <copilot@github.com>
2026-05-03 10:48:06 +02:00
Nils-Johan Gynther d4769519c2 fix(receipt-import): correct regex for single pack extraction to handle unit formatting 2026-05-03 08:14:35 +02:00
Nils-Johan Gynther f108034742 fix(receipt-import): upgrade confidence level for next suggestion based on rule application 2026-05-02 23:36:19 +02:00
Nils-Johan Gynther b7d68afd58 chore(receipt-import): include quantity and package details in decision trace 2026-05-02 23:12:24 +02:00
Nils-Johan Gynther 5286db4385 fix(receipt-import): harden bacon signal detection with pork category fallback chain 2026-05-02 23:09:45 +02:00
Nils-Johan Gynther 4345547cbf chore(receipt-import): add decision-path tracing for category pipeline 2026-05-02 22:58:45 +02:00
Nils-Johan Gynther 60ab2465aa fix(receipt-import): add hard bacon override to pork category 2026-05-02 22:51:17 +02:00
Nils-Johan Gynther f45ec08c58 fix(receipt-import): replace invalid isNotEmpty string check 2026-05-02 22:47:07 +02:00
Nils-Johan Gynther 2cf0372eef fix(receipt-import): strengthen bacon detection with OCR-tolerant rule signals 2026-05-02 21:01:38 +02:00
Nils-Johan Gynther a88d6e2452 feat(receipt-import): run rules and AI for all users with trust-aware overrides 2026-05-02 20:48:47 +02:00
Nils-Johan Gynther 6733a50cfb fix(receipt-import): route egg items away from allergy dairy 2026-05-02 20:32:50 +02:00
Nils-Johan Gynther d9113bb89a fix(receipt-import): map standard milk away from lactose-free branch 2026-05-02 20:32:29 +02:00
Nils-Johan Gynther d2567e158c fix(receipt-import): classify vispgradde under dairy matlagning rules 2026-05-02 20:31:07 +02:00
Nils-Johan Gynther d823143611 feat(receipt-import): expand deterministic category rules and AI contradiction guards 2026-05-02 20:28:40 +02:00
Nils-Johan Gynther 5842646e77 feat(products): include ownerId in product creation and enforce its requirement 2026-05-02 19:12:26 +02:00
Nils-Johan Gynther 4e568b4d2e feat(migration): enforce ownerId requirement in Product table
- Removed all products without an owner to maintain data integrity.
- Updated ownerId column to be non-nullable.
- Modified foreign key constraint for ownerId to use ON DELETE CASCADE.
2026-05-02 19:05:33 +02:00
Nils-Johan Gynther ec24f49836 feat(categories): add new categories for Kondis & fika and Kaffebröd, and Te & choklad 2026-05-02 17:44:01 +02:00
Nils-Johan Gynther 1604751b65 feat(receipt-import): add rule-based category suggestion logic for items
feat(migrations): add new categories for lactose-free products and allergy options
2026-05-02 16:42:33 +02:00
Nils-Johan Gynther d64f34f4ff feat: enhance product matching logic with improved scoring and tokenization 2026-05-02 00:05:09 +02:00
Nils-Johan Gynther 32358a4e54 fix: update Blob creation for file uploads to use Uint8Array for better buffer handling 2026-04-30 20:15:41 +02:00
Nils-Johan Gynther 8910e6817d fix: update Blob creation for file uploads to handle buffer offsets correctly 2026-04-30 20:12:10 +02:00
Nils-Johan Gynther 797241f262 feat: migrate import functionality to microservice-importer for quick-import, receipt parsing, and markdown parsing 2026-04-30 20:00:32 +02:00
Nils-Johan Gynther 046791b63e feat: allow application/octet-stream MIME type for PDF uploads in receipt import 2026-04-30 13:38:23 +02:00
Nils-Johan Gynther 57fe168543 feat: allow application/octet-stream MIME type for PDF uploads in receipt import
Co-authored-by: Copilot <copilot@github.com>
2026-04-30 13:04:23 +02:00
Nils-Johan Gynther e370062b5c feat: enhance CORS configuration and implement throttling for API endpoints; add admin role checks in controllers 2026-04-21 08:17:44 +02:00