feat : profile and map

This commit is contained in:
2025-07-28 15:57:30 +03:30
parent 6057976b46
commit d9724f681c
67 changed files with 2835 additions and 444 deletions

View File

@@ -0,0 +1,8 @@
import 'package:rasadyar_inspection/data/model/response/user_profile/user_profile_model.dart';
abstract class UserRemoteDataSource {
Future<UserProfileModel?> getProfile({required String token});
}

View File

@@ -0,0 +1,25 @@
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/data/data_source/remote/user/user_data_source.dart';
import 'package:rasadyar_inspection/data/model/response/user_profile/user_profile_model.dart';
class UserRemoteDataSourceImp extends UserRemoteDataSource {
final DioRemote _httpClient;
final String _BASE_URL = 'auth/api/v1/';
UserRemoteDataSourceImp(this._httpClient);
@override
Future<UserProfileModel?> getProfile({required String token}) async {
var res = await _httpClient.get<UserProfileModel>(
'${_BASE_URL}user/profile/',
fromJson: UserProfileModel.fromJson,
headers: {'Content-Type': 'application/json', 'Authorization': 'Bearer $token'},
);
if (res.data == null) {
throw Exception('Failed to load user profile');
}
return res.data!;
}
}