Refactor booking system: replace BookingSystemService with BookableSystemService and update parameter handling for improved clarity

This commit is contained in:
mohammad
2025-07-10 11:25:35 +03:00
parent 2b638940ae
commit bfd6b5c3a0
6 changed files with 27 additions and 33 deletions

View File

@ -1,20 +1,20 @@
import 'package:dio/dio.dart';
import 'package:syncrow_web/pages/access_management/booking_system/domain/load_bookable_spaces_param.dart';
import 'package:syncrow_web/pages/access_management/booking_system/domain/models/paginated_bookable_spaces.dart';
import 'package:syncrow_web/pages/access_management/booking_system/domain/services/booking_system_service.dart';
import 'package:syncrow_web/pages/space_management_v2/modules/communities/domain/params/load_communities_param.dart';
import 'package:syncrow_web/pages/access_management/booking_system/domain/services/bookable_system_service.dart';
import 'package:syncrow_web/services/api/api_exception.dart';
import 'package:syncrow_web/services/api/http_service.dart';
import 'package:syncrow_web/utils/constants/api_const.dart';
class BookableSpacesService implements BookingSystemService {
const BookableSpacesService(this._httpService);
class RemoteBookableSpacesService implements BookableSystemService {
const RemoteBookableSpacesService(this._httpService);
final HTTPService _httpService;
static const _defaultErrorMessage = 'Failed to load bookable spaces';
@override
Future<PaginatedBookableSpaces> getBookableSpaces({
required LoadCommunitiesParam param,
required LoadBookableSpacesParam param,
}) async {
try {
final response = await _httpService.get(
@ -28,8 +28,6 @@ class BookableSpacesService implements BookingSystemService {
param.search.isNotEmpty &&
param.search != 'null')
'search': param.search,
if (param.includeSpaces != null)
'includeSpaces': param.includeSpaces,
},
expectedResponseModel: (json) {
return PaginatedBookableSpaces.fromJson(