@bytebrand/export-cars 1.22.20 → 1.22.21
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/interfaces/export-item.interface.d.ts +2 -2
- package/dist/transformers/google.transformer.d.ts +1 -0
- package/dist/transformers/google.transformer.js +8 -3
- package/dist/transformers/google.transformer.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/interfaces/export-item.interface.ts +2 -2
- package/src/transformers/google.transformer.ts +9 -4
package/package.json
CHANGED
|
@@ -187,12 +187,12 @@ export interface GoogleXmlItem {
|
|
|
187
187
|
link_template: string;
|
|
188
188
|
additional_image_link: string[];
|
|
189
189
|
model: string;
|
|
190
|
-
VIN
|
|
190
|
+
VIN?: string;
|
|
191
191
|
trim: string;
|
|
192
192
|
year: number;
|
|
193
193
|
mileage: string;
|
|
194
194
|
vehicle_option: string[];
|
|
195
|
-
body_style
|
|
195
|
+
body_style?: string,
|
|
196
196
|
engine: string,
|
|
197
197
|
date_first_registered: string,
|
|
198
198
|
fuel_consumption: string,
|
|
@@ -7,6 +7,7 @@ import { ImboImageResponseInterface } from '@bytebrand/chunkable';
|
|
|
7
7
|
import { Injectable } from '@nestjs/common';
|
|
8
8
|
import { ConfigService, ImagesService, TransformerService, UserService } from '../services';
|
|
9
9
|
import { GoogleXmlItem } from '../interfaces';
|
|
10
|
+
import { isValidVin } from '../utils';
|
|
10
11
|
import moment from 'moment';
|
|
11
12
|
|
|
12
13
|
const GOOGLE_MAX_TRIM_LENGTH = 50;
|
|
@@ -59,7 +60,7 @@ export class GoogleTransformer {
|
|
|
59
60
|
certification: this.getCertification(car),
|
|
60
61
|
title: this.getTitle(car),
|
|
61
62
|
product_type: this.getCategory(car),
|
|
62
|
-
VIN: this.
|
|
63
|
+
VIN: this.getVin(car),
|
|
63
64
|
id: carId,
|
|
64
65
|
image_link: allImages[0],
|
|
65
66
|
additional_image_link: allImages.slice(1, 10),
|
|
@@ -110,6 +111,8 @@ export class GoogleTransformer {
|
|
|
110
111
|
'electric_range',
|
|
111
112
|
'fuel_consumption_discharged_battery',
|
|
112
113
|
'installment',
|
|
114
|
+
'VIN',
|
|
115
|
+
'body_style',
|
|
113
116
|
];
|
|
114
117
|
for (const key of optionalKeys) {
|
|
115
118
|
if (!item[key]) {
|
|
@@ -124,12 +127,14 @@ export class GoogleTransformer {
|
|
|
124
127
|
if (images.length === 0)
|
|
125
128
|
return false
|
|
126
129
|
|
|
127
|
-
if (!this.mapBodyStyle(car))
|
|
128
|
-
return false
|
|
129
|
-
|
|
130
130
|
return true
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
private getVin(car: DataSchemes.Car): string | undefined {
|
|
134
|
+
const vin = get(car, 'metaData.vin', '');
|
|
135
|
+
return isValidVin(vin) ? vin : undefined;
|
|
136
|
+
}
|
|
137
|
+
|
|
133
138
|
private getTitle(car: DataSchemes.Car): string {
|
|
134
139
|
const model = toString(get(car, 'mainData.model', ''));
|
|
135
140
|
const brand = trim(this.getBrand(car));
|