@bytebrand/export-cars 1.10.1 → 1.10.3
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/dist/services/user.service.d.ts +1 -1
- package/dist/services/user.service.js.map +1 -1
- package/dist/transformers/fb.transformer.d.ts +4 -2
- package/dist/transformers/fb.transformer.js +25 -10
- package/dist/transformers/fb.transformer.js.map +1 -1
- package/dist/transformers/modix.transformer.js +1 -1
- package/dist/transformers/modix.transformer.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/services/user.service.ts +4 -2
- package/src/transformers/fb.transformer.ts +29 -13
- package/src/transformers/modix.transformer.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/export-cars",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.3",
|
|
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": "
|
|
63
|
+
"gitHead": "3d8977124d994db8a1c77b65230c92cdd3f0ef0f"
|
|
64
64
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CACHE_MANAGER, Inject, Injectable } from '@nestjs/common';
|
|
2
|
+
|
|
3
|
+
import { MarketingImageConfigInterface, MarketingImageConfigsInterface } from '@bytebrand/autode-request';
|
|
4
|
+
|
|
2
5
|
import { RequestService } from './request.service';
|
|
3
6
|
import { Cache } from 'cache-manager';
|
|
4
7
|
import { get } from 'lodash';
|
|
5
|
-
|
|
6
|
-
import { ExportType, FileType } from '../enums';
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
@Injectable()
|
|
9
11
|
export class UserService {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Cache } from 'cache-manager';
|
|
2
|
+
import * as moment from 'moment';
|
|
3
3
|
import {
|
|
4
4
|
escape,
|
|
5
5
|
findIndex,
|
|
@@ -15,17 +15,23 @@ import {
|
|
|
15
15
|
trim,
|
|
16
16
|
truncate,
|
|
17
17
|
} from 'lodash';
|
|
18
|
-
|
|
19
|
-
import {
|
|
20
|
-
|
|
18
|
+
|
|
19
|
+
import { CACHE_MANAGER, Inject, Injectable } from '@nestjs/common';
|
|
20
|
+
|
|
21
21
|
import { DePostalCodesEntryInterface } from '@bytebrand/car-basic-data-scope/dist/interfaces/DePostalCodesInterface';
|
|
22
|
-
import {
|
|
22
|
+
import { de, deVehicleDetailsPage, deVehicleProps } from '@bytebrand/i18n-dictionaries';
|
|
23
|
+
import { DePostalCodesService } from '@bytebrand/car-basic-data-scope';
|
|
23
24
|
import { ImboImageResponseInterface } from '@bytebrand/chunkable';
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
|
|
25
|
+
import { TranslatorExtended } from '@bytebrand/schema-tools';
|
|
26
|
+
import { DataSchemes } from '@bytebrand/car-schema';
|
|
27
|
+
|
|
27
28
|
import { Description } from '../interfaces/description.interface';
|
|
29
|
+
import { FbDescription } from './fb-description.transformer';
|
|
30
|
+
import { ConfigService, ImagesService } from '../services';
|
|
28
31
|
import { FbEquipment } from './fb-equipment.transformer';
|
|
32
|
+
import { isValidVin } from '../utils/validator.utils';
|
|
33
|
+
import { UserService } from 'src/services';
|
|
34
|
+
import { ImageType } from '../enums';
|
|
29
35
|
import {
|
|
30
36
|
DEFAULT_ADDR1,
|
|
31
37
|
DEFAULT_CITY,
|
|
@@ -34,8 +40,7 @@ import {
|
|
|
34
40
|
FB_MIN_MILEAGES,
|
|
35
41
|
TIMESTAMP_FIRST_YEAR,
|
|
36
42
|
} from '../constants/fb.constants';
|
|
37
|
-
|
|
38
|
-
import { ImageType } from '../enums';
|
|
43
|
+
|
|
39
44
|
|
|
40
45
|
@Injectable()
|
|
41
46
|
export class FbTransformer {
|
|
@@ -43,7 +48,11 @@ export class FbTransformer {
|
|
|
43
48
|
private postalCodesService: DePostalCodesService;
|
|
44
49
|
private imagesService: ImagesService;
|
|
45
50
|
|
|
46
|
-
constructor(
|
|
51
|
+
constructor(
|
|
52
|
+
@Inject(CACHE_MANAGER) private cacheManager: Cache,
|
|
53
|
+
private readonly configService: ConfigService,
|
|
54
|
+
private readonly userService: UserService
|
|
55
|
+
) {
|
|
47
56
|
this.imagesService = new ImagesService(configService, userService);
|
|
48
57
|
const dict = { ...de, ...deVehicleProps, ...deVehicleDetailsPage };
|
|
49
58
|
this.translator = new TranslatorExtended(dict);
|
|
@@ -317,10 +326,17 @@ export class FbTransformer {
|
|
|
317
326
|
}
|
|
318
327
|
|
|
319
328
|
private async getLocationByInfo(info: { zip: number; city: string }): Promise<DePostalCodesEntryInterface> {
|
|
320
|
-
|
|
329
|
+
const cacheKey = `${info.city}_${info.zip}`;
|
|
330
|
+
|
|
331
|
+
let entry: DePostalCodesEntryInterface = await this.cacheManager.get(cacheKey);
|
|
332
|
+
if (entry) { return entry };
|
|
333
|
+
|
|
334
|
+
entry = await this.postalCodesService.getLocationByPostalCode(info.zip);
|
|
335
|
+
await this.cacheManager.set(cacheKey, entry);
|
|
321
336
|
|
|
322
337
|
if (!entry) {
|
|
323
338
|
entry = await this.postalCodesService.getLocationByCity(info.city);
|
|
339
|
+
await this.cacheManager.set(cacheKey, entry);
|
|
324
340
|
}
|
|
325
341
|
return entry;
|
|
326
342
|
}
|
|
@@ -200,7 +200,7 @@ export class ModixTransformer {
|
|
|
200
200
|
|
|
201
201
|
private getImagesLinks(car: DataSchemes.Car, images: ImboImageResponseInterface[]): imageItem {
|
|
202
202
|
const car_id = toString(get(car, '_id', ''));
|
|
203
|
-
const url =
|
|
203
|
+
const url = `${this.configService.config.imageUrl}/carimage/${car_id}`;
|
|
204
204
|
|
|
205
205
|
const imageList: IModixWrapItem[] = [];
|
|
206
206
|
|