@bytebrand/export-cars 1.0.8 → 1.0.10
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/config/as24.config.js +1 -0
- package/dist/config/as24.config.js.map +1 -1
- package/dist/config/autoboerse.config.js +1 -0
- package/dist/config/autoboerse.config.js.map +1 -1
- package/dist/config/config.d.ts +3 -0
- package/dist/config/config.js +5 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/eauto.config.js +1 -0
- package/dist/config/eauto.config.js.map +1 -1
- package/dist/config/marktde.config.js +1 -0
- package/dist/config/marktde.config.js.map +1 -1
- package/dist/config/yescar.config.js +1 -0
- package/dist/config/yescar.config.js.map +1 -1
- package/dist/export.command.d.ts +0 -1
- package/dist/export.command.js +2 -3
- package/dist/export.command.js.map +1 -1
- package/dist/export.schema.d.ts +6 -0
- package/dist/export.schema.js +6 -0
- package/dist/export.schema.js.map +1 -1
- package/dist/exporters/as24.exporter.js +13 -0
- package/dist/exporters/as24.exporter.js.map +1 -1
- package/dist/exporters/mobile.exporter.js +3 -4
- package/dist/exporters/mobile.exporter.js.map +1 -1
- package/dist/interfaces/params.interface.d.ts +1 -0
- package/dist/main.js +4 -11
- package/dist/main.js.map +1 -1
- package/dist/services/loader.service.d.ts +0 -1
- package/dist/services/loader.service.js +4 -5
- package/dist/services/loader.service.js.map +1 -1
- package/dist/services/mapping.service.d.ts +4 -3
- package/dist/services/mapping.service.js +23 -14
- package/dist/services/mapping.service.js.map +1 -1
- package/dist/services/rules.service.d.ts +0 -1
- package/dist/services/rules.service.js +4 -5
- package/dist/services/rules.service.js.map +1 -1
- package/dist/transformers/as24.transformer.d.ts +0 -1
- package/dist/transformers/as24.transformer.js +4 -5
- package/dist/transformers/as24.transformer.js.map +1 -1
- package/dist/transformers/mobile.transformer.d.ts +0 -1
- package/dist/transformers/mobile.transformer.js +6 -7
- package/dist/transformers/mobile.transformer.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/config/as24.config.ts +1 -0
- package/src/config/autoboerse.config.ts +1 -0
- package/src/config/config.ts +5 -0
- package/src/config/eauto.config.ts +1 -0
- package/src/config/marktde.config.ts +1 -0
- package/src/config/yescar.config.ts +1 -0
- package/src/export.command.ts +2 -4
- package/src/export.schema.ts +6 -0
- package/src/exporters/as24.exporter.ts +17 -13
- package/src/exporters/mobile.exporter.ts +3 -4
- package/src/interfaces/params.interface.ts +1 -0
- package/src/main.ts +10 -19
- package/src/services/loader.service.ts +3 -4
- package/src/services/mapping.service.ts +25 -27
- package/src/services/rules.service.ts +3 -3
- package/src/transformers/as24.transformer.ts +3 -3
- package/src/transformers/mobile.transformer.ts +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/export-cars",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "bytebrand",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=14.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "76f936636e6e646ed55feb87f618d492d1cad69a"
|
|
68
68
|
}
|
|
@@ -8,5 +8,6 @@ export class AutoboerseConfig extends Config {
|
|
|
8
8
|
this.pathesConfig.localConvertedDirectory = 'resources/autoboerse-export';
|
|
9
9
|
this.imageUrl = `https://images.${this.url}/carimage`;
|
|
10
10
|
this.downloadImages = true;
|
|
11
|
+
this.mappingSpreadsheetTitle = 'mobile_yescar';
|
|
11
12
|
}
|
|
12
13
|
}
|
package/src/config/config.ts
CHANGED
|
@@ -32,6 +32,9 @@ export class Config {
|
|
|
32
32
|
cpc: string;
|
|
33
33
|
ownerId: string;
|
|
34
34
|
downloadImages: boolean;
|
|
35
|
+
googleSheetsApiKey: string;
|
|
36
|
+
mappingSpreadsheetId: string;
|
|
37
|
+
mappingSpreadsheetTitle: string;
|
|
35
38
|
|
|
36
39
|
protected environmentConfig = {
|
|
37
40
|
[Environment.LOCAL]: {
|
|
@@ -68,6 +71,8 @@ export class Config {
|
|
|
68
71
|
this.fileName = params.fileName || `${params.environment}_${params.exportType}`;
|
|
69
72
|
this.criteoId = this.environmentConfig[params.environment].criteoId;
|
|
70
73
|
this.url = this.environmentConfig[params.environment].url;
|
|
74
|
+
this.googleSheetsApiKey = params.googleSheetsApiKey;
|
|
75
|
+
this.mappingSpreadsheetId = '147qz9sTgs1wi13ua8YKa0IgfxAn1X_qH6LkGnAnzeyY';
|
|
71
76
|
this.userActionsUrl = `https://www.${this.url}/service/user-actions`;
|
|
72
77
|
this.imboUrl = `https://www.${this.url}/service/image-imbo`;
|
|
73
78
|
this.imageUrl = `https://images.${this.url}`;
|
package/src/export.command.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { Command, CommandRunner, InquirerService } from 'nest-commander';
|
|
2
2
|
import { ConfigService } from './services/config.service';
|
|
3
3
|
import { Input } from './interfaces/input.interface';
|
|
4
|
-
import { Logger } from '@nestjs/common';
|
|
5
4
|
import { exportSchema } from './export.schema';
|
|
6
5
|
import { ModuleRef } from '@nestjs/core';
|
|
7
6
|
import { Exporter } from './interfaces/exporter.interface';
|
|
7
|
+
import { LoggerService } from '@bytebrand/cronicle-helper';
|
|
8
8
|
|
|
9
9
|
@Command({
|
|
10
10
|
name: 'export',
|
|
11
11
|
options: { isDefault: true },
|
|
12
12
|
})
|
|
13
13
|
export class ExportRunner extends CommandRunner {
|
|
14
|
-
private readonly logger = new Logger();
|
|
15
|
-
|
|
16
14
|
constructor(
|
|
17
15
|
private readonly inquirer: InquirerService,
|
|
18
16
|
private configService: ConfigService,
|
|
@@ -24,7 +22,7 @@ export class ExportRunner extends CommandRunner {
|
|
|
24
22
|
async run(): Promise<void> {
|
|
25
23
|
const input = (await this.inquirer.ask<{ input: Input }>('input-questions', undefined)).input;
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
LoggerService.log(`Running job: ${input.id} - ${JSON.stringify(input)}\n`);
|
|
28
26
|
|
|
29
27
|
this.configService.config = new exportSchema[input.params.exportType].config(input.params);
|
|
30
28
|
const exporter = await this.moduleRef.create<Exporter>(exportSchema[input.params.exportType].exporter);
|
package/src/export.schema.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { As24Config } from './config/as24.config';
|
|
1
2
|
import { Auto24Config } from './config/auto24.config';
|
|
2
3
|
import { AutoboerseConfig } from './config/autoboerse.config';
|
|
3
4
|
import { AutouncleConfig } from './config/autouncle.config';
|
|
@@ -10,6 +11,7 @@ import { MeinstadtConfig } from './config/meinstadt.config';
|
|
|
10
11
|
import { OoyyoConfig } from './config/ooyyo.config';
|
|
11
12
|
import { YescarConfig } from './config/yescar.config';
|
|
12
13
|
import { ExportType } from './enums/export-type.enum';
|
|
14
|
+
import { As24Exporter } from './exporters/as24.exporter';
|
|
13
15
|
import { Auto24Exporter } from './exporters/auto24.exporter';
|
|
14
16
|
import { AutouncleExporter } from './exporters/autouncle.exporter';
|
|
15
17
|
import { ByOwnerExporter } from './exporters/by-owner.exporter';
|
|
@@ -64,4 +66,8 @@ export const exportSchema = {
|
|
|
64
66
|
config: AutouncleConfig,
|
|
65
67
|
exporter: AutouncleExporter,
|
|
66
68
|
},
|
|
69
|
+
[ExportType.AS24]: {
|
|
70
|
+
config: As24Config,
|
|
71
|
+
exporter: As24Exporter,
|
|
72
|
+
},
|
|
67
73
|
};
|
|
@@ -7,9 +7,11 @@ import { Injectable } from '@nestjs/common';
|
|
|
7
7
|
import { ModuleRef } from '@nestjs/core';
|
|
8
8
|
import { As24Transformer } from '../transformers/as24.transformer';
|
|
9
9
|
import { UserService } from '../services/user.service';
|
|
10
|
-
import { get } from 'lodash';
|
|
10
|
+
import { get, union } from 'lodash';
|
|
11
11
|
import { convertToCSV } from '../utils/converter.utils';
|
|
12
12
|
import { writeFile } from 'fs/promises';
|
|
13
|
+
import { normalize } from 'path';
|
|
14
|
+
import { Zipper } from '@bytebrand/zipper';
|
|
13
15
|
|
|
14
16
|
@Injectable()
|
|
15
17
|
export class As24Exporter implements Exporter {
|
|
@@ -31,6 +33,8 @@ export class As24Exporter implements Exporter {
|
|
|
31
33
|
descriptionSchemas[dealerId] = await this.userService.getDefaultSummaryByDealerId(dealerId);
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
const processedDealers = [];
|
|
37
|
+
|
|
34
38
|
await this.loaderService.process(async (chunk: FsChunkInterface) => {
|
|
35
39
|
if (chunk && chunk.data) {
|
|
36
40
|
for (let i = 0; i < chunk.data.length; i += 1) {
|
|
@@ -43,28 +47,28 @@ export class As24Exporter implements Exporter {
|
|
|
43
47
|
) {
|
|
44
48
|
const transformedData = await as24Transformer.transform(data.car, descriptionSchemas);
|
|
45
49
|
const transformedDataCSV = `${convertToCSV(transformedData)}\n`;
|
|
50
|
+
|
|
46
51
|
await writeFile(
|
|
47
52
|
`${this.configService.config.pathesConfig.localConvertedDirectory}/${ownerId}.csv`,
|
|
48
53
|
Buffer.from(transformedDataCSV),
|
|
49
54
|
{ flag: 'a' },
|
|
50
55
|
);
|
|
56
|
+
|
|
57
|
+
union([ownerId], processedDealers);
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
chunk.data = null;
|
|
54
61
|
}
|
|
55
62
|
});
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// if (await CronicleUtils.exists(fileCSV)) {
|
|
67
|
-
// await Zipper.zip({ fileList: [fileCSV], dest: fileZIP });
|
|
68
|
-
// }
|
|
64
|
+
for (const dealer of processedDealers) {
|
|
65
|
+
const now = new Date();
|
|
66
|
+
const d = `${now.getFullYear()}${now.getMonth() + 1}${now.getDate()}`;
|
|
67
|
+
const fileCSV = normalize(`${this.configService.config.pathesConfig.localConvertedDirectory}/${dealer}.csv`);
|
|
68
|
+
const fileZIP = normalize(`${this.configService.config.pathesConfig.localConvertedDirectory}/${d}_${dealer}.zip`);
|
|
69
|
+
if (await CronicleUtils.exists(fileCSV)) {
|
|
70
|
+
await Zipper.zip({ fileList: [fileCSV], dest: fileZIP });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
69
73
|
}
|
|
70
74
|
}
|
|
@@ -16,6 +16,7 @@ import { lastValueFrom } from 'rxjs';
|
|
|
16
16
|
import { createWriteStream } from 'fs';
|
|
17
17
|
import { get } from 'lodash';
|
|
18
18
|
import { RulesService } from '../services/rules.service';
|
|
19
|
+
import { pipeline } from 'stream/promises';
|
|
19
20
|
|
|
20
21
|
@Injectable()
|
|
21
22
|
export class MobileExporter implements Exporter {
|
|
@@ -93,7 +94,7 @@ export class MobileExporter implements Exporter {
|
|
|
93
94
|
responseType: 'stream',
|
|
94
95
|
}),
|
|
95
96
|
)
|
|
96
|
-
.then(
|
|
97
|
+
.then(({ data }) => {
|
|
97
98
|
const writer = createWriteStream(
|
|
98
99
|
join(
|
|
99
100
|
this.configService.config.pathesConfig.localConvertedDirectory,
|
|
@@ -101,9 +102,7 @@ export class MobileExporter implements Exporter {
|
|
|
101
102
|
`${vehicleId}_${index + 1}${extname(imageUrl) || '.jpg'}`,
|
|
102
103
|
),
|
|
103
104
|
);
|
|
104
|
-
|
|
105
|
-
writer.on('finish', resolve);
|
|
106
|
-
writer.on('error', reject);
|
|
105
|
+
pipeline(data, writer).then(resolve).catch(reject);
|
|
107
106
|
})
|
|
108
107
|
.catch(reject);
|
|
109
108
|
});
|
package/src/main.ts
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
|
+
import { LoggerService } from '@bytebrand/cronicle-helper';
|
|
1
2
|
import { CommandFactory } from 'nest-commander';
|
|
2
3
|
import { AppModule } from './app.module';
|
|
3
|
-
import { WinstonModule } from 'nest-winston';
|
|
4
|
-
import { transports as winstonTransports, format as winstonFormat } from 'winston';
|
|
5
4
|
|
|
6
5
|
async function bootstrap() {
|
|
6
|
+
// setInterval(() => {
|
|
7
|
+
// Object.entries(process.memoryUsage()).forEach(item =>
|
|
8
|
+
// console.log(`${item[0]}: ${(item[1] / 1024 / 1024).toFixed(4)} MB`),
|
|
9
|
+
// );
|
|
10
|
+
// console.log('\n');
|
|
11
|
+
// }, 10000);
|
|
7
12
|
try {
|
|
8
|
-
await CommandFactory.run(
|
|
9
|
-
|
|
10
|
-
WinstonModule.createLogger({
|
|
11
|
-
transports: [
|
|
12
|
-
new winstonTransports.Console({
|
|
13
|
-
format: winstonFormat.combine(
|
|
14
|
-
winstonFormat.splat(),
|
|
15
|
-
winstonFormat.simple(),
|
|
16
|
-
winstonFormat.colorize({ all: true }),
|
|
17
|
-
),
|
|
18
|
-
}),
|
|
19
|
-
],
|
|
20
|
-
}),
|
|
21
|
-
);
|
|
22
|
-
console.log({ complete: 1, code: 0 });
|
|
13
|
+
await CommandFactory.run(AppModule, console);
|
|
14
|
+
LoggerService.complete();
|
|
23
15
|
} catch (e) {
|
|
24
|
-
|
|
16
|
+
LoggerService.exitError(e.message || e);
|
|
25
17
|
}
|
|
26
18
|
}
|
|
27
|
-
|
|
28
19
|
bootstrap();
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { Injectable
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { AbstractChunkable, FsChunkInterface, Loaders } from '@bytebrand/chunkable';
|
|
3
3
|
import { ConfigService } from './config.service';
|
|
4
4
|
import { toNumber } from 'lodash';
|
|
5
|
+
import { LoggerService } from '@bytebrand/cronicle-helper';
|
|
5
6
|
|
|
6
7
|
@Injectable()
|
|
7
8
|
export class LoaderService {
|
|
8
|
-
private readonly logger = new Logger(LoaderService.name);
|
|
9
|
-
|
|
10
9
|
constructor(private configService: ConfigService) {}
|
|
11
10
|
|
|
12
11
|
private loader: AbstractChunkable;
|
|
@@ -20,7 +19,7 @@ export class LoaderService {
|
|
|
20
19
|
await fn(chunk);
|
|
21
20
|
|
|
22
21
|
const progress = (toNumber(chunk.id) + 1) / chunk.total;
|
|
23
|
-
|
|
22
|
+
LoggerService.progress(progress < 1 ? progress : 1);
|
|
24
23
|
});
|
|
25
24
|
|
|
26
25
|
this.loader.onError(reject);
|
|
@@ -1,47 +1,45 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { CronicleUtils } from '@bytebrand/cronicle-helper';
|
|
3
2
|
import { MappingRules } from '../interfaces/mapping-rules.interface';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { GoogleSpreadsheet, GoogleSpreadsheetRow } from 'google-spreadsheet';
|
|
4
|
+
import { ConfigService } from './config.service';
|
|
6
5
|
|
|
7
6
|
@Injectable()
|
|
8
7
|
export class MappingService {
|
|
9
|
-
constructor(private
|
|
8
|
+
constructor(private configService: ConfigService) {}
|
|
10
9
|
private rules: MappingRules[];
|
|
11
10
|
|
|
12
11
|
async getRules(): Promise<MappingRules[]> {
|
|
13
12
|
if (!this.rules) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
);
|
|
19
|
-
const rows: MappingRules[] = await CronicleUtils.parseCSV(data);
|
|
13
|
+
const spreadsheet = new GoogleSpreadsheet(this.configService.config.mappingSpreadsheetId);
|
|
14
|
+
spreadsheet.useApiKey(this.configService.config.googleSheetsApiKey);
|
|
15
|
+
await spreadsheet.loadInfo();
|
|
16
|
+
const rows = await spreadsheet.sheetsByTitle[this.configService.config.mappingSpreadsheetTitle].getRows();
|
|
17
|
+
const mappingRules = this.rowsToRules(rows);
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
this.removeEmptyKeys(
|
|
23
|
-
if (
|
|
24
|
-
this.groupSelectors(
|
|
19
|
+
mappingRules.map((rule, _i, selfRules) => {
|
|
20
|
+
this.removeEmptyKeys(rule);
|
|
21
|
+
if (rule.importFieldType && rule.importFieldType.includes('selector')) {
|
|
22
|
+
this.groupSelectors(rule, selfRules);
|
|
25
23
|
}
|
|
26
24
|
});
|
|
27
25
|
|
|
28
|
-
this.rules = this.filterResultedRows(
|
|
26
|
+
this.rules = this.filterResultedRows(mappingRules);
|
|
29
27
|
}
|
|
30
28
|
return this.rules;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
private rowsToRules(rows: GoogleSpreadsheetRow[]): MappingRules[] {
|
|
32
|
+
return rows.map(row =>
|
|
33
|
+
Object.assign(
|
|
34
|
+
{},
|
|
35
|
+
...Object.entries(Object.getOwnPropertyDescriptors(row))
|
|
36
|
+
.filter(([_key, descriptor]) => typeof descriptor.get === 'function')
|
|
37
|
+
.map(([key, descriptor]) => ({
|
|
38
|
+
[key]: descriptor.get() || '',
|
|
39
|
+
})),
|
|
40
|
+
),
|
|
41
|
+
);
|
|
42
|
+
}
|
|
45
43
|
|
|
46
44
|
private filterResultedRows(rows: MappingRules[]): MappingRules[] {
|
|
47
45
|
return rows.filter((value, idx, self) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LoggerService } from '@bytebrand/cronicle-helper';
|
|
2
|
+
import { Injectable } from '@nestjs/common';
|
|
2
3
|
import { concat, toSafeInteger, toString } from 'lodash';
|
|
3
4
|
import { DateRule } from '../rules/date.rule';
|
|
4
5
|
import { NumberRule } from '../rules/number.rule';
|
|
@@ -7,7 +8,6 @@ import { ConfigService } from './config.service';
|
|
|
7
8
|
|
|
8
9
|
@Injectable()
|
|
9
10
|
export class RulesService {
|
|
10
|
-
private readonly logger = new Logger(RulesService.name);
|
|
11
11
|
constructor(private configService: ConfigService) {}
|
|
12
12
|
|
|
13
13
|
private _rules: Array<StringRule | NumberRule | DateRule>;
|
|
@@ -42,7 +42,7 @@ export class RulesService {
|
|
|
42
42
|
});
|
|
43
43
|
return rulesArr;
|
|
44
44
|
} catch (error) {
|
|
45
|
-
|
|
45
|
+
LoggerService.error(error);
|
|
46
46
|
return rulesArr;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -3,11 +3,11 @@ import { DataSchemes } from '@bytebrand/car-schema';
|
|
|
3
3
|
import { CarDescriptionFactory, DescriptionTypeEnum } from '@bytebrand/car-description';
|
|
4
4
|
import { MappingService } from '../services/mapping.service';
|
|
5
5
|
import { MappingRules } from '../interfaces/mapping-rules.interface';
|
|
6
|
-
import { Injectable
|
|
6
|
+
import { Injectable } from '@nestjs/common';
|
|
7
|
+
import { LoggerService } from '@bytebrand/cronicle-helper';
|
|
7
8
|
|
|
8
9
|
@Injectable()
|
|
9
10
|
export class As24Transformer {
|
|
10
|
-
private readonly logger = new Logger(As24Transformer.name);
|
|
11
11
|
private currentCar: DataSchemes.Car;
|
|
12
12
|
private descriptionSchemas: unknown;
|
|
13
13
|
|
|
@@ -97,7 +97,7 @@ export class As24Transformer {
|
|
|
97
97
|
return this.selectorToCategoryOrClass_selector(fieldValue, rule);
|
|
98
98
|
}
|
|
99
99
|
default:
|
|
100
|
-
|
|
100
|
+
LoggerService.log(`missing transform: ${transformProcedureName}`);
|
|
101
101
|
break;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Injectable
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
2
|
import { DataSchemes } from '@bytebrand/car-schema';
|
|
3
3
|
import { get, isEmpty, isNil, set, toString, upperFirst } from 'lodash';
|
|
4
4
|
import { MappingService } from '../services/mapping.service';
|
|
@@ -7,12 +7,12 @@ import { UserService } from '../services/user.service';
|
|
|
7
7
|
import { CarDescriptionFactory, DescriptionTypeEnum } from '@bytebrand/car-description';
|
|
8
8
|
import { ConfigService } from '../services/config.service';
|
|
9
9
|
import { isNotEmptyArray } from '../utils/validator.utils';
|
|
10
|
+
import { LoggerService } from '@bytebrand/cronicle-helper';
|
|
10
11
|
|
|
11
12
|
const vinGenerator = require('vin-generator');
|
|
12
13
|
|
|
13
14
|
@Injectable()
|
|
14
15
|
export class MobileTransformer {
|
|
15
|
-
private readonly logger = new Logger(MobileTransformer.name);
|
|
16
16
|
private currentCar: DataSchemes.Car;
|
|
17
17
|
|
|
18
18
|
constructor(
|
|
@@ -107,7 +107,7 @@ export class MobileTransformer {
|
|
|
107
107
|
return this.selectorToCategoryOrClass_selector(fieldValue);
|
|
108
108
|
}
|
|
109
109
|
default:
|
|
110
|
-
|
|
110
|
+
LoggerService.log(`missing transform: ${transformProcedureName}`);
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -341,7 +341,7 @@ export class MobileTransformer {
|
|
|
341
341
|
try {
|
|
342
342
|
res = this.getImagesField(car._id, get(car, 'metaData.mainImageId', null), images);
|
|
343
343
|
} catch (e) {
|
|
344
|
-
|
|
344
|
+
LoggerService.error(e);
|
|
345
345
|
throw e;
|
|
346
346
|
}
|
|
347
347
|
let imagesAsALine;
|
|
@@ -438,7 +438,7 @@ export class MobileTransformer {
|
|
|
438
438
|
if (found) {
|
|
439
439
|
return `Car.${found}`;
|
|
440
440
|
} else {
|
|
441
|
-
|
|
441
|
+
LoggerService.log(`Missing mapping for: ${fieldValue}`);
|
|
442
442
|
return 'Car.OtherCar';
|
|
443
443
|
}
|
|
444
444
|
}
|