Skip to content

Commit c12fc1a

Browse files
committed
feat: Room availability items use existingId
1 parent 29b5808 commit c12fc1a

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/api/room.api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ export interface RoomAvailabilityListDTO {
4040
}
4141

4242
export interface CreateRoomAvailabilityItemDTO {
43+
/**
44+
* ID of the existing room availability item.
45+
* If 0, then this is a brand new one
46+
*/
47+
existingId: number,
4348
/**
4449
* Date object
4550
*/

src/views/room/RoomDetails.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,23 @@ const startEditingRoomAvailability = () => {
105105
}
106106
107107
const submitEditingRoomAvailability = () => {
108+
var items: CreateRoomAvailabilityItemDTO[] = [];
109+
for (let index = 0; index < roomAvailability.value.items.length; index++) {
110+
const element = roomAvailability.value.items[index];
111+
112+
const item: CreateRoomAvailabilityItemDTO = {
113+
existingId: element.id,
114+
dateFrom: element.dateFrom,
115+
dateTo: element.dateTo,
116+
available: element.available
117+
}
118+
119+
items.push(item);
120+
}
121+
108122
const createRoomAvailability: CreateRoomAvailabilityListDTO = {
109123
roomId: roomAvailability.value.roomId,
110-
items: roomAvailability.value.items
124+
items
111125
};
112126
113127
errorAvailability.value = "";

0 commit comments

Comments
 (0)