@golemio/playgrounds 1.11.13 → 1.11.14
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/dist/integration-engine/PlaygroundsTransformation.js +2 -11
- package/dist/integration-engine/PlaygroundsTransformation.js.map +1 -1
- package/dist/integration-engine/helpers/AddressHelper.js +23 -37
- package/dist/integration-engine/helpers/AddressHelper.js.map +1 -1
- package/dist/integration-engine/models/PlaygroundsModel.js +7 -18
- package/dist/integration-engine/models/PlaygroundsModel.js.map +1 -1
- package/dist/integration-engine/workers/playgrounds/tasks/RefreshDataInDBTask.js +53 -71
- package/dist/integration-engine/workers/playgrounds/tasks/RefreshDataInDBTask.js.map +1 -1
- package/dist/integration-engine/workers/playgrounds/tasks/UpdateAddressAndDistrictTask.js +7 -18
- package/dist/integration-engine/workers/playgrounds/tasks/UpdateAddressAndDistrictTask.js.map +1 -1
- package/dist/output-gateway/models/FilterHelper.js +2 -2
- package/dist/output-gateway/models/FilterHelper.js.map +1 -1
- package/dist/output-gateway/models/PlaygroundsModel.js +11 -20
- package/dist/output-gateway/models/PlaygroundsModel.js.map +1 -1
- package/package.json +15 -15
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.PlaygroundsTransformation = void 0;
|
|
13
4
|
const PlaygroundsInfo_1 = require("../schema-definitions/PlaygroundsInfo");
|
|
@@ -15,7 +6,7 @@ const transformations_1 = require("@golemio/core/dist/integration-engine/transfo
|
|
|
15
6
|
class PlaygroundsTransformation extends transformations_1.BaseTransformation {
|
|
16
7
|
constructor() {
|
|
17
8
|
super();
|
|
18
|
-
this.transformElement = (element) =>
|
|
9
|
+
this.transformElement = async (element) => {
|
|
19
10
|
const playground = {
|
|
20
11
|
location: element.geometry,
|
|
21
12
|
image_url: element.image && element.image.originalUrl ? element.image.originalUrl : null,
|
|
@@ -32,7 +23,7 @@ class PlaygroundsTransformation extends transformations_1.BaseTransformation {
|
|
|
32
23
|
};
|
|
33
24
|
});
|
|
34
25
|
return playground;
|
|
35
|
-
}
|
|
26
|
+
};
|
|
36
27
|
this.name = PlaygroundsInfo_1.PlaygroundsInfo.moduleName;
|
|
37
28
|
}
|
|
38
29
|
removeIdentifier(title) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaygroundsTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/PlaygroundsTransformation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlaygroundsTransformation.js","sourceRoot":"","sources":["../../src/integration-engine/PlaygroundsTransformation.ts"],"names":[],"mappings":";;;AACA,2EAAuD;AAGvD,2FAA4G;AAE5G,MAAa,yBAA0B,SAAQ,oCAAkB;IAG7D;QACI,KAAK,EAAE,CAAC;QAIF,qBAAgB,GAAG,KAAK,EAAE,OAA0B,EAAwB,EAAE;YACpF,MAAM,UAAU,GAAG;gBACf,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,SAAS,EAAE,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;gBACxF,OAAO,EAAE,OAAO,CAAC,OAAO;gBAC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OAAO,CAAC,EAAE,IAAI,QAAQ,CAAC,EAAE,CAAC,EAAE;oBACtD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACzB;aACJ;SACJ;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,AAfgC,CAe/B"}
|
|
@@ -1,48 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.AddressHelper = void 0;
|
|
13
4
|
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
14
5
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
15
6
|
class AddressHelper {
|
|
16
|
-
static updateAddress(dbData) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
dbData.street_address = (_e = address.street_address) !== null && _e !== void 0 ? _e : "";
|
|
27
|
-
dbData.postal_code = (_f = address.postal_code) !== null && _f !== void 0 ? _f : "";
|
|
28
|
-
}
|
|
29
|
-
yield dbData.save();
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
throw new golemio_errors_1.RecoverableError("Error while updating address.", this.constructor.name, err);
|
|
7
|
+
static async updateAddress(dbData) {
|
|
8
|
+
try {
|
|
9
|
+
const address = await integration_engine_1.GeocodeApi.getAddressByLatLng(dbData.location.coordinates[1], dbData.location.coordinates[0]);
|
|
10
|
+
if (address) {
|
|
11
|
+
dbData.address_country = address.address_country ?? "";
|
|
12
|
+
dbData.address_formatted = address.address_formatted ?? "";
|
|
13
|
+
dbData.address_locality = address.address_locality ?? "";
|
|
14
|
+
dbData.address_region = address.address_region ?? "";
|
|
15
|
+
dbData.street_address = address.street_address ?? "";
|
|
16
|
+
dbData.postal_code = address.postal_code ?? "";
|
|
33
17
|
}
|
|
34
|
-
|
|
18
|
+
await dbData.save();
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
throw new golemio_errors_1.RecoverableError("Error while updating address.", this.constructor.name, err);
|
|
22
|
+
}
|
|
35
23
|
}
|
|
36
|
-
static updateDistrict(dbData, cityDistrictsModel) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
});
|
|
24
|
+
static async updateDistrict(dbData, cityDistrictsModel) {
|
|
25
|
+
try {
|
|
26
|
+
dbData.district = await cityDistrictsModel.getDistrict(dbData.location.coordinates[0], dbData.location.coordinates[1]);
|
|
27
|
+
await dbData.save();
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
throw new golemio_errors_1.RecoverableError("Error while updating district.", this.constructor.name, err);
|
|
31
|
+
}
|
|
46
32
|
}
|
|
47
33
|
}
|
|
48
34
|
exports.AddressHelper = AddressHelper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressHelper.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/AddressHelper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressHelper.js","sourceRoot":"","sources":["../../../src/integration-engine/helpers/AddressHelper.ts"],"names":[],"mappings":";;;AAGA,8EAAmE;AACnE,6EAA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AI,iCAAgB,CAAC,gCAAgC,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;SAC5F;IACL,CAAC;;AA5CL,sCA6CC;AA5CiB,+BAAiB,GAAG,CAAC,MAAa,EAAE,MAAa,EAAW,EAAE;IACxE,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;AAC9G,CAAC,CAAC;AAEY,uBAAS,GAAG,CAAC,UAAsB,EAAW,EAAE;IAC1D,OAAO,CAAC,UAAU,CAAC,iBAAiB,IAAI,CAAC,UAAU,CAAC,eAAe,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;AAChG,CAAC,CAAC;AAEY,yBAAW,GAAG,CAAC,aAA0B,EAAE,mBAA+B,EAAW,EAAE;IACjG,OAAO,CACH,aAAa,CAAC,iBAAiB,CAAC,aAAa,CAAC,QAAQ,EAAE,mBAAmB,CAAC,QAAQ,CAAC;QACrF,aAAa,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAC/C,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.PlaygroundsModel = void 0;
|
|
13
4
|
const OutputSchemaProvider_1 = require("../../schema-definitions/json-schema/OutputSchemaProvider");
|
|
@@ -26,20 +17,18 @@ class PlaygroundsModel extends models_1.PostgresModel {
|
|
|
26
17
|
pgSchema: PlaygroundsInfo_1.PlaygroundsInfo.schemaName,
|
|
27
18
|
savingType: "insertOrUpdate",
|
|
28
19
|
}, new golemio_validator_1.JSONSchemaValidator("PlaygroundsModelValidator", OutputSchemaProvider_1.OutputSchemaProvider.playgroundOutput, true));
|
|
29
|
-
this.getPlaygroundId = (external_id, t) =>
|
|
30
|
-
const playground =
|
|
20
|
+
this.getPlaygroundId = async (external_id, t) => {
|
|
21
|
+
const playground = await this.getPlayground(external_id, t);
|
|
31
22
|
return playground ? playground.internal_id : undefined;
|
|
32
|
-
}
|
|
23
|
+
};
|
|
33
24
|
this.propertiesModel = new PropertyModel_1.PropertyModel();
|
|
34
25
|
this.playgroundPropertyModel = new PlaygroundPropertyModel_1.PlaygroundPropertyModel();
|
|
35
26
|
PlaygroundsInfo_1.PlaygroundsInfo.associateTables(this.sequelizeModel, this.propertiesModel["sequelizeModel"], this.playgroundPropertyModel["sequelizeModel"]);
|
|
36
27
|
}
|
|
37
|
-
getPlayground(external_id, t) {
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
transaction: t,
|
|
42
|
-
});
|
|
28
|
+
async getPlayground(external_id, t) {
|
|
29
|
+
return await this.sequelizeModel.findOne({
|
|
30
|
+
where: { external_id: external_id },
|
|
31
|
+
transaction: t,
|
|
43
32
|
});
|
|
44
33
|
}
|
|
45
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaygroundsModel.js","sourceRoot":"","sources":["../../../src/integration-engine/models/PlaygroundsModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlaygroundsModel.js","sourceRoot":"","s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ACP,CAAC;CACJ;AArCD,4CAqCC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.RefreshDataInDBTask = void 0;
|
|
13
4
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
@@ -22,13 +13,13 @@ class RefreshDataInDBTask extends workers_1.AbstractEmptyTask {
|
|
|
22
13
|
super(queuePrefix);
|
|
23
14
|
this.queueName = "refreshDataInDB";
|
|
24
15
|
this.queueTtl = 23 * 60 * 60 * 1000; // 23 hours
|
|
25
|
-
this.getTransformedDataWithId = () =>
|
|
26
|
-
const data =
|
|
27
|
-
const transformedData =
|
|
16
|
+
this.getTransformedDataWithId = async () => {
|
|
17
|
+
const data = await this.dataSource.getAll();
|
|
18
|
+
const transformedData = await this.transformation.transform(data);
|
|
28
19
|
const dataIdsWithNewLocation = [];
|
|
29
20
|
for (let index = 0; index < transformedData.length; index++) {
|
|
30
21
|
const playground = transformedData[index];
|
|
31
|
-
const dbPlayground =
|
|
22
|
+
const dbPlayground = await this.model.getPlayground(playground.external_id);
|
|
32
23
|
// get internal ids for already existing data
|
|
33
24
|
if (dbPlayground) {
|
|
34
25
|
playground.internal_id = dbPlayground.internal_id;
|
|
@@ -42,13 +33,12 @@ class RefreshDataInDBTask extends workers_1.AbstractEmptyTask {
|
|
|
42
33
|
}
|
|
43
34
|
}
|
|
44
35
|
return { transformedData: transformedData, playgroundIdsForLocationSync: dataIdsWithNewLocation };
|
|
45
|
-
}
|
|
46
|
-
this.getPlaygroundPropertyRelationData = (playgroundsTransformedData, t) =>
|
|
47
|
-
var _a;
|
|
36
|
+
};
|
|
37
|
+
this.getPlaygroundPropertyRelationData = async (playgroundsTransformedData, t) => {
|
|
48
38
|
const result = [];
|
|
49
39
|
for (let index = 0; index < playgroundsTransformedData.length; index++) {
|
|
50
40
|
const element = playgroundsTransformedData[index];
|
|
51
|
-
const internalId =
|
|
41
|
+
const internalId = element.internal_id ?? (await this.model.getPlaygroundId(element.external_id, t));
|
|
52
42
|
if (element.properties) {
|
|
53
43
|
for (let index = 0; index < element.properties.length; index++) {
|
|
54
44
|
const property = element.properties[index];
|
|
@@ -62,69 +52,61 @@ class RefreshDataInDBTask extends workers_1.AbstractEmptyTask {
|
|
|
62
52
|
}
|
|
63
53
|
}
|
|
64
54
|
return result;
|
|
65
|
-
}
|
|
55
|
+
};
|
|
66
56
|
this.dataSource = PlaygroundsDataSource_1.PlaygroundsDataSource.get();
|
|
67
57
|
this.transformation = new PlaygroundsTransformation_1.PlaygroundsTransformation();
|
|
68
58
|
this.model = new PlaygroundsModel_1.PlaygroundsModel();
|
|
69
59
|
}
|
|
70
|
-
execute() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
});
|
|
60
|
+
async execute() {
|
|
61
|
+
try {
|
|
62
|
+
const playgroundIdsForLocationSync = await this.savePlaygroundsData();
|
|
63
|
+
// send messages for updating district and address and average occupancy
|
|
64
|
+
const promises = playgroundIdsForLocationSync.map((external_id) => {
|
|
65
|
+
integration_engine_1.QueueManager.sendMessageToExchange(this.queuePrefix, "updateAddressAndDistrict", { external_id });
|
|
66
|
+
});
|
|
67
|
+
await Promise.all(promises);
|
|
68
|
+
}
|
|
69
|
+
catch (exception) {
|
|
70
|
+
throw exception instanceof golemio_errors_1.AbstractGolemioError
|
|
71
|
+
? exception
|
|
72
|
+
: new golemio_errors_1.GeneralError("Error while refreshing playgrounds data", this.constructor.name, exception);
|
|
73
|
+
}
|
|
86
74
|
}
|
|
87
|
-
savePlaygroundsData() {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
});
|
|
75
|
+
async savePlaygroundsData() {
|
|
76
|
+
const connection = integration_engine_1.PostgresConnector.getConnection();
|
|
77
|
+
const t = await connection.transaction();
|
|
78
|
+
try {
|
|
79
|
+
const result = await this.getTransformedDataWithId();
|
|
80
|
+
await this.validateAndSavePlaygrounds(result.transformedData, t);
|
|
81
|
+
await this.validateAndSaveProperties(result.transformedData, t);
|
|
82
|
+
await t.commit();
|
|
83
|
+
return result.playgroundIdsForLocationSync;
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
await t.rollback();
|
|
87
|
+
throw err;
|
|
88
|
+
}
|
|
103
89
|
}
|
|
104
|
-
validateAndSavePlaygrounds(transformedData, t) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
yield this.model["sequelizeModel"].upsert(Object.assign({}, playground), { transaction: t });
|
|
109
|
-
}));
|
|
110
|
-
yield Promise.all(promises);
|
|
90
|
+
async validateAndSavePlaygrounds(transformedData, t) {
|
|
91
|
+
this.model.validate(transformedData);
|
|
92
|
+
const promises = transformedData.map(async (playground) => {
|
|
93
|
+
await this.model["sequelizeModel"].upsert({ ...playground }, { transaction: t });
|
|
111
94
|
});
|
|
95
|
+
await Promise.all(promises);
|
|
112
96
|
}
|
|
113
|
-
validateAndSaveProperties(transformedData, t) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
yield this.model.playgroundPropertyModel["sequelizeModel"].upsert(Object.assign({}, playgroundProperty), { transaction: t });
|
|
125
|
-
}));
|
|
126
|
-
yield Promise.all(promises2);
|
|
97
|
+
async validateAndSaveProperties(transformedData, t) {
|
|
98
|
+
const propertiesData = PlaygroundsTransformation_1.PlaygroundsTransformation.getUniqueProperties(transformedData);
|
|
99
|
+
const propertiesRelationData = await this.getPlaygroundPropertyRelationData(transformedData, t);
|
|
100
|
+
this.model.propertiesModel.validate(propertiesData);
|
|
101
|
+
this.model.playgroundPropertyModel.validate(propertiesRelationData);
|
|
102
|
+
const promises = propertiesData.map(async (property) => {
|
|
103
|
+
await this.model.propertiesModel["sequelizeModel"].upsert({ ...property }, { transaction: t });
|
|
104
|
+
});
|
|
105
|
+
await Promise.all(promises);
|
|
106
|
+
const promises2 = propertiesRelationData.map(async (playgroundProperty) => {
|
|
107
|
+
await this.model.playgroundPropertyModel["sequelizeModel"].upsert({ ...playgroundProperty }, { transaction: t });
|
|
127
108
|
});
|
|
109
|
+
await Promise.all(promises2);
|
|
128
110
|
}
|
|
129
111
|
}
|
|
130
112
|
exports.RefreshDataInDBTask = RefreshDataInDBTask;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RefreshDataInDBTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/workers/playgrounds/tasks/RefreshDataInDBTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RefreshDataInDBTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/workers/playgrounds/tasks/RefreshDataInDBTask.ts"],"names":[],"mappings":";;;AACA,6EAA8F;AAE9F,2EAAkF;AACl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(thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -27,16 +18,14 @@ class UpdateAddressAndDistrictTask extends workers_1.AbstractTask {
|
|
|
27
18
|
this.model = new PlaygroundsModel_1.PlaygroundsModel();
|
|
28
19
|
this.cityDistrictsModel = new CityDistrictPostgresRepository_1.default();
|
|
29
20
|
}
|
|
30
|
-
execute(data) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
yield AddressHelper_1.AddressHelper.updateDistrict(dbData, this.cityDistrictsModel);
|
|
38
|
-
yield AddressHelper_1.AddressHelper.updateAddress(dbData);
|
|
21
|
+
async execute(data) {
|
|
22
|
+
const dbData = await this.model.findOne({
|
|
23
|
+
where: {
|
|
24
|
+
external_id: data.external_id,
|
|
25
|
+
},
|
|
39
26
|
});
|
|
27
|
+
await AddressHelper_1.AddressHelper.updateDistrict(dbData, this.cityDistrictsModel);
|
|
28
|
+
await AddressHelper_1.AddressHelper.updateAddress(dbData);
|
|
40
29
|
}
|
|
41
30
|
}
|
|
42
31
|
exports.UpdateAddressAndDistrictTask = UpdateAddressAndDistrictTask;
|
package/dist/integration-engine/workers/playgrounds/tasks/UpdateAddressAndDistrictTask.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateAddressAndDistrictTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/workers/playgrounds/tasks/UpdateAddressAndDistrictTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UpdateAddressAndDistrictTask.js","sourceRoot":"","sources":["../../../../../src/integration-engine/workers/playgrounds/tasks/UpdateAddressAndDistrictTask.ts"],"names":[],"mappings":";;;;;;AAAA,2EAA6E;AAC7E,iKAA6H;AAE7H,kEAA0D;AAC1D,4CAA2E;AAC3E,uEAA+D;AAE/D,MAAa,4BAA6B,SAAQ,sBAA8B;IAQ5E,YAAY,WAAmB;QAC3B,KAAK,CAAC,WAAW,CAAC,CAAC;QARP,cAAS,GAAG,0BAA0B,CAAC;QACvC,aAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;QAC3C,WAAM,GAAG,oCAA2B,CAAC;QAOjD,IAAI,CAAC,KAAK,GAAG,IAAI,mCAAgB,EAAE,CAAC;QACpC,IAAI,CAAC,kBAAkB,GAAG,IAAI,wCAAkB,EAAE,CAAC;IACvD,CAAC;IAES,KAAK,CAAC,OAAO,CAAC,IAAsB;QAC1C,MAAM,MAAM,GAAe,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAChD,KAAK,EAAE;gBACH,WAAW,EAAE,IAAI,CAAC,WAAW;aAChC;SACJ,CAAC,CAAC;QAEH,MAAM,6BAAa,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACpE,MAAM,6BAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACJ;AAxBD,oEAwBC"}
|
|
@@ -31,7 +31,7 @@ class FilterHelper {
|
|
|
31
31
|
? [
|
|
32
32
|
{
|
|
33
33
|
updated_at: {
|
|
34
|
-
[sequelize_1.default.Op.gt]: options
|
|
34
|
+
[sequelize_1.default.Op.gt]: options?.updatedSince,
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
]
|
|
@@ -45,7 +45,7 @@ class FilterHelper {
|
|
|
45
45
|
: [];
|
|
46
46
|
}
|
|
47
47
|
static prepareOrderFunction(options) {
|
|
48
|
-
return
|
|
48
|
+
return options?.lat && options.lng
|
|
49
49
|
? [
|
|
50
50
|
sequelize_1.default.fn("ST_Distance", sequelize_1.default.col("location"), sequelize_1.default.cast(sequelize_1.default.fn("ST_SetSRID", sequelize_1.default.fn("ST_MakePoint", options.lng, options.lat), 4326), "geography")),
|
|
51
51
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterHelper.js","sourceRoot":"","sources":["../../../src/output-gateway/models/FilterHelper.ts"],"names":[],"mappings":";;;;;;AACA,oFAA8E;AAE9E,MAAa,YAAY;IACd,MAAM,CAAC,mBAAmB,CAAC,OAAoC;QAClE,OAAO,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC;YACxC,CAAC,CAAC;gBACI;oBACI,WAAW,EAAE,EAAE,CAAC,mBAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,GAAG,EAAE;iBAClD;aACJ;YACH,CAAC,CAAC,EAAE,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,yBAAyB,CAAC,OAAoC;QACxE,OAAO,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC;YACpD,CAAC,CAAC;gBACI;oBACI,QAAQ,EAAE;wBACN,CAAC,mBAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,SAAS;qBACvC;iBACJ;aACJ;YACH,CAAC,CAAC,EAAE,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,2BAA2B,CAAC,OAAoC;QAC1E,OAAO,OAAO,CAAC,YAAY;YACvB,CAAC,CAAC;gBACI;oBACI,UAAU,EAAE;wBACR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,CAAC,EACzB,mBAAS,CAAC,IAAI,CACV,mBAAS,CAAC,EAAE,CAAC,YAAY,EAAE,mBAAS,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,EACxF,WAAW,CACd,EACD,OAAO,CAAC,KAAK,CAChB;aACJ;YACH,CAAC,CAAC,EAAE,CAAC;IACb,CAAC;IAEM,MAAM,CAAC,oBAAoB,CAAC,OAAgD;QAC/E,OAAO,OAAO,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG;YAC9B,CAAC,CAAC;gBACI,mBAAS,CAAC,EAAE,CACR,aAAa,EACb,mBAAS,CAAC,GAAG,CAAC,UAAU,CAAC,EACzB,mBAAS,CAAC,IAAI,CACV,mBAAS,CAAC,EAAE,CAAC,YAAY,EAAE,mBAAS,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,EACxF,WAAW,CACd,CACJ;aACJ;YACH,CAAC,CAAC,SAAS,CAAC;IACpB,CAAC;CACJ;AAjED,oCAiEC"}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -27,8 +18,8 @@ class PlaygroundsModel extends output_gateway_1.SequelizeModel {
|
|
|
27
18
|
super(PlaygroundsInfo_1.PlaygroundsInfo.playgroundsModelName, PlaygroundSchemaTables_1.PlaygroundSchemaTables.Playground, Playground_1.Playground.attributesModel, {
|
|
28
19
|
schema: PlaygroundsInfo_1.PlaygroundsInfo.schemaName,
|
|
29
20
|
});
|
|
30
|
-
this.GetAll = (options) =>
|
|
31
|
-
const result =
|
|
21
|
+
this.GetAll = async (options) => {
|
|
22
|
+
const result = await this.sequelizeModel.findAll({
|
|
32
23
|
attributes: {
|
|
33
24
|
include: ["updated_at"],
|
|
34
25
|
},
|
|
@@ -42,14 +33,14 @@ class PlaygroundsModel extends output_gateway_1.SequelizeModel {
|
|
|
42
33
|
],
|
|
43
34
|
}
|
|
44
35
|
: {},
|
|
45
|
-
limit: options
|
|
46
|
-
offset: Number.isInteger(options
|
|
36
|
+
limit: options?.limit,
|
|
37
|
+
offset: Number.isInteger(options?.offset) ? options?.offset : undefined,
|
|
47
38
|
order: FilterHelper_1.FilterHelper.prepareOrderFunction(options),
|
|
48
39
|
});
|
|
49
40
|
return (0, output_gateway_1.buildGeojsonFeatureCollection)(result.map((element) => this.CreateOutputItem(element)));
|
|
50
|
-
}
|
|
51
|
-
this.GetOne = (id) =>
|
|
52
|
-
const result =
|
|
41
|
+
};
|
|
42
|
+
this.GetOne = async (id) => {
|
|
43
|
+
const result = await this.sequelizeModel.findOne({
|
|
53
44
|
attributes: {
|
|
54
45
|
include: ["updated_at"],
|
|
55
46
|
},
|
|
@@ -57,9 +48,9 @@ class PlaygroundsModel extends output_gateway_1.SequelizeModel {
|
|
|
57
48
|
include: "properties",
|
|
58
49
|
});
|
|
59
50
|
return this.CreateOutputItem(result);
|
|
60
|
-
}
|
|
61
|
-
this.GetProperties = () =>
|
|
62
|
-
const result =
|
|
51
|
+
};
|
|
52
|
+
this.GetProperties = async () => {
|
|
53
|
+
const result = await this.propertiesModel.sequelizeModel.findAll();
|
|
63
54
|
return result.map((x) => {
|
|
64
55
|
const property = {
|
|
65
56
|
id: x.id,
|
|
@@ -67,7 +58,7 @@ class PlaygroundsModel extends output_gateway_1.SequelizeModel {
|
|
|
67
58
|
};
|
|
68
59
|
return property;
|
|
69
60
|
});
|
|
70
|
-
}
|
|
61
|
+
};
|
|
71
62
|
this.CreateOutputItem = (result) => {
|
|
72
63
|
if (!result)
|
|
73
64
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaygroundsModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/PlaygroundsModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlaygroundsModel.js","sourceRoot":"","sources":["../../../src/output-gateway/models/PlaygroundsModel.ts"],"names":[],"mappings":";;;;;;AAAA,uFAAgE;AAChE,4FAAqE;AACrE,8EAAuD;AAEvD,qFAA8D;AAE9D,sEAO2C;AAE3C,oFAA4D;AAC5D,iDAA8C;AAC9C,uEAAoE;AACpE,mDAAgD;AAEhD,MAAa,gBAAiB,SAAQ,+BAAc;IAIhD;QACI,KAAK,CAAC,iCAAe,CAAC,oBAAoB,EAAE,+CAAsB,CAAC,UAAU,EAAE,uBAAU,CAAC,eAAe,EAAE;YACvG,MAAM,EAAE,iCAAe,CAAC,UAAU;SACrC,CAAC,CAAC;QAmBA,WAAM,GAAG,KAAK,EAAE,OAAqC,EAAsC,EAAE;YAChG,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAa;gBACzD,UAAU,EAAE;oBACR,OAAO,EAAE,CAAC,YAAY,CAAC;iBAC1B;gBACD,OAAO,EAAE,YAAY;gBACrB,KAAK,EAAE,OAAO;oBACV,CAAC,CAAC;wBACI,CAAC,mBAAS,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE;4BAChB,GAAG,2BAAY,CAAC,wBAAwB,CAAC,OAAO,C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AC,CAAC,CAAC;QACP,CAAC,CAAC;QAEM,qBAAgB,GAAG,CAAC,MAAyB,EAA+B,EAAE;YAClF,IAAI,CAAC,MAAM;gBAAE,OAAO,SAAS,CAAC;YAE9B,OAAO,IAAI,mCAAgB,CAAC,MAAM,CAAC,CAAC;QACxC,CAAC,CAAC;QArEE,IAAI,CAAC,eAAe,GAAG,IAAI,6BAAa,EAAE,CAAC;QAC3C,IAAI,CAAC,uBAAuB,GAAG,IAAI,iDAAuB,EAAE,CAAC;QAE7D,iCAAe,CAAC,eAAe,CAC3B,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,eAAe,CAAC,cAAc,EACnC,IAAI,CAAC,uBAAuB,CAAC,cAAc,CAC9C,CAAC;IACN,CAAC;IAEM,iBAAiB,CAAC,KAAa;QAClC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAEM,0BAA0B,CAAC,IAAY;QAC1C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IACjC,CAAC;CAsDJ;AA9ED,4CA8EC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemio/playgrounds",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.14",
|
|
4
4
|
"description": "Golemio Playgrounds Module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,33 +31,33 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@commitlint/cli": "^11.0.0",
|
|
33
33
|
"@commitlint/config-conventional": "^11.0.0",
|
|
34
|
-
"@golemio/city-districts": "1.
|
|
35
|
-
"@golemio/cli": "1.
|
|
36
|
-
"@golemio/core": "
|
|
37
|
-
"@golemio/db-common": "1.1
|
|
34
|
+
"@golemio/city-districts": "1.4.1",
|
|
35
|
+
"@golemio/cli": "1.11.0",
|
|
36
|
+
"@golemio/core": "3.0.2",
|
|
37
|
+
"@golemio/db-common": "1.2.1",
|
|
38
38
|
"@golemio/eslint-config": "1.1.2",
|
|
39
|
-
"@types/chai": "
|
|
40
|
-
"@types/chai-as-promised": "
|
|
39
|
+
"@types/chai": "^5.2.3",
|
|
40
|
+
"@types/chai-as-promised": "^8.0.2",
|
|
41
41
|
"@types/geojson": "^7946.0.8",
|
|
42
|
-
"@types/mocha": "^
|
|
42
|
+
"@types/mocha": "^10.0.10",
|
|
43
43
|
"@types/node": "^20.12.7",
|
|
44
|
-
"@types/sinon": "^
|
|
45
|
-
"@types/supertest": "^
|
|
46
|
-
"chai": "
|
|
47
|
-
"chai-as-promised": "
|
|
44
|
+
"@types/sinon": "^21.0.0",
|
|
45
|
+
"@types/supertest": "^6.0.3",
|
|
46
|
+
"chai": "^6.2.2",
|
|
47
|
+
"chai-as-promised": "^8.0.2",
|
|
48
48
|
"cross-env": "^7.0.3",
|
|
49
49
|
"dotenv": "^8.2.0",
|
|
50
50
|
"eslint": "^8.1.1",
|
|
51
51
|
"husky": "^4.3.7",
|
|
52
|
-
"mocha": "^
|
|
52
|
+
"mocha": "^11.7.5",
|
|
53
53
|
"npm-run-all": "^4.1.5",
|
|
54
54
|
"nyc": "^15.1.0",
|
|
55
55
|
"prettier": "^2.5.1",
|
|
56
56
|
"pretty-quick": "^3.1.0",
|
|
57
57
|
"rimraf": "^3.0.2",
|
|
58
|
-
"sinon": "^
|
|
58
|
+
"sinon": "^21.0.1",
|
|
59
59
|
"source-map-support": "0.5.21",
|
|
60
|
-
"supertest": "^
|
|
60
|
+
"supertest": "^7.1.4",
|
|
61
61
|
"ts-node": "^10.9.1",
|
|
62
62
|
"ts-patch": "3.0.0-beta3",
|
|
63
63
|
"tsconfig-paths": "^4.2.0",
|