forked from eatvio/eatvio_app
73 lines
1.7 KiB
Dart
73 lines
1.7 KiB
Dart
import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart';
|
|
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
|
import 'package:eatvio_app/features/profile/services/profile_service.dart';
|
|
|
|
class ProfileRepository {
|
|
final ProfileService profileService;
|
|
|
|
ProfileRepository({required this.profileService});
|
|
|
|
Future<ProfileModel> getProfileBySlug(String slug) async {
|
|
try {
|
|
return await profileService.getProfileBySlug(slug: slug);
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<ProfileModel> getMyProfile() async {
|
|
try {
|
|
return await profileService.getMyProfile();
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<ProfileDetailsModel> getMyProfileDetails() async {
|
|
try {
|
|
return await profileService.getMyProfileDetails();
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<void> addCircumference({
|
|
required int chestCircumference,
|
|
required int waistCircumference,
|
|
required int hipCircumference,
|
|
}) async {
|
|
try {
|
|
return (await profileService.addCircumference(
|
|
chestCircumference: chestCircumference,
|
|
waistCircumference: waistCircumference,
|
|
hipCircumference: hipCircumference,
|
|
));
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<void> addWeight({
|
|
required double weight,
|
|
}) async {
|
|
try {
|
|
return (await profileService.addWeight(weight: weight));
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
Future<List<FeedBlogPostModel>> getBlogPostsByAuthorSlug({
|
|
required String slug,
|
|
}) async {
|
|
try {
|
|
return (await profileService.getBlogPostByAuthorSlug(
|
|
slug: slug,
|
|
))
|
|
.feedBlogPostList;
|
|
} catch (e) {
|
|
rethrow;
|
|
}
|
|
}
|
|
}
|