99 lines
2.6 KiB
Dart
99 lines
2.6 KiB
Dart
import '../models/bean.dart';
|
|
import '../models/machine.dart';
|
|
import '../models/recipe.dart';
|
|
import '../models/drink.dart';
|
|
import '../models/journal_entry.dart';
|
|
import 'csv_data_service.dart';
|
|
import 'user_data_service.dart';
|
|
|
|
class StorageService {
|
|
final CsvDataService _csvDataService = CsvDataService();
|
|
final UserDataService _userDataService = UserDataService();
|
|
|
|
// Bean operations - User's personal collection
|
|
Future<List<Bean>> getBeans() async {
|
|
return await _userDataService.getBeans();
|
|
}
|
|
|
|
// Browse available beans from catalog
|
|
Future<List<Bean>> getAllAvailableBeans() async {
|
|
return await _csvDataService.getBeans();
|
|
}
|
|
|
|
Future<void> saveBean(Bean bean) async {
|
|
await _userDataService.saveBean(bean);
|
|
}
|
|
|
|
Future<void> deleteBean(String id) async {
|
|
await _userDataService.deleteBean(id);
|
|
}
|
|
|
|
// Machine operations - User's personal collection
|
|
Future<List<Machine>> getMachines() async {
|
|
return await _userDataService.getMachines();
|
|
}
|
|
|
|
// Browse available machines from catalog
|
|
Future<List<Machine>> getAllAvailableMachines() async {
|
|
return await _csvDataService.getMachines();
|
|
}
|
|
|
|
Future<void> saveMachine(Machine machine) async {
|
|
await _userDataService.saveMachine(machine);
|
|
}
|
|
|
|
Future<void> deleteMachine(String id) async {
|
|
await _userDataService.deleteMachine(id);
|
|
}
|
|
|
|
// Recipe operations - User's personal collection
|
|
Future<List<Recipe>> getRecipes() async {
|
|
return await _userDataService.getRecipes();
|
|
}
|
|
|
|
// Browse available recipes from catalog
|
|
Future<List<Recipe>> getAllAvailableRecipes() async {
|
|
return await _csvDataService.getRecipes();
|
|
}
|
|
|
|
Future<void> saveRecipe(Recipe recipe) async {
|
|
await _userDataService.saveRecipe(recipe);
|
|
}
|
|
|
|
Future<void> deleteRecipe(String id) async {
|
|
await _userDataService.deleteRecipe(id);
|
|
}
|
|
|
|
// Drink operations
|
|
Future<List<Drink>> getDrinks() async {
|
|
return await _userDataService.getDrinks();
|
|
}
|
|
|
|
Future<void> saveDrink(Drink drink) async {
|
|
await _userDataService.saveDrink(drink);
|
|
}
|
|
|
|
Future<void> deleteDrink(String id) async {
|
|
await _userDataService.deleteDrink(id);
|
|
}
|
|
|
|
// Journal operations
|
|
Future<List<JournalEntry>> getJournalEntries() async {
|
|
return await _userDataService.getJournalEntries();
|
|
}
|
|
|
|
Future<void> saveJournalEntry(JournalEntry entry) async {
|
|
await _userDataService.saveJournalEntry(entry);
|
|
}
|
|
|
|
Future<void> deleteJournalEntry(String id) async {
|
|
await _userDataService.deleteJournalEntry(id);
|
|
}
|
|
|
|
// Utility operations
|
|
Future<void> clearAllData() async {
|
|
await _csvDataService.clearAllData();
|
|
await _userDataService.clearAllData();
|
|
}
|
|
}
|