seatsio 67.3.0 → 67.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/Events/Event.js
CHANGED
package/src/Events/Events.js
CHANGED
|
@@ -20,9 +20,10 @@ class Events {
|
|
|
20
20
|
* @param {?string} eventKey
|
|
21
21
|
* @param {?TableBookingConfig} tableBookingConfig
|
|
22
22
|
* @param {?string} socialDistancingRulesetKey
|
|
23
|
+
* @param {?object} objectCategories
|
|
23
24
|
* @returns {Promise<Event>}
|
|
24
25
|
*/
|
|
25
|
-
create (chartKey, eventKey = null, tableBookingConfig = null, socialDistancingRulesetKey = null) {
|
|
26
|
+
create (chartKey, eventKey = null, tableBookingConfig = null, socialDistancingRulesetKey = null, objectCategories = null) {
|
|
26
27
|
const requestParameters = {}
|
|
27
28
|
|
|
28
29
|
requestParameters.chartKey = chartKey
|
|
@@ -39,6 +40,10 @@ class Events {
|
|
|
39
40
|
requestParameters.socialDistancingRulesetKey = socialDistancingRulesetKey
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
if (objectCategories !== null) {
|
|
44
|
+
requestParameters.objectCategories = objectCategories
|
|
45
|
+
}
|
|
46
|
+
|
|
42
47
|
return this.client.post('/events', requestParameters)
|
|
43
48
|
.then((res) => new EventDeserializer().fromJson(res.data))
|
|
44
49
|
}
|
|
@@ -66,9 +71,10 @@ class Events {
|
|
|
66
71
|
* @param {?string} newEventKey
|
|
67
72
|
* @param {?TableBookingConfig} tableBookingConfig
|
|
68
73
|
* @param {?string} socialDistancingRulesetKey
|
|
74
|
+
* @param {?object} objectCategories
|
|
69
75
|
* @returns {Promise}
|
|
70
76
|
*/
|
|
71
|
-
update (eventKey, chartKey = null, newEventKey = null, tableBookingConfig = null, socialDistancingRulesetKey = null) {
|
|
77
|
+
update (eventKey, chartKey = null, newEventKey = null, tableBookingConfig = null, socialDistancingRulesetKey = null, objectCategories = null) {
|
|
72
78
|
const requestParameters = {}
|
|
73
79
|
|
|
74
80
|
if (chartKey !== null) {
|
|
@@ -87,6 +93,10 @@ class Events {
|
|
|
87
93
|
requestParameters.socialDistancingRulesetKey = socialDistancingRulesetKey
|
|
88
94
|
}
|
|
89
95
|
|
|
96
|
+
if (objectCategories !== null) {
|
|
97
|
+
requestParameters.objectCategories = objectCategories
|
|
98
|
+
}
|
|
99
|
+
|
|
90
100
|
return this.client.post(`events/${encodeURIComponent(eventKey)}`, requestParameters)
|
|
91
101
|
}
|
|
92
102
|
|
|
@@ -61,3 +61,13 @@ test('it supports a social distancing ruleset key', async () => {
|
|
|
61
61
|
|
|
62
62
|
expect(event.socialDistancingRulesetKey).toBe('ruleset1')
|
|
63
63
|
})
|
|
64
|
+
|
|
65
|
+
test('it supports object categories', async () => {
|
|
66
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
67
|
+
const chartKey = testUtils.getChartKey()
|
|
68
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
69
|
+
|
|
70
|
+
const event = await client.events.create(chartKey, null, null, null, { 'A-1': 10 })
|
|
71
|
+
|
|
72
|
+
expect(event.objectCategories).toEqual({ 'A-1': 10 })
|
|
73
|
+
})
|
|
@@ -74,3 +74,29 @@ test('it supports removing the social distancing ruleset key', async () => {
|
|
|
74
74
|
const retrievedEvent = await client.events.retrieve(event.key)
|
|
75
75
|
expect(retrievedEvent.socialDistancingRulesetKey).toBe(undefined)
|
|
76
76
|
})
|
|
77
|
+
|
|
78
|
+
test('it supports object categories', async () => {
|
|
79
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
80
|
+
const chartKey = testUtils.getChartKey()
|
|
81
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
82
|
+
|
|
83
|
+
const event = await client.events.create(chartKey, null, null, null, { 'A-1': 9 })
|
|
84
|
+
|
|
85
|
+
await client.events.update(event.key, null, null, null, null, { 'A-1': 10 })
|
|
86
|
+
|
|
87
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
88
|
+
expect(retrievedEvent.objectCategories).toEqual({ 'A-1': 10 })
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
test('it supports removing the object categories', async () => {
|
|
92
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
93
|
+
const chartKey = testUtils.getChartKey()
|
|
94
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
95
|
+
|
|
96
|
+
const event = await client.events.create(chartKey, null, null, null, { 'A-2': 9 })
|
|
97
|
+
|
|
98
|
+
await client.events.update(event.key, null, null, null, null, { })
|
|
99
|
+
|
|
100
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
101
|
+
expect(retrievedEvent.objectCategories).toBeFalsy()
|
|
102
|
+
})
|