fix: user charts in consultations

This commit is contained in:
mso7nueh
2025-08-15 14:13:30 +03:00
parent 4f249499a9
commit ccf586234b
2 changed files with 15 additions and 42 deletions

View File

@@ -12,9 +12,7 @@ import 'package:eatvio_app/features/profile/services/profile_service.dart';
class ProfileRepository {
final ProfileService profileService;
ProfileRepository({
required this.profileService,
});
ProfileRepository({required this.profileService});
Future<ProfileModel> getProfileBySlug(String slug) async {
try {
@@ -48,11 +46,7 @@ class ProfileRepository {
}
}
Future<void> addCircumference({
required int chestCircumference,
required int waistCircumference,
required int hipCircumference,
}) async {
Future<void> addCircumference({required int chestCircumference, required int waistCircumference, required int hipCircumference}) async {
try {
return (await profileService.addCircumference(
chestCircumference: chestCircumference,
@@ -64,9 +58,7 @@ class ProfileRepository {
}
}
Future<void> addWeight({
required double weight,
}) async {
Future<void> addWeight({required double weight}) async {
try {
return (await profileService.addWeight(weight: weight));
} catch (e) {
@@ -74,52 +66,32 @@ class ProfileRepository {
}
}
Future<List<FeedBlogPostModel>> getBlogPostsByAuthorSlug({
required String slug,
}) async {
Future<List<FeedBlogPostModel>> getBlogPostsByAuthorSlug({required String slug}) async {
try {
return (await profileService.getBlogPostByAuthorSlug(
slug: slug,
));
return (await profileService.getBlogPostByAuthorSlug(slug: slug));
} catch (e) {
rethrow;
}
}
Future<List<WeightModel>> getWeight({
required String period,
String? slug,
}) async {
Future<List<WeightModel>> getWeight({required String period, String? slug}) async {
try {
if (slug != null) {
return (await profileService.getWeightBySlug(
period: period,
slug: slug,
));
return (await profileService.getWeightBySlug(period: period, slug: slug));
} else {
return (await profileService.getWeight(
period: period,
));
return (await profileService.getWeight(period: period));
}
} catch (e) {
rethrow;
}
}
Future<List<CircumferenceModel>> getCircumferences({
required String period,
String? slug,
}) async {
Future<List<CircumferenceModel>> getCircumferences({required String period, String? slug}) async {
try {
if (slug != null) {
return (await profileService.getCircumferencesBySlug(
period: period,
slug: slug,
));
return (await profileService.getCircumferencesBySlug(period: period, slug: slug));
} else {
return (await profileService.getCircumferences(
period: period,
));
return (await profileService.getCircumferences(period: period));
}
} catch (e) {
rethrow;
@@ -184,7 +156,8 @@ class ProfileRepository {
Future<String> getPassKey(String phone) async {
return (jsonDecode(
(await profileService.getPassKey(json: '{"route_name": "user_detailz.change-phone-verify", "route_params": {"phone": "$phone"}}'))))['key_is']!;
(await profileService.getPassKey(json: '{"route_name": "user_detailz.change-phone-verify", "route_params": {"phone": "$phone"}}')),
))['key_is']!;
}
Future<String> getMyPhone() async {
@@ -206,7 +179,7 @@ class ProfileRepository {
Future<void> deleteAccount() async {
try {
await profileService.deleteAccount();
await profileService.deleteAccount();
} catch (e) {
rethrow;
}

View File

@@ -64,7 +64,7 @@ abstract class ProfileService {
@Path() required String period,
});
@GET('/api/profile/measure/circumferences/{period}/{user}')
@GET('/api/profile/measure/circumferences/{period}/{slug}')
Future<List<CircumferenceModel>> getCircumferencesBySlug({
@Path() required String period,
@Path() required String slug,