feat : profile and map
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import 'package:rasadyar_inspection/data/model/response/poultry_location/poultry_location_model.dart';
|
||||
|
||||
abstract class InspectionRemoteDataSource {
|
||||
/// Fetches the inspection data for a given [inspectionId].
|
||||
///
|
||||
/// Returns a `Future` that resolves to a `Map<String, dynamic>` containing
|
||||
/// the inspection data.
|
||||
Future<Map<String, dynamic>> fetchInspectionData(String inspectionId);
|
||||
|
||||
/// Fetches the list of inspections for a given [userId].
|
||||
///
|
||||
/// Returns a `Future` that resolves to a `List<Map<String, dynamic>>`
|
||||
/// containing the list of inspections.
|
||||
Future<List<Map<String, dynamic>>> fetchInspections(String userId);
|
||||
|
||||
|
||||
Future<List<PoultryLocationModel>?> getNearbyLocation({
|
||||
double? centerLat,
|
||||
double? centerLng,
|
||||
double? radius,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_inspection/data/data_source/remote/inspection/inspection_remote.dart';
|
||||
import 'package:rasadyar_inspection/data/model/response/poultry_location/poultry_location_model.dart';
|
||||
|
||||
class InspectionRemoteDataSourceImp implements InspectionRemoteDataSource {
|
||||
final DioRemote _httpClient;
|
||||
final String _BASE_URL = 'auth/api/v1/';
|
||||
|
||||
InspectionRemoteDataSourceImp(this._httpClient);
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> fetchInspectionData(String inspectionId) {
|
||||
// TODO: implement fetchInspectionData
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<Map<String, dynamic>>> fetchInspections(String userId) {
|
||||
// TODO: implement fetchInspections
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<PoultryLocationModel>?> getNearbyLocation({
|
||||
double? centerLat,
|
||||
double? centerLng,
|
||||
double? radius,
|
||||
}) async {
|
||||
DioRemote dioRemote = DioRemote(baseUrl: 'https://habackend.rasadyaar.ir/');
|
||||
await dioRemote.init();
|
||||
|
||||
var res = await dioRemote.get<List<PoultryLocationModel>>(
|
||||
'poultry-loc/',
|
||||
queryParameters: {'center_lat': centerLat, 'center_lng': centerLng, 'radius': radius},
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
fromJsonList: (json) =>
|
||||
json.map((item) => PoultryLocationModel.fromJson(item as Map<String, dynamic>)).toList(),
|
||||
);
|
||||
|
||||
return res.data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user