@bytebrand/export-cars 1.12.10 → 1.12.12

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.12.10",
3
+ "version": "1.12.12",
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": "525eca75925ecb5b76e747ff2a85f5b0dc8cf987"
63
+ "gitHead": "7aebcdb2f8af935a6882213fca2e7caa530ae4d0"
64
64
  }
@@ -51,8 +51,8 @@ export class GoogleTransformer {
51
51
  private getTitle(car: DataSchemes.Car): string {
52
52
  const make = toString(get(car, 'mainData.make', ''));
53
53
  const model = toString(get(car, 'mainData.model', ''));
54
- const subModel = toString(get(car, 'mainData.subModel', ''));
55
- return trim(escape(join([make, model, subModel], ' ')));
54
+
55
+ return trim(escape(join([make, model], ' ')));
56
56
  }
57
57
 
58
58
  private async getDescription(car: DataSchemes.Car): Promise<string> {
@@ -1,25 +1,26 @@
1
1
  import { escape, get, isEmpty, join, toNumber, toSafeInteger, toString, trim } from 'lodash';
2
2
  import { Injectable } from '@nestjs/common';
3
+ import * as moment from 'moment/moment';
3
4
 
5
+ import { CarDescriptionFactory, DescriptionTypeEnum } from '@bytebrand/car-description';
4
6
  import { de, deVehicleDetailsPage, deVehicleProps } from '@bytebrand/i18n-dictionaries';
5
- import { DePostalCodesService } from '@bytebrand/car-basic-data-scope';
6
7
  import { ImboImageResponseInterface } from '@bytebrand/chunkable';
7
8
  import { TranslatorExtended } from '@bytebrand/schema-tools';
8
9
  import { DataSchemes } from '@bytebrand/car-schema';
9
10
 
11
+ import { ConfigService, ImagesService, UserService } from '../services';
10
12
  import { RubrikkXmlItem } from '../interfaces';
11
- import { ConfigService, ImagesService } from '../services';
12
-
13
- import * as moment from 'moment/moment';
14
13
 
15
14
  @Injectable()
16
15
  export class RubrikkTransformer {
17
16
  private translator: TranslatorExtended;
18
- private postalCodesService: DePostalCodesService;
19
17
 
20
- constructor(private readonly configService: ConfigService, private readonly imageService: ImagesService) {
18
+ constructor(
19
+ private readonly configService: ConfigService,
20
+ private readonly imageService: ImagesService,
21
+ private readonly userService: UserService,
22
+ ) {
21
23
  const dict = { ...de, ...deVehicleProps, ...deVehicleDetailsPage };
22
- this.postalCodesService = DePostalCodesService.getInstance();
23
24
  this.translator = new TranslatorExtended(dict);
24
25
  }
25
26
 
@@ -34,7 +35,7 @@ export class RubrikkTransformer {
34
35
  //Common Fields
35
36
  ad__all_imageurls: await this.imageService.getImages(car, images, this.configService.config.imageType, false),
36
37
  ad__condition_new_used_etc: this.getCondition(car),
37
- ad__description: toString(get(car, 'offer.offerDescription', '')),
38
+ ad__description: await this.getDescription(car),
38
39
  ad__headline: this.getTitle(car),
39
40
  ad__imageurl: this.getImageLink(car),
40
41
  ad__price: toNumber(get(car, 'price.currentSalesPrice', null)),
@@ -189,4 +190,11 @@ export class RubrikkTransformer {
189
190
  const driveType = get(car, 'driveSuspension.driveType', 'selector_unknown');
190
191
  return get(available, driveType) || 'N/A';
191
192
  }
193
+
194
+ private async getDescription(car: DataSchemes.Car): Promise<string> {
195
+ const dealerId = get(car, 'metaData.ownerId');
196
+ const descriptionSchema = await this.userService.getDefaultSummaryByDealerId(dealerId);
197
+ const descriptionBuilder = CarDescriptionFactory.create(DescriptionTypeEnum.Mobile, car);
198
+ return descriptionBuilder.transform(descriptionSchema);
199
+ }
192
200
  }