getSlotReservations method

  1. @override
Future<List<Reservation>> getSlotReservations({
  1. required String token,
  2. required int slotId,
})
override

Fetches all reservations for the slot with slotId.

Note: User associated with token must be a supervisor of the slot.

Implementation

@override
Future<List<Reservation>> getSlotReservations({required String token, required int slotId}) async {
  log('Fetching reservations for slot $slotId');

  final response = await api.callFunction(
    function: 'local_lbplanner_slots_get_slot_reservations',
    body: {
      'slotid': slotId,
    },
    token: token,
  );

  response.assertJson();

  return response.asList.map(Reservation.fromJson).toList();
}