@bytebrand/export-cars 1.21.74 → 1.21.76
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
|
@@ -53,15 +53,17 @@ export class SantanderTransformer {
|
|
|
53
53
|
const isNew =
|
|
54
54
|
(!carData.mainData.firstRegistration || this.monthDiffLess(carData, 8)) &&
|
|
55
55
|
(!carData.mainData.mileage || carData.mainData.mileage < 1000);
|
|
56
|
+
|
|
56
57
|
if (isNew) {
|
|
57
58
|
console.log('carData', carData._id);
|
|
58
|
-
console.log('rules', JSON.stringify(rules));
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
for (const rule of rules) {
|
|
62
62
|
const importFieldNumber = Number(rule.importField.match(/\d+/)[0]);
|
|
63
63
|
|
|
64
|
-
if (
|
|
64
|
+
if (isNew && this.checkFieldsOnlyForNew(importFieldNumber)) {
|
|
65
|
+
console.log(`NEW - ${rule.importField} - ${importFieldNumber}`);
|
|
66
|
+
} else {
|
|
65
67
|
continue;
|
|
66
68
|
}
|
|
67
69
|
|
|
@@ -95,17 +97,17 @@ export class SantanderTransformer {
|
|
|
95
97
|
if (this.configService.config.campaign === 'eauto' && carData.offer.ftpFolder === 'auto_de_eautos') {
|
|
96
98
|
set(transformedCarData, 12, get(carData, 'offer.internalNumber', null));
|
|
97
99
|
}
|
|
98
|
-
|
|
100
|
+
|
|
99
101
|
return transformedCarData;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
private async checkFieldsOnlyForNew(importFieldNumber: number) {
|
|
103
|
-
const fieldsOnlyForNewCar =
|
|
105
|
+
const fieldsOnlyForNewCar: any = [
|
|
104
106
|
336, 337, 338, 339, 313, 320, 405, 468, 469, 470, 471, 472, 473, 474, 475,
|
|
105
107
|
513, 514, 515, 516, 517, 520, 521, 522, 523, 524, 525, 526, 527
|
|
106
|
-
]
|
|
108
|
+
];
|
|
107
109
|
|
|
108
|
-
return fieldsOnlyForNewCar.
|
|
110
|
+
return fieldsOnlyForNewCar.includes(importFieldNumber);
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
private async transformField(fieldValue: any, rule: MappingRules): Promise<string | void> {
|