make the domain and data layers

This commit is contained in:
raf-dev1
2025-06-16 13:48:15 +03:00
parent 3893740080
commit 9d7113cee8
5 changed files with 116 additions and 0 deletions

View File

@ -0,0 +1,35 @@
import 'package:dio/dio.dart';
import 'package:syncrow_app/features/booking_system/domain/booking_model.dart';
import 'package:syncrow_app/features/booking_system/domain/booking_service.dart';
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
import 'package:syncrow_app/services/api/http_service.dart';
class BookingRemoteSource implements BookingService {
final HTTPService _httpService;
BookingRemoteSource(this._httpService);
@override
Future<List<BookingModel>> get() async {
try {
return _httpService.get(
path: ApiEndpoints.upcomingBookings,
expectedResponseModel: (json) {
return BookingModel.fromJsonList(json['data']);
},
);
} on DioException catch (e) {
return [];
// final message = e.response?.data as Map<String, dynamic>?;
// final error = message?['error'] as Map<String, dynamic>?;
// final errorMessage = error?['error'] as String? ?? '';
// final formattedErrorMessage =
// [_defaultErrorMessage, errorMessage].join(': ');
// throw APIException(formattedErrorMessage);
// } catch (e) {
// final formattedErrorMessage = [_defaultErrorMessage, '$e'].join(': ');
// throw APIException(formattedErrorMessage);
// }
//
}
}
}