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,12 +1,12 @@
import 'dart:async';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/access_management/booking_system/domain/services/booking_system_service.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/services/bookable_system_service.dart';
import 'package:syncrow_web/pages/access_management/booking_system/presentation/bloc/sidebar/sidebar_event.dart';
import 'package:syncrow_web/pages/access_management/booking_system/presentation/bloc/sidebar/sidebar_state.dart';
import 'package:syncrow_web/pages/space_management_v2/modules/communities/domain/params/load_communities_param.dart';
class SidebarBloc extends Bloc<SidebarEvent, SidebarState> {
final BookingSystemService _bookingService;
final BookableSystemService _bookingService;
int _currentPage = 1;
final int _pageSize = 20;
String _currentSearch = '';
@ -35,7 +35,7 @@ class SidebarBloc extends Bloc<SidebarEvent, SidebarState> {
_currentSearch = '';
final paginatedSpaces = await _bookingService.getBookableSpaces(
param: LoadCommunitiesParam(
param: LoadBookableSpacesParam(
page: _currentPage,
size: _pageSize,
search: _currentSearch,
@ -69,11 +69,10 @@ class SidebarBloc extends Bloc<SidebarEvent, SidebarState> {
_currentPage++;
final paginatedSpaces = await _bookingService.getBookableSpaces(
param: LoadCommunitiesParam(
param: LoadBookableSpacesParam(
page: _currentPage,
size: _pageSize,
search: _currentSearch,
// Add any other required params
),
);
@ -105,11 +104,10 @@ class SidebarBloc extends Bloc<SidebarEvent, SidebarState> {
_currentPage = 1;
emit(state.copyWith(isLoading: true, errorMessage: null));
final paginatedSpaces = await _bookingService.getBookableSpaces(
param: LoadCommunitiesParam(
param: LoadBookableSpacesParam(
page: _currentPage,
size: _pageSize,
search: _currentSearch,
// Add other fields if required
),
);
emit(state.copyWith(