feat: rename ingredients→products, products→user_products; add barcode/OFF import
- Rename catalog: ingredient/* → product/* (canonical_name, barcode, nutrition per 100g)
- Rename pantry: product/* → userproduct/* (user-owned items with expiry)
- Squash migrations into single 001_initial_schema.sql (clean-db baseline)
- product_categories: add English canonical name column; fix COALESCE in queries
- Remove product_translations: product names are stored in their original language
- Add default_unit_name to product API responses via unit_translations JOIN
- Add cmd/importoff: bulk import from OpenFoodFacts JSONL dump (COPY + ON CONFLICT)
- Diary: support product_id entries alongside dish_id (CHECK num_nonnulls = 1)
- Home: getLoggedCalories joins both recipes and catalog products
- Flutter: rename models/providers/services to match backend rename
- Flutter: add barcode scan flow for diary (mobile_scanner, product_portion_sheet)
- Flutter: localise 6 new keys across 12 languages (barcode scan, portion weight)
- Routes: GET /products/search, GET /products/barcode/{barcode}, /user-products
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/locale/unit_provider.dart';
|
||||
import '../products/product_provider.dart';
|
||||
import '../products/user_product_provider.dart';
|
||||
import 'recognition_service.dart';
|
||||
|
||||
/// Editable confirmation screen shown after receipt/products recognition.
|
||||
@@ -31,7 +31,7 @@ class _RecognitionConfirmScreenState
|
||||
quantity: item.quantity,
|
||||
unit: item.unit,
|
||||
category: item.category,
|
||||
mappingId: item.mappingId,
|
||||
primaryProductId: item.primaryProductId,
|
||||
storageDays: item.storageDays,
|
||||
confidence: item.confidence,
|
||||
))
|
||||
@@ -83,13 +83,13 @@ class _RecognitionConfirmScreenState
|
||||
setState(() => _saving = true);
|
||||
try {
|
||||
for (final item in _items) {
|
||||
await ref.read(productsProvider.notifier).create(
|
||||
await ref.read(userProductsProvider.notifier).create(
|
||||
name: item.name,
|
||||
quantity: item.quantity,
|
||||
unit: item.unit,
|
||||
category: item.category,
|
||||
storageDays: item.storageDays,
|
||||
mappingId: item.mappingId,
|
||||
primaryProductId: item.primaryProductId,
|
||||
);
|
||||
}
|
||||
if (mounted) {
|
||||
@@ -123,7 +123,7 @@ class _EditableItem {
|
||||
double quantity;
|
||||
String unit;
|
||||
final String category;
|
||||
final String? mappingId;
|
||||
final String? primaryProductId;
|
||||
final int storageDays;
|
||||
final double confidence;
|
||||
|
||||
@@ -132,7 +132,7 @@ class _EditableItem {
|
||||
required this.quantity,
|
||||
required this.unit,
|
||||
required this.category,
|
||||
this.mappingId,
|
||||
this.primaryProductId,
|
||||
required this.storageDays,
|
||||
required this.confidence,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user