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,14 @@
import 'package:rasadyar_inspection/data/model/response/auth/auth_response_model.dart';
import 'package:rasadyar_inspection/data/model/response/captcha/captcha_response_model.dart';
abstract class AuthRemote {
Future<AuthResponseModel?> login({required Map<String, dynamic> authRequest});
Future<CaptchaResponseModel?> captcha();
Future<void> logout();
Future<bool> hasAuthenticated();
Future<AuthResponseModel?> loginWithRefreshToken({required Map<String, dynamic> authRequest});
}

View File

@@ -0,0 +1,72 @@
import 'package:rasadyar_core/core.dart';
import 'package:rasadyar_inspection/data/model/response/auth/auth_response_model.dart';
import 'package:rasadyar_inspection/data/model/response/captcha/captcha_response_model.dart';
import 'package:rasadyar_inspection/data/model/response/user_profile/user_profile_model.dart';
import 'auth_remote.dart';
class AuthRemoteImp extends AuthRemote {
final DioRemote _httpClient;
final String _BASE_URL = 'auth/api/v1/';
AuthRemoteImp(this._httpClient);
@override
Future<AuthResponseModel?> login({required Map<String, dynamic> authRequest}) async {
var res = await _httpClient.post<AuthResponseModel?>(
'${_BASE_URL}login/',
data: authRequest,
fromJson: AuthResponseModel.fromJson,
headers: {'Content-Type': 'application/json'},
);
return res.data;
}
@override
Future<CaptchaResponseModel?> captcha() async {
var res = await _httpClient.post<CaptchaResponseModel?>(
'captcha/',
fromJson: CaptchaResponseModel.fromJson,
);
return res.data;
}
@override
Future<AuthResponseModel?> loginWithRefreshToken({
required Map<String, dynamic> authRequest,
}) async {
var res = await _httpClient.post<AuthResponseModel>(
'$_BASE_URL/login/',
data: authRequest,
headers: {'Content-Type': 'application/json'},
);
return res.data;
}
@override
Future<void> logout() {
// TODO: implement logout
throw UnimplementedError();
}
@override
Future<bool> hasAuthenticated() async {
final response = await _httpClient.get<bool>(
'$_BASE_URL/login/',
headers: {'Content-Type': 'application/json'},
);
return response.data ?? false;
}
/* @override
Future<UserProfileModel?> getUserInfo(String phoneNumber) async {
var res = await _httpClient.post<UserProfileModel?>(
'https://userbackend.rasadyaar.ir/api/send_otp/',
data: {"mobile": phoneNumber, "state": ""},
fromJson: UserProfileModel.fromJson,
headers: {'Content-Type': 'application/json'},
);
return res.data;
}*/
}