vtb-appit 0.1.27 → 0.1.28
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 +4 -4
- package/package.json +1 -1
package/appit.js
CHANGED
|
@@ -398,7 +398,7 @@ class Appit {
|
|
|
398
398
|
delete place.images;
|
|
399
399
|
|
|
400
400
|
if(place.category_id && typeof place.category_id === 'string') {
|
|
401
|
-
place.category_id = await this.findOrCreateCategory(place.category_id);
|
|
401
|
+
place.category_id = await this.findOrCreateCategory(place.category_id, 'places');
|
|
402
402
|
}
|
|
403
403
|
|
|
404
404
|
const placeData = {...place, ...images, excursion_id: this.history.excursionId};
|
|
@@ -455,7 +455,7 @@ class Appit {
|
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
async findOrCreateCategory(title)
|
|
458
|
+
async findOrCreateCategory(title, type)
|
|
459
459
|
{
|
|
460
460
|
let category_id = null;
|
|
461
461
|
|
|
@@ -474,7 +474,7 @@ class Appit {
|
|
|
474
474
|
})
|
|
475
475
|
|
|
476
476
|
if(!category_id) {
|
|
477
|
-
let result = await this.request('POST', `categories`, {title: title});
|
|
477
|
+
let result = await this.request('POST', `categories`, {title: title, workspace_id: this.transformer.workspace_id, type: type});
|
|
478
478
|
if(result && result.success) {
|
|
479
479
|
category_id = result.data.id;
|
|
480
480
|
let categories = await this.request('GET', `categories?per_page=50000`);
|
|
@@ -849,7 +849,7 @@ class Appit {
|
|
|
849
849
|
let info = this.clean(JSON.parse(JSON.stringify(travelInfo[i])));
|
|
850
850
|
|
|
851
851
|
if(info.category_id && typeof info.category_id === 'string') {
|
|
852
|
-
info.category_id = await this.findOrCreateCategory(info.category_id);
|
|
852
|
+
info.category_id = await this.findOrCreateCategory(info.category_id, 'travel');
|
|
853
853
|
}
|
|
854
854
|
|
|
855
855
|
const travelData = {...info, excursion_id: this.history.excursionId};
|