vtb-appit 0.0.62 → 0.0.64
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-base-transformer.js +5 -0
- package/appit.js +33 -0
- package/package.json +1 -1
package/appit.js
CHANGED
|
@@ -34,6 +34,7 @@ class Appit {
|
|
|
34
34
|
places: {},
|
|
35
35
|
accommodations: {},
|
|
36
36
|
schemes: {},
|
|
37
|
+
documents: {},
|
|
37
38
|
labels: {},
|
|
38
39
|
destinations: {},
|
|
39
40
|
flights: {},
|
|
@@ -75,6 +76,7 @@ class Appit {
|
|
|
75
76
|
await this.flights();
|
|
76
77
|
await this.flightImages();
|
|
77
78
|
await this.contacts();
|
|
79
|
+
await this.documents();
|
|
78
80
|
await this.homescreen();
|
|
79
81
|
await this.settings();
|
|
80
82
|
await this.notifications();
|
|
@@ -334,6 +336,23 @@ class Appit {
|
|
|
334
336
|
|
|
335
337
|
this.history.travels = travelInfoHistory;
|
|
336
338
|
}
|
|
339
|
+
|
|
340
|
+
async documents()
|
|
341
|
+
{
|
|
342
|
+
const documents = this.transformer.documents();
|
|
343
|
+
if(documents) {
|
|
344
|
+
for(let i = 0; i < documents.length; i++) {
|
|
345
|
+
documents[i].excursion_id = this.history.excursionId;
|
|
346
|
+
let id = this.findId('documents', documents[i].object_id);
|
|
347
|
+
if(!id) {
|
|
348
|
+
let model = await this.createDocument(documents[i]);
|
|
349
|
+
this.history.documents[documents[i].object_id] = model.data.id;
|
|
350
|
+
} else {
|
|
351
|
+
await this.updateDocument(id, documents[i]);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
337
356
|
|
|
338
357
|
async accommodations()
|
|
339
358
|
{
|
|
@@ -856,6 +875,20 @@ class Appit {
|
|
|
856
875
|
}
|
|
857
876
|
}
|
|
858
877
|
|
|
878
|
+
async createDocument(data)
|
|
879
|
+
{
|
|
880
|
+
return await this.request('POST', `documents`, data);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
async updateDocument(id, data)
|
|
884
|
+
{
|
|
885
|
+
try {
|
|
886
|
+
return await this.request('PUT', `documents/${id}`, data);
|
|
887
|
+
} catch {
|
|
888
|
+
console.log(`updateDocument failed: ${id}`);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
859
892
|
async deletePlace(id)
|
|
860
893
|
{
|
|
861
894
|
try {
|