feat: implement Iteration 4 — menu planning, shopping list, diary
Backend: - Migrations 007 (menu_plans, menu_items, shopping_lists) and 008 (meal_diary) - gemini/menu.go: GenerateMenu — 7-day × 3-meal plan via one Groq call - internal/menu: model, repository (GetByWeek, SaveMenuInTx, shopping list CRUD), handler (GET/PUT/DELETE /menu, POST /ai/generate-menu, shopping list endpoints) - internal/diary: model, repository, handler (GET/POST/DELETE /diary) - Increase server WriteTimeout to 120s for long AI calls - api_client.go: add patch() and postList() helpers Flutter: - shared/models: menu.dart, shopping_item.dart, diary_entry.dart - features/menu: menu_service.dart, menu_provider.dart (MenuNotifier, ShoppingListNotifier, DiaryNotifier with family) - MenuScreen: 7-day view, week nav, skeleton on generation, generate FAB with confirmation dialog - ShoppingListScreen: items by category, optimistic checkbox toggle - DiaryScreen: daily entries with swipe-to-delete, add-entry sheet - Router: /menu/shopping-list and /menu/diary routes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
46
client/lib/shared/models/shopping_item.dart
Normal file
46
client/lib/shared/models/shopping_item.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
class ShoppingItem {
|
||||
final String name;
|
||||
final String category;
|
||||
final double amount;
|
||||
final String unit;
|
||||
final bool checked;
|
||||
final double inStock;
|
||||
|
||||
const ShoppingItem({
|
||||
required this.name,
|
||||
required this.category,
|
||||
required this.amount,
|
||||
required this.unit,
|
||||
required this.checked,
|
||||
required this.inStock,
|
||||
});
|
||||
|
||||
factory ShoppingItem.fromJson(Map<String, dynamic> json) {
|
||||
return ShoppingItem(
|
||||
name: json['name'] as String? ?? '',
|
||||
category: json['category'] as String? ?? 'other',
|
||||
amount: (json['amount'] as num?)?.toDouble() ?? 0,
|
||||
unit: json['unit'] as String? ?? '',
|
||||
checked: json['checked'] as bool? ?? false,
|
||||
inStock: (json['in_stock'] as num?)?.toDouble() ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'name': name,
|
||||
'category': category,
|
||||
'amount': amount,
|
||||
'unit': unit,
|
||||
'checked': checked,
|
||||
'in_stock': inStock,
|
||||
};
|
||||
|
||||
ShoppingItem copyWith({bool? checked}) => ShoppingItem(
|
||||
name: name,
|
||||
category: category,
|
||||
amount: amount,
|
||||
unit: unit,
|
||||
checked: checked ?? this.checked,
|
||||
inStock: inStock,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user