refactor: profile model

This commit is contained in:
mso7nueh
2024-09-09 18:18:35 +03:00
parent 3ccf5b6d92
commit 8ea819c5bc
77 changed files with 2735 additions and 2950 deletions

View File

@@ -17,6 +17,9 @@ abstract class ProfileService {
@GET('/api/profile/index')
Future<ProfileModel> getMyProfile();
@GET('/api/profile/detailz')
Future<ProfileDetailsModel> getMyProfileDetails();
@POST('/api/profile/addCircumference')
Future<void> addCircumference({
@Part(name: 'chest_circumference') required int chestCircumference,

View File

@@ -87,6 +87,39 @@ class _ProfileService implements ProfileService {
return _value;
}
@override
Future<ProfileDetailsModel> getMyProfileDetails() async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _options = _setStreamType<ProfileDetailsModel>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'/api/profile/detailz',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
)));
final _result = await _dio.fetch<Map<String, dynamic>>(_options);
late ProfileDetailsModel _value;
try {
_value = ProfileDetailsModel.fromJson(_result.data!);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
return _value;
}
@override
Future<void> addCircumference({
required int chestCircumference,