@bytebrand/export-cars 1.2.1 → 1.2.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/export-cars",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "bytebrand",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=14.0.0"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "61c542cb69c0f3b94250dc2ac4b30b47b29b170a"
|
|
69
69
|
}
|
|
@@ -73,11 +73,11 @@ export class RubrikkTransformer {
|
|
|
73
73
|
motoring__emission_sticker: this.translateSelector(get(car, 'environmentEmissions.emissionSticker', '')),
|
|
74
74
|
motoring__engine_displacement_cubic_centimeters: toNumber(get(car, 'engineData.cubicCapacity', null)),
|
|
75
75
|
motoring__fuel_consumption_combined: get(car, 'consumption.consumptionCombined', null),
|
|
76
|
-
motoring__fuel_consumption_combined_unit:
|
|
76
|
+
motoring__fuel_consumption_combined_unit: this.getUrbanUnit(car),
|
|
77
77
|
motoring__fuel_consumption_extra_urban: get(car, 'consumption.consumptionOuter', null),
|
|
78
|
-
motoring__fuel_consumption_extra_urban_unit:
|
|
78
|
+
motoring__fuel_consumption_extra_urban_unit: this.getUrbanUnit(car),
|
|
79
79
|
motoring__fuel_consumption_urban: get(car, 'consumption.consumptionInner', null),
|
|
80
|
-
motoring__fuel_consumption_urban_unit:
|
|
80
|
+
motoring__fuel_consumption_urban_unit: this.getUrbanUnit(car),
|
|
81
81
|
motoring__fuel_type: this.translateSelector(get(car, 'consumption.fuel', '')),
|
|
82
82
|
motoring__make: toString(get(car, 'mainData.make', '')),
|
|
83
83
|
motoring__mileage_kilometers: get(car, 'mainData.mileage', null),
|
|
@@ -91,6 +91,11 @@ export class RubrikkTransformer {
|
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
private getUrbanUnit(car: DataSchemes.Car) {
|
|
95
|
+
const fuel_type = this.translateSelector(get(car, 'consumption.fuel', ''));
|
|
96
|
+
return fuel_type === 'Elektro' ? 'kWt/100km' : 'l/100km';
|
|
97
|
+
}
|
|
98
|
+
|
|
94
99
|
private translateSelector(selector: string): string {
|
|
95
100
|
if (isEmpty(selector) || selector === 'selector_unknown') {
|
|
96
101
|
return '';
|
|
@@ -121,14 +126,14 @@ export class RubrikkTransformer {
|
|
|
121
126
|
|
|
122
127
|
private getCarLink(car: DataSchemes.Car): string {
|
|
123
128
|
const autodeId = toString(get(car, '_id', ''));
|
|
124
|
-
return `https
|
|
129
|
+
return `https://${this.configService.config.url}/search/vehicle/${autodeId}?source=classifieds&medium=listing&campaign=focus`;
|
|
125
130
|
}
|
|
126
131
|
|
|
127
132
|
private getImageLink(car: DataSchemes.Car): string {
|
|
128
133
|
const mainImageId = get(car, 'metaData.mainImageId', '');
|
|
129
134
|
return mainImageId
|
|
130
|
-
?
|
|
131
|
-
:
|
|
135
|
+
? `${this.configService.config.imageUrl}carimage/${car._id}/${mainImageId}/large-cached.webp`
|
|
136
|
+
: `${this.configService.config.imageUrl}/carimage/noimage/7pNvWELuWhZX/large-cached.jpeg`;
|
|
132
137
|
}
|
|
133
138
|
|
|
134
139
|
private getImagesLinks(carId: string, images: ImboImageResponseInterface[]): string[] {
|