@bytebrand/export-cars 1.14.4 → 1.14.6

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.14.4",
3
+ "version": "1.14.6",
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": "a8c5cfd06f692356f979f1b7ea35d931633cab43"
63
+ "gitHead": "0137cb771cb9bcba811870499689a96e351c1de1"
64
64
  }
@@ -61,12 +61,12 @@ export class TransformerService {
61
61
  const body_style_selector = get(car, 'mainData.category', 'selector_unknown');
62
62
  return <string>get(CategoryList, body_style_selector).value;
63
63
  }
64
- year(car: DataSchemes.Car): number {
65
- const firstRegistration = get(car, 'mainData.firstRegistration', null) as number;
66
- if (firstRegistration !== 0) {
67
- return toSafeInteger(moment(firstRegistration * 1000).format('YYYY'));
64
+ year(car: DataSchemes.Car): string {
65
+ const firstRegistration = get(car, 'mainData.firstRegistration') as number;
66
+ if (firstRegistration) {
67
+ return moment(firstRegistration * 1000).format('YYYY');
68
68
  }
69
- return 0;
69
+ return moment().format('YYYY');
70
70
  }
71
71
 
72
72
  mileage(car: DataSchemes.Car): number {
@@ -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: this.getBrand(car),
42
+ brand: get(car, 'mainData.make', ''),
43
43
  price: this.getRetailPrice(car),
44
44
  sales_price: this.getPrice(car),
45
45
  energy_efficiency_class: this.getEnergyClass(car),
@@ -49,10 +49,9 @@ export class GoogleTransformer {
49
49
  }
50
50
 
51
51
  private getTitle(car: DataSchemes.Car): string {
52
- const make = toString(get(car, 'mainData.make', ''));
53
52
  const model = toString(get(car, 'mainData.model', ''));
54
53
 
55
- return trim(escape(join([make, model], ' ')));
54
+ return trim(escape(join([this.getBrand(car), model], ' ')));
56
55
  }
57
56
 
58
57
  private async getDescription(car: DataSchemes.Car): Promise<string> {