@bytebrand/export-cars 1.18.0 → 1.18.2

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.18.0",
3
+ "version": "1.18.2",
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": "aa7d67c0cd9024a219c21127daeb7851b0b08a9b"
63
+ "gitHead": "9c4e0fe4d3349e64a8600ac1693c50f284ecc7b8"
64
64
  }
@@ -10,6 +10,9 @@ export class EviumConfig extends Config {
10
10
  this.imageUrl = `https://images.${this.domain}/carimage`;
11
11
  this.mappingSpreadsheetTitle = 'mobile_yescar';
12
12
  this.imageType = ImageType.default;
13
- this.outputFiles = [`${this.pathesConfig.localConvertedDirectory}/10022.${FileType.CSV}`];
13
+ this.outputFiles = [
14
+ `${this.pathesConfig.localConvertedDirectory}/api_export_cars__${ExportType.EVIUM}.${FileType.CSV}`,
15
+ `${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.EVIUM}.${FileType.ZIP}`,
16
+ ];
14
17
  }
15
18
  }
@@ -2,16 +2,21 @@ import { get, toString } from 'lodash';
2
2
 
3
3
  import { Injectable } from '@nestjs/common';
4
4
 
5
+ import { CarDescriptionFactory, DescriptionTypeEnum } from '@bytebrand/car-description';
5
6
  import { ImboImageResponseInterface } from '@bytebrand/chunkable';
6
7
  import { DataSchemes } from '@bytebrand/car-schema';
7
8
  import { de } from '@bytebrand/i18n-dictionaries';
8
9
 
9
- import { ConfigService, ImagesService } from '../services';
10
+ import { ConfigService, ImagesService, UserService } from '../services';
10
11
  import { MeinstadtJsonItem } from '../interfaces';
11
12
 
12
13
  @Injectable()
13
14
  export class MeinstadtTransformer {
14
- constructor(private configService: ConfigService, private readonly imageService: ImagesService) {}
15
+ constructor(
16
+ private configService: ConfigService,
17
+ private readonly imageService: ImagesService,
18
+ private userService: UserService
19
+ ) {}
15
20
 
16
21
  async transform({
17
22
  car,
@@ -42,7 +47,7 @@ export class MeinstadtTransformer {
42
47
  power: get(car, 'engineData.powerPS', null),
43
48
  co2Emissions: get(car, 'environmentEmissions.co2', null),
44
49
  fuelConsumptionCombined: get(car, 'consumption.consumptionCombined', null),
45
- equipment: this.getDescription(car),
50
+ equipment: await this.getDescription(car),
46
51
  color: this.translate(get(car, 'exterior.exteriorColor', null)),
47
52
  bodyType: this.translate(get(car, 'mainData.category', null)),
48
53
  emissionClass: this.translate(get(car, 'environmentEmissions.emissionClass', null)),
@@ -78,10 +83,10 @@ export class MeinstadtTransformer {
78
83
  return condition;
79
84
  }
80
85
 
81
- private getDescription(car: DataSchemes.Car): string {
82
- const usageType = get(car, 'offer.offerDescription', null);
83
- if (usageType) {
84
- return usageType.replace(/\\/g, ',').replace(/\\/g, ',').replace(/,,/g, ',');
85
- } else return null;
86
+ private async getDescription(car: DataSchemes.Car): Promise<string> {
87
+ const dealerId = get(car, 'metaData.ownerId');
88
+ const descriptionSchema = await this.userService.getDefaultSummaryByDealerId(dealerId);
89
+ const descriptionBuilder = CarDescriptionFactory.create(DescriptionTypeEnum.Mobile, car);
90
+ return descriptionBuilder.transform(descriptionSchema);
86
91
  }
87
92
  }