vtb-appit 0.0.57 → 0.0.58
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/appit.js +33 -1
- package/package.json +1 -1
package/appit.js
CHANGED
|
@@ -37,7 +37,8 @@ class Appit {
|
|
|
37
37
|
labels: {},
|
|
38
38
|
destinations: {},
|
|
39
39
|
flights: {},
|
|
40
|
-
flightImages: {}
|
|
40
|
+
flightImages: {},
|
|
41
|
+
notifications: {}
|
|
41
42
|
};
|
|
42
43
|
|
|
43
44
|
try {
|
|
@@ -76,6 +77,7 @@ class Appit {
|
|
|
76
77
|
await this.contacts();
|
|
77
78
|
await this.homescreen();
|
|
78
79
|
await this.settings();
|
|
80
|
+
await this.notifications();
|
|
79
81
|
|
|
80
82
|
this.history.updatedAt = new Date().getTime();
|
|
81
83
|
|
|
@@ -232,6 +234,26 @@ class Appit {
|
|
|
232
234
|
}
|
|
233
235
|
}
|
|
234
236
|
|
|
237
|
+
async notifications()
|
|
238
|
+
{
|
|
239
|
+
const notifications = this.transformer.notifications();
|
|
240
|
+
if(notifications) {
|
|
241
|
+
for(let i = 0; i < notifications.length; i++) {
|
|
242
|
+
let notification = this.clean(JSON.parse(JSON.stringify(notifications[i])));
|
|
243
|
+
notification.excursion_id = this.history.excursionId;
|
|
244
|
+
|
|
245
|
+
let id = this.findId('notifications', notifications[i].object_id);
|
|
246
|
+
if(!id) {
|
|
247
|
+
let model = await this.createNotification(notification);
|
|
248
|
+
if(!this.history.hasOwnProperty('notifications')) this.history.notifications = {};
|
|
249
|
+
this.history.notifications[notifications[i].object_id] = model.data.id;
|
|
250
|
+
} else {
|
|
251
|
+
await this.updateNotification(id, notification);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
235
257
|
async members()
|
|
236
258
|
{
|
|
237
259
|
const participants = this.transformer.participants();
|
|
@@ -584,6 +606,16 @@ class Appit {
|
|
|
584
606
|
return await this.request('PUT', `organizations/${id}`, data);
|
|
585
607
|
}
|
|
586
608
|
|
|
609
|
+
async createNotification(data)
|
|
610
|
+
{
|
|
611
|
+
return await this.request('POST', `notifications`, data);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
async updateNotification(id, data)
|
|
615
|
+
{
|
|
616
|
+
return await this.request('PUT', `notifications/${id}`, data);
|
|
617
|
+
}
|
|
618
|
+
|
|
587
619
|
async createMember(data)
|
|
588
620
|
{
|
|
589
621
|
return await this.request('POST', `members`, data);
|