Skip to content

Commit d59f000

Browse files
authored
[ACTION] booking experts - filters (#19315)
1 parent 1ad1bce commit d59f000

File tree

19 files changed

+172
-34
lines changed

19 files changed

+172
-34
lines changed

components/booking_experts/actions/add-guest-to-reservation/add-guest-to-reservation.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-add-guest-to-reservation",
55
name: "Add Guest to Reservation",
66
description: "Add a guest to a reservation. [See the documentation](https://developers.bookingexperts.com/reference/administration-reservation-guests-create)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/booking_experts/actions/create-agenda-period/create-agenda-period.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-create-agenda-period",
55
name: "Create Agenda Period",
66
description: "Creates a new agenda period. [See the documentation](https://developers.bookingexperts.com/reference/administration-maintenance-agenda-periods-create)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/booking_experts/actions/delete-guest/delete-guest.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-delete-guest",
55
name: "Delete Guest",
66
description: "Delete a guest for a reservation. [See the documentation](https://developers.bookingexperts.com/reference/administration-reservation-guests-delete)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: true,
1010
openWorldHint: true,

components/booking_experts/actions/get-booking/get-booking.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-get-booking",
55
name: "Get Booking",
66
description: "Returns a booking. [See the documentation](https://developers.bookingexperts.com/reference/administration-bookings-show)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/booking_experts/actions/get-complex-prices/get-complex-prices.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-get-complex-prices",
55
name: "Get Complex Prices",
66
description: "Returns all complex prices of a master price list. [See the documentation](https://developers.bookingexperts.com/reference/administration-masterpricelist-complexprices-index)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/booking_experts/actions/get-reservation/get-reservation.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
name: "Get Reservation",
55
description: "Fetches a reservation by ID from Booking Experts. [See the documentation](https://developers.bookingexperts.com/reference/reservations-show)",
66
key: "booking_experts-get-reservation",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
annotations: {
1010
destructiveHint: false,

components/booking_experts/actions/list-availabilities/list-availabilities.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-list-availabilities",
55
name: "List Availabilities",
66
description: "List availabilities of a channel you have access to. [See the documentation](https://developers.bookingexperts.com/reference/availabilities-index)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/booking_experts/actions/list-bookings/list-bookings.mjs

Lines changed: 108 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-list-bookings",
55
name: "List Bookings",
66
description: "Returns a list of bookings for an administration. [See the documentation](https://developers.bookingexperts.com/reference/administration-bookings-index)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,
@@ -39,15 +39,28 @@ export default {
3939
],
4040
description: "Filter by channel",
4141
},
42-
reservationId: {
42+
reservationIds: {
43+
type: "string[]",
44+
label: "Reservation IDs",
45+
description: "Filter by reservation IDs",
4346
propDefinition: [
4447
bookingExperts,
4548
"reservationId",
4649
(c) => ({
4750
administrationId: c.administrationId,
4851
}),
4952
],
50-
description: "Filter by reservation",
53+
},
54+
createdAt: {
55+
type: "string",
56+
label: "Created At",
57+
description: "Filter by created at (ISO 8601 format, e.g., `2024-01-01T00:00:00Z`)",
58+
optional: true,
59+
},
60+
updatedAt: {
61+
type: "string",
62+
label: "Updated At",
63+
description: "Filter by updated at (ISO 8601 format, e.g., `2024-01-01T00:00:00Z`)",
5164
optional: true,
5265
},
5366
page: {
@@ -62,19 +75,103 @@ export default {
6275
"perPage",
6376
],
6477
},
78+
filterId: {
79+
optional: true,
80+
propDefinition: [
81+
bookingExperts,
82+
"bookingId",
83+
({ administrationId }) => ({
84+
administrationId,
85+
}),
86+
],
87+
},
88+
customerIds: {
89+
type: "string[]",
90+
label: "Customer IDs",
91+
description: "Filter by customer IDs",
92+
propDefinition: [
93+
bookingExperts,
94+
"customerId",
95+
({ administrationId }) => ({
96+
administrationId,
97+
}),
98+
],
99+
},
100+
bookingNr: {
101+
label: "Booking Number",
102+
description: "Filter by booking number",
103+
optional: true,
104+
propDefinition: [
105+
bookingExperts,
106+
"bookingId",
107+
({ administrationId }) => ({
108+
administrationId,
109+
mapper: ({ attributes: { booking_nr: value } }) => value,
110+
}),
111+
],
112+
},
113+
confirmedAt: {
114+
type: "string",
115+
label: "Confirmed At",
116+
description: "Filter by confirmed at (ISO 8601 format, e.g., `2024-01-01T00:00:00Z`)",
117+
optional: true,
118+
},
119+
fieldsBooking: {
120+
type: "string[]",
121+
label: "Fields Booking",
122+
description: "Fields to return for the booking",
123+
optional: true,
124+
},
125+
referenceNr: {
126+
type: "string",
127+
label: "Reference Number",
128+
description: "Filter by reference number",
129+
optional: true,
130+
},
131+
},
132+
methods: {
133+
commaSeparatedList(value) {
134+
return Array.isArray(value) && value?.length > 0
135+
? value.join(",")
136+
: value;
137+
},
65138
},
66139
async run({ $ }) {
140+
const {
141+
commaSeparatedList,
142+
administrationId,
143+
ownerId,
144+
administrationChannelId,
145+
reservationIds,
146+
createdAt,
147+
updatedAt,
148+
page,
149+
perPage,
150+
filterId,
151+
customerIds,
152+
bookingNr,
153+
confirmedAt,
154+
fieldsBooking,
155+
referenceNr,
156+
} = this;
157+
67158
const { data } = await this.bookingExperts.listBookings({
68159
$,
69-
administrationId: this.administrationId,
160+
administrationId,
70161
params: {
71-
"filter[owner]": this.ownerId,
72-
"filter[channel]": this.listAdministrationChannels,
73-
"filter[reservations]": this.reservationId,
74-
"filter[created_at]": this.createdAt,
75-
"filter[updated_at]": this.updatedAt,
76-
"page[number]": this.page,
77-
"page[size]": this.perPage,
162+
"filter[owner]": ownerId,
163+
"filter[channel]": administrationChannelId,
164+
"filter[created_at]": createdAt,
165+
"filter[updated_at]": updatedAt,
166+
"page[number]": page,
167+
"page[size]": perPage,
168+
"filter[ID]": filterId,
169+
"filter[reservations]": commaSeparatedList(reservationIds),
170+
"filter[customer]": commaSeparatedList(customerIds),
171+
"filter[booking_nr]": bookingNr,
172+
"filter[confirmed_at]": confirmedAt,
173+
"fields[booking]": commaSeparatedList(fieldsBooking),
174+
"filter[reference_nr]": referenceNr,
78175
},
79176
});
80177
$.export("$summary", `Found ${data.length} bookings`);

components/booking_experts/actions/list-inventory-objects/list-inventory-objects.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "booking_experts-list-inventory-objects",
55
name: "List Inventory Objects",
66
description: "Returns inventory objects of the administration. [See the documentation](https://developers.bookingexperts.com/reference/administration-inventoryobjects-index)",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/booking_experts/actions/list-rentabletype-availabilities/list-rentabletype-availabilities.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "booking_experts-list-rentabletype-availabilities",
66
name: "List RentableType Availabilities",
77
description: "List availabilities of a RentableType you have access to. [See the documentation](https://developers.bookingexperts.com/reference/channel-rentabletype-availabilities-index)",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,

0 commit comments

Comments
 (0)