@bytebrand/export-cars 1.14.7 → 1.14.9

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.7",
3
+ "version": "1.14.9",
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": "89dec14a819c48f16553f2a555d3b664cf1b2e41"
63
+ "gitHead": "845a3c9625415166d0bdfa6cf6def27339b7308a"
64
64
  }
@@ -12,9 +12,10 @@ import { DealerProfileInterface } from '@bytebrand/autode-request';
12
12
 
13
13
  @Injectable()
14
14
  export class CarService {
15
+ private bottleneck: Bottleneck = new Bottleneck({ maxConcurrent: 50 })
16
+
15
17
  constructor(
16
18
  @Inject(CACHE_MANAGER) private cacheManager: Cache,
17
- private bottleneck: Bottleneck,
18
19
  private requestService: RequestService,
19
20
  ) { }
20
21
 
@@ -41,7 +42,7 @@ export class CarService {
41
42
  let owner = (await this.cacheManager.get(ownerId)) as DealerProfileInterface;
42
43
  if (!owner) {
43
44
  try {
44
- owner = await this.bottleneck.schedule(() => CronicleUtils.retry(() => this.requestService.upaRequest.getDealerProfile(ownerId), 5, 10_000, true));
45
+ owner = await this.bottleneck.schedule(() => CronicleUtils.retry(() => this.requestService.upaRequest.getDealerProfile(ownerId), 4, 7_500, true));
45
46
  } catch (e) {
46
47
  console.log(e.message, ownerId);
47
48
  throw e;
@@ -261,7 +261,7 @@ export class FbTransformer {
261
261
  car: DataSchemes.Car,
262
262
  owner: unknown,
263
263
  ): Promise<{
264
- address: { city: string; region: string; country: string; postal_code: string };
264
+ address: { city: string; region: string; country: string; postal_code: string; addr1: string; };
265
265
  latitude: number;
266
266
  longitude: number;
267
267
  }> {
@@ -271,9 +271,11 @@ export class FbTransformer {
271
271
  }
272
272
  let city: string = get(owner, `${addressPath}.city`, '');
273
273
  let zip: string = get(owner, `${addressPath}.zip`, '');
274
+ let addr1 = get(owner, `${addressPath}.street`, '');
274
275
  let locationEntity = await this.getLocationByInfo({ city, zip: toSafeInteger(zip) });
275
276
 
276
277
  if (this.isEmptyLocation(locationEntity)) {
278
+ addr1 = DEFAULT_ADDR1;
277
279
  city = DEFAULT_CITY;
278
280
  zip = DEFAULT_ZIP;
279
281
  locationEntity = await this.getLocationByInfo({ city, zip: toSafeInteger(zip) });
@@ -284,6 +286,7 @@ export class FbTransformer {
284
286
  return {
285
287
  ...coords,
286
288
  address: {
289
+ addr1,
287
290
  city,
288
291
  region: get(locationEntity, 'Place Name', ''),
289
292
  country: country || 'Deutschland',