@golemio/parkings
Version:
Golemio Parkings Module
44 lines • 1.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.IPRParkingTransformation = void 0;
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
const _sch_1 = require("../../schema-definitions");
class IPRParkingTransformation extends integration_engine_1.BaseTransformation {
constructor() {
super();
this.transform = async (data) => {
const result = {};
for (const element of data) {
const item = this.transformElement(element);
if (result[item.source_id]) {
result[item.source_id].push({
id: item.id,
location: item.location,
total_spot_number: item.total_spot_number,
});
}
else {
result[item.source_id] = [
{
id: item.id,
location: item.location,
total_spot_number: item.total_spot_number,
},
];
}
}
return result;
};
this.transformElement = (element) => {
return {
id: element.properties.ZPS_ID,
source_id: element.properties.TARIFTAB,
location: element.geometry,
total_spot_number: +element.properties.PS_ZPS,
};
};
this.name = _sch_1.Parkings.ipr.name + "Data";
}
}
exports.IPRParkingTransformation = IPRParkingTransformation;
//# sourceMappingURL=IPRParkingTransformation.js.map