forked from eatvio/eatvio_app
diet creation scrren is done
This commit is contained in:
43
lib/features/plans/repositories/plan_repository.dart
Normal file
43
lib/features/plans/repositories/plan_repository.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
||||
import 'package:eatvio_app/features/plans/services/plan_service.dart';
|
||||
|
||||
class PlanRepository {
|
||||
final PlanService planService;
|
||||
|
||||
PlanRepository({required this.planService});
|
||||
|
||||
Future<PlanModel> getPlan(String slug) async {
|
||||
try {
|
||||
return planService.getPlan(slug);
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> likePlan(String slug) async {
|
||||
try {
|
||||
await planService.likePlan(slug: slug);
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> addToFavorite(String slug) async {
|
||||
try {
|
||||
await planService.addToFavorite(slug: slug);
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> removeFromFavorite(String slug) async {
|
||||
try {
|
||||
await planService.removeFromFavorite(slug: slug);
|
||||
} catch (e, stackTrace) {
|
||||
log(e.toString(), stackTrace: stackTrace);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user