@bytebrand/export-cars 1.13.2 → 1.14.1

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.13.2",
3
+ "version": "1.14.1",
4
4
  "description": "",
5
5
  "author": "bytebrand",
6
6
  "license": "UNLICENSED",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=14.0.0"
62
62
  },
63
- "gitHead": "f688f3018efe767186ee7cbac509c2800fb6aab3"
63
+ "gitHead": "44c930384611b8704c361f056636f999d0d2522a"
64
64
  }
@@ -39,7 +39,7 @@ export class GoogleTransformer {
39
39
  image_link: transformedImages[0],
40
40
  condition: this.mapState(car),
41
41
  availability: this.getAvailability(car),
42
- brand: get(car, 'mainData.make', ''),
42
+ brand: this.getBrand(car),
43
43
  price: this.getRetailPrice(car),
44
44
  sales_price: this.getPrice(car),
45
45
  energy_efficiency_class: this.getEnergyClass(car),
@@ -153,4 +153,17 @@ export class GoogleTransformer {
153
153
  monthlyInstallment,
154
154
  };
155
155
  }
156
+
157
+ private getBrand(car: DataSchemes.Car): string {
158
+ const make = get(car, 'mainData.make', '');
159
+
160
+ switch (make) {
161
+ case 'Mercedes-Benz':
162
+ return 'Mercedes';
163
+ case 'Volkswagen':
164
+ return 'VW';
165
+ default:
166
+ return make;
167
+ }
168
+ }
156
169
  }
@@ -1,4 +1,4 @@
1
- import { escape, get, isEmpty, join, toNumber, toSafeInteger, toString, trim } from 'lodash';
1
+ import { escape, get, isEmpty, isNumber, join, toNumber, toSafeInteger, toString, trim } from 'lodash';
2
2
  import { Injectable } from '@nestjs/common';
3
3
  import * as moment from 'moment/moment';
4
4
 
@@ -172,11 +172,11 @@ export class RubrikkTransformer {
172
172
  }
173
173
 
174
174
  private getYear(car: DataSchemes.Car): number {
175
- const firstRegistration = get(car, 'mainData.firstRegistration', 0) as number;
176
- if (firstRegistration !== 0) {
175
+ const firstRegistration = get(car, 'mainData.firstRegistration') as number;
176
+ if (isNumber(firstRegistration)) {
177
177
  return toSafeInteger(moment(firstRegistration * 1000).format('YYYY'));
178
178
  }
179
- return 0;
179
+ return null;
180
180
  }
181
181
 
182
182
  private getDriveType(car: DataSchemes.Car): string {