@golemio/parkings
Version:
Golemio Parkings Module
43 lines • 2.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.IptOictParkingTransformation = void 0;
const GeodataHelper_1 = require("../helpers/GeodataHelper");
const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation");
class IptOictParkingTransformation extends AbstractTransformation_1.AbstractTransformation {
constructor(source, transformationDate) {
super();
this.source = source;
this.transformationDate = transformationDate;
this.name = "IptOictParkingTransformation";
this.transformInternal = (element) => {
const transformed = {
id: `${this.source}-${element.properties.source_id}`,
source: this.source,
source_id: element.properties.source_id,
data_provider: "manual",
location: element.geometry,
name: element.properties.name,
category: element.properties.filter ?? undefined,
parking_type: element.properties.parking_type ? element.properties.parking_type : "other",
centroid: (0, GeodataHelper_1.getPointOnFeature)(element.geometry),
covered: element.properties.covered,
security: element.properties.security ?? null,
contact: element.properties.contact?.email || element.properties.contact?.phone || element.properties.contact?.web_url
? {
email: element.properties.contact?.email ?? null,
phone: element.properties.contact?.phone ?? null,
website: element.properties.contact?.web_url ?? null,
}
: null,
date_modified: this.transformationDate.toISOString(),
total_spot_number: element.properties.capacity,
max_vehicle_dimensions: null,
parking_policy: element.properties.parking_policy ?? null,
active: true,
};
return transformed;
};
}
}
exports.IptOictParkingTransformation = IptOictParkingTransformation;
//# sourceMappingURL=IptOictParkingTransformation.js.map