@bytebrand/export-cars 1.14.5 → 1.14.7

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.5",
3
+ "version": "1.14.7",
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": "f9f51706b8c0185a32d44301199703ae3f7e09fa"
63
+ "gitHead": "89dec14a819c48f16553f2a555d3b664cf1b2e41"
64
64
  }
@@ -1,4 +1,4 @@
1
- import { CACHE_MANAGER, HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common';
1
+ import { CACHE_MANAGER, Inject, Injectable } from '@nestjs/common';
2
2
  import { getMonthsDiff } from '../utils/date-time.utils';
3
3
  import { DataSchemes } from '@bytebrand/car-schema';
4
4
  import { Cache } from 'cache-manager';
@@ -7,7 +7,7 @@ import { RequestService } from './request.service';
7
7
  import { DateRule } from '../rules/date.rule';
8
8
  import { NumberRule } from '../rules/number.rule';
9
9
  import { StringRule } from '../rules/string.rule';
10
- import { CarsCounter } from '@bytebrand/cronicle-helper';
10
+ import { CarsCounter, CronicleUtils } from '@bytebrand/cronicle-helper';
11
11
  import { DealerProfileInterface } from '@bytebrand/autode-request';
12
12
 
13
13
  @Injectable()
@@ -41,7 +41,7 @@ export class CarService {
41
41
  let owner = (await this.cacheManager.get(ownerId)) as DealerProfileInterface;
42
42
  if (!owner) {
43
43
  try {
44
- owner = await this.bottleneck.schedule(() => this.requestService.upaRequest.getDealerProfile(ownerId));
44
+ owner = await this.bottleneck.schedule(() => CronicleUtils.retry(() => this.requestService.upaRequest.getDealerProfile(ownerId), 5, 10_000, true));
45
45
  } catch (e) {
46
46
  console.log(e.message, ownerId);
47
47
  throw e;
@@ -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> {