mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
use param to send Update Api for unbookable to be bookable
This commit is contained in:
@ -0,0 +1,38 @@
|
|||||||
|
import 'package:syncrow_web/pages/access_management/manage_bookable_spaces/domain/models/bookable_space_model.dart';
|
||||||
|
|
||||||
|
class SendBookableSpacesToApiParams {
|
||||||
|
List<String> spaceUuids;
|
||||||
|
List<String> daysAvailable;
|
||||||
|
String startTime;
|
||||||
|
String endTime;
|
||||||
|
int points;
|
||||||
|
SendBookableSpacesToApiParams({
|
||||||
|
required this.spaceUuids,
|
||||||
|
required this.daysAvailable,
|
||||||
|
required this.startTime,
|
||||||
|
required this.endTime,
|
||||||
|
required this.points,
|
||||||
|
});
|
||||||
|
|
||||||
|
static SendBookableSpacesToApiParams fromBookableSpacesModel(
|
||||||
|
List<BookableSpacemodel> bookableSpaces) {
|
||||||
|
return SendBookableSpacesToApiParams(
|
||||||
|
spaceUuids: bookableSpaces.map((space) => space.spaceUuid).toList(),
|
||||||
|
daysAvailable: bookableSpaces
|
||||||
|
.expand((space) => space.spaceConfig.bookableDays)
|
||||||
|
.toSet()
|
||||||
|
.toList(),
|
||||||
|
startTime: bookableSpaces.first.spaceConfig.bookingStartTime,
|
||||||
|
endTime: bookableSpaces.first.spaceConfig.bookingEndTime,
|
||||||
|
points: bookableSpaces.first.spaceConfig.cost,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
'spaceUuids': spaceUuids,
|
||||||
|
'daysAvailable': daysAvailable,
|
||||||
|
'startTime': startTime,
|
||||||
|
'endTime': endTime,
|
||||||
|
'points': points
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user