@bytebrand/export-cars 1.9.0 → 1.10.1
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/configs/alleskralle.config.js +1 -0
- package/dist/configs/alleskralle.config.js.map +1 -1
- package/dist/configs/as24.config.js +1 -0
- package/dist/configs/as24.config.js.map +1 -1
- package/dist/configs/auto24.config.js +1 -0
- package/dist/configs/auto24.config.js.map +1 -1
- package/dist/configs/autoboerse.config.js +1 -0
- package/dist/configs/autoboerse.config.js.map +1 -1
- package/dist/configs/autouncle.config.js +1 -0
- package/dist/configs/autouncle.config.js.map +1 -1
- package/dist/configs/by-owner.config.js +1 -0
- package/dist/configs/by-owner.config.js.map +1 -1
- package/dist/configs/config.d.ts +3 -9
- package/dist/configs/config.js +3 -10
- package/dist/configs/config.js.map +1 -1
- package/dist/configs/criteo.config.js +1 -0
- package/dist/configs/criteo.config.js.map +1 -1
- package/dist/configs/dasparking.config.js +1 -0
- package/dist/configs/dasparking.config.js.map +1 -1
- package/dist/configs/eauto.config.js +2 -3
- package/dist/configs/eauto.config.js.map +1 -1
- package/dist/configs/facebook-shop.config.js +2 -0
- package/dist/configs/facebook-shop.config.js.map +1 -1
- package/dist/configs/fb.config.js +3 -1
- package/dist/configs/fb.config.js.map +1 -1
- package/dist/configs/google.config.js +2 -1
- package/dist/configs/google.config.js.map +1 -1
- package/dist/configs/marktde.config.js +2 -1
- package/dist/configs/marktde.config.js.map +1 -1
- package/dist/configs/meinstadt.config.js +1 -0
- package/dist/configs/meinstadt.config.js.map +1 -1
- package/dist/configs/yescar.config.js +1 -0
- package/dist/configs/yescar.config.js.map +1 -1
- package/dist/export.command.d.ts +3 -4
- package/dist/export.command.js +3 -6
- package/dist/export.command.js.map +1 -1
- package/dist/exporters/autouncle.exporter.js +0 -1
- package/dist/exporters/autouncle.exporter.js.map +1 -1
- package/dist/exporters/fb.exporter.js +3 -1
- package/dist/exporters/fb.exporter.js.map +1 -1
- package/dist/exporters/meinstadt.exporter.js +0 -1
- package/dist/exporters/meinstadt.exporter.js.map +1 -1
- package/dist/interfaces/export-item.interface.d.ts +5 -0
- package/dist/services/images.service.d.ts +3 -5
- package/dist/services/images.service.js +11 -25
- package/dist/services/images.service.js.map +1 -1
- package/dist/transformers/as24.transformer.d.ts +1 -2
- package/dist/transformers/as24.transformer.js +3 -4
- package/dist/transformers/as24.transformer.js.map +1 -1
- package/dist/transformers/auto24.transfomer.d.ts +1 -0
- package/dist/transformers/auto24.transfomer.js +15 -2
- package/dist/transformers/auto24.transfomer.js.map +1 -1
- package/dist/transformers/autouncle.transformer.d.ts +0 -1
- package/dist/transformers/autouncle.transformer.js +5 -6
- package/dist/transformers/autouncle.transformer.js.map +1 -1
- package/dist/transformers/by-owner.transformer.js +3 -14
- package/dist/transformers/by-owner.transformer.js.map +1 -1
- package/dist/transformers/facebook-shop.transformer.d.ts +5 -4
- package/dist/transformers/facebook-shop.transformer.js +8 -11
- package/dist/transformers/facebook-shop.transformer.js.map +1 -1
- package/dist/transformers/fb.transformer.js +5 -1
- package/dist/transformers/fb.transformer.js.map +1 -1
- package/dist/transformers/google.transformer.js +2 -2
- package/dist/transformers/google.transformer.js.map +1 -1
- package/dist/transformers/modix.transformer.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -9
- package/src/configs/alleskralle.config.ts +2 -1
- package/src/configs/as24.config.ts +2 -1
- package/src/configs/auto24.config.ts +2 -1
- package/src/configs/autoboerse.config.ts +2 -2
- package/src/configs/autouncle.config.ts +2 -1
- package/src/configs/by-owner.config.ts +4 -3
- package/src/configs/config.ts +3 -10
- package/src/configs/criteo.config.ts +1 -0
- package/src/configs/dasparking.config.ts +2 -1
- package/src/configs/eauto.config.ts +3 -4
- package/src/configs/facebook-shop.config.ts +3 -1
- package/src/configs/fb.config.ts +4 -2
- package/src/configs/google.config.ts +3 -2
- package/src/configs/marktde.config.ts +4 -3
- package/src/configs/meinstadt.config.ts +2 -1
- package/src/configs/yescar.config.ts +2 -1
- package/src/export.command.ts +2 -3
- package/src/exporters/autouncle.exporter.ts +7 -5
- package/src/exporters/fb.exporter.ts +3 -3
- package/src/exporters/meinstadt.exporter.ts +6 -4
- package/src/interfaces/export-item.interface.ts +5 -0
- package/src/services/images.service.ts +18 -31
- package/src/transformers/as24.transformer.ts +2 -3
- package/src/transformers/auto24.transfomer.ts +16 -2
- package/src/transformers/autouncle.transformer.ts +7 -9
- package/src/transformers/by-owner.transformer.ts +3 -16
- package/src/transformers/facebook-shop.transformer.ts +7 -13
- package/src/transformers/fb.transformer.ts +9 -1
- package/src/transformers/google.transformer.ts +2 -1
- package/src/transformers/modix.transformer.ts +3 -2
- package/d.json +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/export-cars",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "bytebrand",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -21,12 +21,10 @@
|
|
|
21
21
|
"@bytebrand/car-schema": "^3.12.24",
|
|
22
22
|
"@bytebrand/chunkable": "^5.13.2",
|
|
23
23
|
"@bytebrand/cronicle-helper": "^1.15.1",
|
|
24
|
-
"@bytebrand/fe-financing": "^5.4.3",
|
|
25
24
|
"@bytebrand/i18n-dictionaries": "^1.4.2",
|
|
26
25
|
"@bytebrand/import-helper": "^0.35.1",
|
|
27
26
|
"@bytebrand/schema-tools": "^3.13.24",
|
|
28
27
|
"@bytebrand/zipper": "^2.1.1",
|
|
29
|
-
"@nestjs/axios": "^0.1.0",
|
|
30
28
|
"@nestjs/common": "^9.0.0",
|
|
31
29
|
"@nestjs/core": "^9.0.0",
|
|
32
30
|
"bottleneck": "^2.19.5",
|
|
@@ -36,12 +34,8 @@
|
|
|
36
34
|
"lodash": "^4.17.21",
|
|
37
35
|
"moment": "^2.29.4",
|
|
38
36
|
"nest-commander": "^3.1.0",
|
|
39
|
-
"nest-winston": "^1.8.0",
|
|
40
37
|
"reflect-metadata": "^0.1.13",
|
|
41
|
-
"
|
|
42
|
-
"rxjs": "^7.2.0",
|
|
43
|
-
"vin-generator": "^1.0.1",
|
|
44
|
-
"winston": "^3.8.2"
|
|
38
|
+
"vin-generator": "^1.0.1"
|
|
45
39
|
},
|
|
46
40
|
"devDependencies": {
|
|
47
41
|
"@nestjs/cli": "^9.0.0",
|
|
@@ -66,5 +60,5 @@
|
|
|
66
60
|
"engines": {
|
|
67
61
|
"node": ">=14.0.0"
|
|
68
62
|
},
|
|
69
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "b3581108ff2e4747c41c6c69facbd8a599051940"
|
|
70
64
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Params } from '../interfaces/params.interface';
|
|
2
2
|
import { Config } from './config';
|
|
3
|
-
import { ExportType, FileType } from '../enums';
|
|
3
|
+
import { ExportType, FileType, ImageType } from '../enums';
|
|
4
4
|
|
|
5
5
|
export class AlleskralleConfig extends Config {
|
|
6
6
|
constructor(params: Params) {
|
|
7
7
|
super(params);
|
|
8
8
|
this.campaign = ExportType.ALLESKRALLE;
|
|
9
9
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.ALLESKRALLE}-export`;
|
|
10
|
+
this.imageType = ImageType.default;
|
|
10
11
|
this.outputFiles = [
|
|
11
12
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.ALLESKRALLE}.${FileType.XML}`,
|
|
12
13
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportType } from 'src/enums';
|
|
1
|
+
import { ExportType, ImageType } from 'src/enums';
|
|
2
2
|
import { Params } from '../interfaces/params.interface';
|
|
3
3
|
import { Config } from './config';
|
|
4
4
|
|
|
@@ -6,6 +6,7 @@ export class As24Config extends Config {
|
|
|
6
6
|
constructor(params: Params) {
|
|
7
7
|
super(params);
|
|
8
8
|
this.campaign = ExportType.AS24;
|
|
9
|
+
this.imageType = ImageType.default;
|
|
9
10
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.AS24}-export`;
|
|
10
11
|
this.mappingSpreadsheetTitle = 'mobile';
|
|
11
12
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Params } from '../interfaces/params.interface';
|
|
2
2
|
import { Config } from './config';
|
|
3
|
-
import { ExportType, FileType } from '../enums';
|
|
3
|
+
import { ExportType, FileType, ImageType } from '../enums';
|
|
4
4
|
|
|
5
5
|
export class Auto24Config extends Config {
|
|
6
6
|
constructor(params: Params) {
|
|
7
7
|
super(params);
|
|
8
8
|
this.campaign = ExportType.AUTO24;
|
|
9
|
+
this.imageType = ImageType.default;
|
|
9
10
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.AUTO24}-export`;
|
|
10
11
|
this.outputFiles = [
|
|
11
12
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.AUTO24}.${FileType.XML}`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportType, FileType } from 'src/enums';
|
|
1
|
+
import { ExportType, FileType, ImageType } from 'src/enums';
|
|
2
2
|
import { Params } from '../interfaces/params.interface';
|
|
3
3
|
import { Config } from './config';
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ export class AutoboerseConfig extends Config {
|
|
|
7
7
|
super(params);
|
|
8
8
|
this.campaign = ExportType.AUTOBOERSE;
|
|
9
9
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.AUTOBOERSE}-export`;
|
|
10
|
-
|
|
10
|
+
this.imageType = ImageType.default;
|
|
11
11
|
this.outputFiles = [
|
|
12
12
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.AUTOBOERSE}.${FileType.XML}`,
|
|
13
13
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportType, FileType } from 'src/enums';
|
|
1
|
+
import { ExportType, FileType, ImageType } from 'src/enums';
|
|
2
2
|
import { Params } from '../interfaces/params.interface';
|
|
3
3
|
import { Config } from './config';
|
|
4
4
|
|
|
@@ -6,6 +6,7 @@ export class AutouncleConfig extends Config {
|
|
|
6
6
|
constructor(params: Params) {
|
|
7
7
|
super(params);
|
|
8
8
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.AUTOUNCLE}-export`;
|
|
9
|
+
this.imageType = ImageType.default;
|
|
9
10
|
this.outputFiles = [
|
|
10
11
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.AUTOUNCLE}.${FileType.JSON}`,
|
|
11
12
|
];
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { ExportType } from 'src/enums';
|
|
1
|
+
import { ExportType, ImageType } from 'src/enums';
|
|
2
2
|
import { Params } from '../interfaces/params.interface';
|
|
3
3
|
import { Config } from './config';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* @deprecated
|
|
7
|
-
*/
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
8
8
|
export class ByOwnerConfig extends Config {
|
|
9
9
|
constructor(params: Params) {
|
|
10
10
|
super(params);
|
|
11
11
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.BY_OWNER}-export`;
|
|
12
|
+
this.imageType = ImageType.default;
|
|
12
13
|
}
|
|
13
14
|
}
|
package/src/configs/config.ts
CHANGED
|
@@ -5,6 +5,7 @@ export class Config {
|
|
|
5
5
|
apikey: string;
|
|
6
6
|
campaign: string;
|
|
7
7
|
userActionsUrl: string;
|
|
8
|
+
marketingImageConfigId: number;
|
|
8
9
|
upaUrl: string;
|
|
9
10
|
imboUrl: string;
|
|
10
11
|
imageUrl: string;
|
|
@@ -12,7 +13,6 @@ export class Config {
|
|
|
12
13
|
imageType: ImageType;
|
|
13
14
|
isNewCar: boolean;
|
|
14
15
|
isCriteo: boolean;
|
|
15
|
-
criteoMarketingImagesConfigId: number;
|
|
16
16
|
exportType: ExportType;
|
|
17
17
|
domain: string;
|
|
18
18
|
input: {
|
|
@@ -33,16 +33,9 @@ export class Config {
|
|
|
33
33
|
dealersSpreadsheetTitle: string;
|
|
34
34
|
|
|
35
35
|
protected environmentConfig = {
|
|
36
|
-
[Environment.LOCAL]: {
|
|
37
|
-
domain: 'autode-dev.de',
|
|
38
|
-
criteoMarketingImagesConfigId: 12,
|
|
39
|
-
localConvertedDirectory: 'resources/csv_dev',
|
|
40
|
-
remoteDirectory: 'import_dev',
|
|
41
|
-
imageUrl: 'https://images.autode-dev.de/cache_test',
|
|
42
|
-
baseImageUrl: 'https://images.autode-dev.de',
|
|
43
|
-
},
|
|
44
36
|
[Environment.DEVELOP]: {
|
|
45
37
|
domain: 'autode-dev.de',
|
|
38
|
+
fbMarketingImageId: 8,
|
|
46
39
|
criteoMarketingImagesConfigId: 12,
|
|
47
40
|
localConvertedDirectory: 'resources/csv_dev',
|
|
48
41
|
remoteDirectory: 'import_dev',
|
|
@@ -51,6 +44,7 @@ export class Config {
|
|
|
51
44
|
},
|
|
52
45
|
[Environment.PRODUCTION]: {
|
|
53
46
|
domain: 'auto.de',
|
|
47
|
+
fbMarketingImageId: 1,
|
|
54
48
|
criteoMarketingImagesConfigId: 3,
|
|
55
49
|
localConvertedDirectory: 'resources/csv_prod',
|
|
56
50
|
remoteDirectory: 'import',
|
|
@@ -63,7 +57,6 @@ export class Config {
|
|
|
63
57
|
this.apikey = params.apikey;
|
|
64
58
|
this.exportType = params.exportType;
|
|
65
59
|
this.cpc = params.cpc;
|
|
66
|
-
this.criteoMarketingImagesConfigId = this.environmentConfig[params.environment].criteoMarketingImagesConfigId;
|
|
67
60
|
this.domain = this.environmentConfig[params.environment].domain;
|
|
68
61
|
this.baseImageUrl = this.environmentConfig[params.environment].baseImageUrl;
|
|
69
62
|
this.mappingSpreadsheetId = '147qz9sTgs1wi13ua8YKa0IgfxAn1X_qH6LkGnAnzeyY';
|
|
@@ -8,6 +8,7 @@ export class CriteoConfig extends Config {
|
|
|
8
8
|
this.campaign = ExportType.CRITEO;
|
|
9
9
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.CRITEO}-export`;
|
|
10
10
|
this.imageType = ImageType.marketing;
|
|
11
|
+
this.marketingImageConfigId = this.environmentConfig[params.environment].criteoMarketingImagesConfigId;
|
|
11
12
|
this.outputFiles = [
|
|
12
13
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.CRITEO}.${FileType.XML}`,
|
|
13
14
|
];
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Params } from '../interfaces/params.interface';
|
|
2
2
|
import { Config } from './config';
|
|
3
|
-
import { ExportType, FileType } from '../enums';
|
|
3
|
+
import { ExportType, FileType, ImageType } from '../enums';
|
|
4
4
|
|
|
5
5
|
export class DasparkingConfig extends Config {
|
|
6
6
|
constructor(params: Params) {
|
|
7
7
|
super(params);
|
|
8
8
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.DASPARKING}-export`;
|
|
9
9
|
this.campaign = ExportType.DASPARKING;
|
|
10
|
+
this.imageType = ImageType.default;
|
|
10
11
|
this.outputFiles = [
|
|
11
12
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.DASPARKING}.${FileType.XML}`,
|
|
12
13
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportType, FileType } from 'src/enums';
|
|
1
|
+
import { ExportType, FileType, ImageType } from 'src/enums';
|
|
2
2
|
import { Params } from '../interfaces/params.interface';
|
|
3
3
|
import { Config } from './config';
|
|
4
4
|
|
|
@@ -9,8 +9,7 @@ export class EautoConfig extends Config {
|
|
|
9
9
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.EAUTO}-export`;
|
|
10
10
|
this.imageUrl = `https://images.${this.domain}/carimage`;
|
|
11
11
|
this.mappingSpreadsheetTitle = 'mobile_yescar';
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
]
|
|
12
|
+
this.imageType = ImageType.default;
|
|
13
|
+
this.outputFiles = [`${this.pathesConfig.localConvertedDirectory}/416.${FileType.CSV}`];
|
|
15
14
|
}
|
|
16
15
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Params } from '../interfaces/params.interface';
|
|
2
2
|
import { Config } from './config';
|
|
3
|
-
import { ExportType, FileType } from '../enums';
|
|
3
|
+
import { ExportType, FileType, ImageType } from '../enums';
|
|
4
4
|
|
|
5
5
|
export class FacebookShopConfig extends Config {
|
|
6
6
|
constructor(params: Params) {
|
|
7
7
|
super(params);
|
|
8
8
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.FACEBOOK_SHOP}-export`;
|
|
9
9
|
this.imageUrl = this.environmentConfig[params.environment].baseImageUrl;
|
|
10
|
+
this.imageType = ImageType.marketing;
|
|
11
|
+
this.marketingImageConfigId = this.environmentConfig[params.environment].fbMarketingImageId;
|
|
10
12
|
this.outputFiles = [
|
|
11
13
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.FACEBOOK_SHOP}.${FileType.XML}`,
|
|
12
14
|
];
|
package/src/configs/fb.config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportType, FileType } from 'src/enums';
|
|
1
|
+
import { ExportType, FileType, ImageType } from 'src/enums';
|
|
2
2
|
import { Params } from '../interfaces/params.interface';
|
|
3
3
|
import { Config } from './config';
|
|
4
4
|
|
|
@@ -7,8 +7,10 @@ export class FbConfig extends Config {
|
|
|
7
7
|
super(params);
|
|
8
8
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.FB}-export`;
|
|
9
9
|
this.imageUrl = this.environmentConfig[params.environment].imageUrl;
|
|
10
|
+
this.imageType = ImageType.marketing;
|
|
11
|
+
this.marketingImageConfigId = this.environmentConfig[params.environment].fbMarketingImageId;
|
|
10
12
|
this.outputFiles = [
|
|
11
|
-
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.FB}.${FileType.XML}
|
|
13
|
+
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.FB}.${FileType.XML}`,
|
|
12
14
|
];
|
|
13
15
|
}
|
|
14
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportType, FileType } from 'src/enums';
|
|
1
|
+
import { ExportType, FileType, ImageType } from 'src/enums';
|
|
2
2
|
import { Params } from '../interfaces/params.interface';
|
|
3
3
|
import { Config } from './config';
|
|
4
4
|
|
|
@@ -6,8 +6,9 @@ export class GoogleConfig extends Config {
|
|
|
6
6
|
constructor(params: Params) {
|
|
7
7
|
super(params);
|
|
8
8
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.GOOGLE}-export`;
|
|
9
|
+
this.imageType = ImageType.default;
|
|
9
10
|
this.outputFiles = [
|
|
10
|
-
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.GOOGLE}.${FileType.XML}
|
|
11
|
+
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.GOOGLE}.${FileType.XML}`,
|
|
11
12
|
];
|
|
12
13
|
}
|
|
13
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportType, FileType } from 'src/enums';
|
|
1
|
+
import { ExportType, FileType, ImageType } from 'src/enums';
|
|
2
2
|
import { Params } from '../interfaces/params.interface';
|
|
3
3
|
import { Config } from './config';
|
|
4
4
|
|
|
@@ -9,9 +9,10 @@ export class MarktdeConfig extends Config {
|
|
|
9
9
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.MARKTDE}-export`;
|
|
10
10
|
this.imageUrl = `https://images.${this.domain}/carimage`;
|
|
11
11
|
this.mappingSpreadsheetTitle = 'mobile_yescar';
|
|
12
|
+
this.imageType = ImageType.default;
|
|
12
13
|
this.outputFiles = [
|
|
13
14
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.MARKTDE}.${FileType.CSV}`,
|
|
14
|
-
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.MARKTDE}.${FileType.ZIP}
|
|
15
|
-
]
|
|
15
|
+
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.MARKTDE}.${FileType.ZIP}`,
|
|
16
|
+
];
|
|
16
17
|
}
|
|
17
18
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Params } from '../interfaces/params.interface';
|
|
2
2
|
import { Config } from './config';
|
|
3
|
-
import { ExportType, FileType } from '../enums';
|
|
3
|
+
import { ExportType, FileType, ImageType } from '../enums';
|
|
4
4
|
|
|
5
5
|
export class MeinstadtConfig extends Config {
|
|
6
6
|
constructor(params: Params) {
|
|
7
7
|
super(params);
|
|
8
8
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.MEINSTADT}-export`;
|
|
9
|
+
this.imageType = ImageType.default;
|
|
9
10
|
this.outputFiles = [
|
|
10
11
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.MEINSTADT}.${FileType.JSON}`,
|
|
11
12
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.MEINSTADT}.${FileType.ZIP}`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExportType } from 'src/enums';
|
|
1
|
+
import { ExportType, ImageType } from 'src/enums';
|
|
2
2
|
import { Params } from '../interfaces/params.interface';
|
|
3
3
|
import { Config } from './config';
|
|
4
4
|
|
|
@@ -12,5 +12,6 @@ export class YescarConfig extends Config {
|
|
|
12
12
|
this.pathesConfig.localConvertedDirectory = `resources/${ExportType.YESCAR}-export`;
|
|
13
13
|
this.imageUrl = `https://images.${this.domain}/carimage`;
|
|
14
14
|
this.mappingSpreadsheetTitle = 'mobile_yescar';
|
|
15
|
+
this.imageType = ImageType.default;
|
|
15
16
|
}
|
|
16
17
|
}
|
package/src/export.command.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createInterface } from 'readline';
|
|
2
|
-
import { Command, CommandRunner
|
|
3
|
-
import { ConfigService } from './services
|
|
2
|
+
import { Command, CommandRunner } from 'nest-commander';
|
|
3
|
+
import { ConfigService } from './services';
|
|
4
4
|
import { Input } from './interfaces/input.interface';
|
|
5
5
|
import { exportSchema } from './export.schema';
|
|
6
6
|
import { ModuleRef } from '@nestjs/core';
|
|
@@ -13,7 +13,6 @@ import { LoggerService } from '@bytebrand/cronicle-helper';
|
|
|
13
13
|
})
|
|
14
14
|
export class ExportRunner extends CommandRunner {
|
|
15
15
|
constructor(
|
|
16
|
-
private readonly inquirer: InquirerService,
|
|
17
16
|
private configService: ConfigService,
|
|
18
17
|
private moduleRef: ModuleRef,
|
|
19
18
|
) {
|
|
@@ -19,7 +19,7 @@ export class AutouncleExporter implements Exporter {
|
|
|
19
19
|
private loaderService: LoaderService,
|
|
20
20
|
private rulesService: RulesService,
|
|
21
21
|
private moduleRef: ModuleRef,
|
|
22
|
-
) {
|
|
22
|
+
) {}
|
|
23
23
|
|
|
24
24
|
async export(): Promise<void> {
|
|
25
25
|
const [fileName] = this.configService.config.outputFiles;
|
|
@@ -28,12 +28,12 @@ export class AutouncleExporter implements Exporter {
|
|
|
28
28
|
|
|
29
29
|
const autouncleJsonBuilder = new AutouncleJsonBuilder(fileName);
|
|
30
30
|
await autouncleJsonBuilder.buildStart();
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
const autouncleTransformer = await this.moduleRef.create(AutouncleTransformer);
|
|
33
33
|
|
|
34
34
|
let firstCar = true;
|
|
35
35
|
await this.loaderService.process(async (chunk: FsChunkInterface) => {
|
|
36
|
-
chunk.data = chunk.data.filter(e => this.carService.filterCar(e, this.rulesService.rules));
|
|
36
|
+
// chunk.data = chunk.data.filter(e => this.carService.filterCar(e, this.rulesService.rules));
|
|
37
37
|
|
|
38
38
|
for (const data of chunk.data) {
|
|
39
39
|
const ownerId = get(data.car, 'metaData.ownerId');
|
|
@@ -43,8 +43,10 @@ export class AutouncleExporter implements Exporter {
|
|
|
43
43
|
await autouncleJsonBuilder.addItem(car, firstCar);
|
|
44
44
|
|
|
45
45
|
this.carService.counter.countCar(data.images);
|
|
46
|
-
|
|
47
|
-
if (firstCar) {
|
|
46
|
+
|
|
47
|
+
if (firstCar) {
|
|
48
|
+
firstCar = false;
|
|
49
|
+
}
|
|
48
50
|
}
|
|
49
51
|
});
|
|
50
52
|
|
|
@@ -30,9 +30,9 @@ export class FbExporter implements Exporter {
|
|
|
30
30
|
const fbTransformer = await this.moduleRef.create(FbTransformer);
|
|
31
31
|
|
|
32
32
|
await this.loaderService.process(async (chunk: FsChunkInterface) => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
for (const data of
|
|
33
|
+
const chunkData = chunk.data.filter(car => this.carService.filterCar(car, this.rulesService.rules));
|
|
34
|
+
chunk.data = null;
|
|
35
|
+
for (const data of chunkData) {
|
|
36
36
|
const ownerId = get(data.car, 'metaData.ownerId', null);
|
|
37
37
|
const owner = await this.carService.getOwner(ownerId);
|
|
38
38
|
const car = await fbTransformer.transform({ owner, ...data });
|
|
@@ -8,7 +8,7 @@ import { Zipper } from '@bytebrand/zipper';
|
|
|
8
8
|
import { CarService, RulesService, LoaderService, ConfigService } from '../services';
|
|
9
9
|
import { MeinstadtTransformer } from '../transformers/meinstadt.transformer';
|
|
10
10
|
import { MeinstadtJsonBuilder } from '../formats/meinstadt-json.builder';
|
|
11
|
-
import { MeinstadtJsonItem } from '../interfaces
|
|
11
|
+
import { MeinstadtJsonItem } from '../interfaces';
|
|
12
12
|
import { Exporter } from '../interfaces/exporter.interface';
|
|
13
13
|
|
|
14
14
|
@Injectable()
|
|
@@ -19,7 +19,7 @@ export class MeinstadtExporter implements Exporter {
|
|
|
19
19
|
private rulesService: RulesService,
|
|
20
20
|
private loaderService: LoaderService,
|
|
21
21
|
private moduleRef: ModuleRef,
|
|
22
|
-
) {
|
|
22
|
+
) {}
|
|
23
23
|
|
|
24
24
|
async export(): Promise<void> {
|
|
25
25
|
const [fileJson, fileGZ] = this.configService.config.outputFiles;
|
|
@@ -33,14 +33,16 @@ export class MeinstadtExporter implements Exporter {
|
|
|
33
33
|
|
|
34
34
|
let firstCar = true;
|
|
35
35
|
await this.loaderService.process(async (chunk: FsChunkInterface) => {
|
|
36
|
-
chunk.data = chunk.data.filter(e => this.carService.filterCar(e, this.rulesService.rules));
|
|
36
|
+
// chunk.data = chunk.data.filter(e => this.carService.filterCar(e, this.rulesService.rules));
|
|
37
37
|
|
|
38
38
|
for (const data of chunk.data) {
|
|
39
39
|
const car = await meinstadtTransformer.transform({ ...data });
|
|
40
40
|
await meinstadtJsonBuilder.addItem(car as MeinstadtJsonItem, firstCar);
|
|
41
41
|
this.carService.counter.countCar(data.images);
|
|
42
42
|
|
|
43
|
-
if (firstCar) {
|
|
43
|
+
if (firstCar) {
|
|
44
|
+
firstCar = false;
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
47
|
});
|
|
46
48
|
|
|
@@ -56,6 +56,11 @@ export interface Auto24XmlItem {
|
|
|
56
56
|
companyname: string;
|
|
57
57
|
extras: string;
|
|
58
58
|
sellertype: string;
|
|
59
|
+
condition: string;
|
|
60
|
+
dealer_homepage_url: string;
|
|
61
|
+
dealer_email: string;
|
|
62
|
+
dealer_name: string;
|
|
63
|
+
dealer_phone: string;
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
export interface OoyyoXmlItem extends FbXmlItem {
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import { get, toString } from 'lodash';
|
|
2
|
+
|
|
1
3
|
import { Injectable } from '@nestjs/common';
|
|
2
|
-
|
|
4
|
+
|
|
5
|
+
import { MarketingImageConfigsInterface } from '@bytebrand/autode-request';
|
|
3
6
|
import { ImboImageResponseInterface } from '@bytebrand/chunkable';
|
|
4
|
-
import {
|
|
7
|
+
import { DataSchemes } from '@bytebrand/car-schema';
|
|
8
|
+
|
|
9
|
+
import { FB_MAX_IMAGE_COUNT_FOR_DEAFULT } from '../constants/fb.constants';
|
|
5
10
|
import { isNotEmptyArray } from '../utils/validator.utils';
|
|
6
11
|
import { ConfigService } from './config.service';
|
|
7
|
-
import { ImageType } from '../enums';
|
|
8
|
-
import { MarketingImageConfigInterface, MarketingImageConfigsInterface } from '@bytebrand/autode-request';
|
|
9
12
|
import { UserService } from './user.service';
|
|
10
|
-
import {
|
|
13
|
+
import { ImageType } from '../enums';
|
|
11
14
|
|
|
12
15
|
@Injectable()
|
|
13
16
|
export class ImagesService {
|
|
14
|
-
constructor(private readonly configService: ConfigService, private readonly userService: UserService) {}
|
|
17
|
+
constructor(private readonly configService: ConfigService, private readonly userService: UserService) { }
|
|
15
18
|
|
|
16
19
|
async getImages(
|
|
17
20
|
car: DataSchemes.Car,
|
|
@@ -74,7 +77,7 @@ export class ImagesService {
|
|
|
74
77
|
|
|
75
78
|
const carId = toString(get(car, '_id', ''));
|
|
76
79
|
|
|
77
|
-
const transformedImages = this.generateImageLinks(images, carId);
|
|
80
|
+
const transformedImages = this.generateImageLinks(images.filter(i => i), carId);
|
|
78
81
|
if (transformedImages.length < 17) {
|
|
79
82
|
transformedImages.push(...defaultImages);
|
|
80
83
|
}
|
|
@@ -90,16 +93,15 @@ export class ImagesService {
|
|
|
90
93
|
async getMarketingImages(images: any, carId: string): Promise<string[]> {
|
|
91
94
|
const imageUrl = this.configService.config.imageUrl;
|
|
92
95
|
const transformedImages = this.transformImagesArrayIntoObject(images);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const marketingImageConfigs = this.transform(configs);
|
|
96
|
+
|
|
97
|
+
const config = await this.userService.getMarketingImageConfig(this.configService.config.marketingImageConfigId);
|
|
98
|
+
const marketingImageConfigs = config.marketingImages.map(i => ({ marketingImageCodes: i.imageCodes }));
|
|
97
99
|
|
|
98
100
|
const defImages = [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
'https://images.auto.de/carimage/noimage/7pNvWELuWhZX/large-cached.jpeg',
|
|
102
|
+
'https://images.auto.de/carimage/noimage/GvyXmrpaf1D6/large-cached.jpeg',
|
|
103
|
+
'https://images.auto.de/carimage/noimage/gY1zF8PXzH2W/large-cached.jpeg',
|
|
104
|
+
'https://images.auto.de/carimage/noimage/pFyfBsqBHEso/large-cached.jpeg',
|
|
103
105
|
];
|
|
104
106
|
|
|
105
107
|
const imageUrls = [];
|
|
@@ -110,7 +112,7 @@ export class ImagesService {
|
|
|
110
112
|
const imageCode = marketingImage.marketingImageCodes[i];
|
|
111
113
|
const imageId = transformedImages[imageCode];
|
|
112
114
|
if (imageId) {
|
|
113
|
-
imageUrls.push(this.getImagePathWithExtenstion(imageUrl, carId, imageId,
|
|
115
|
+
imageUrls.push(this.getImagePathWithExtenstion(imageUrl, carId, imageId, config));
|
|
114
116
|
break;
|
|
115
117
|
}
|
|
116
118
|
}
|
|
@@ -121,13 +123,6 @@ export class ImagesService {
|
|
|
121
123
|
return imageUrls;
|
|
122
124
|
}
|
|
123
125
|
|
|
124
|
-
async getMarketingImageConfigs(): Promise<MarketingImageConfigsInterface> {
|
|
125
|
-
const configs = await this.userService.getMarketingImageConfigs();
|
|
126
|
-
const { id } = configs.find(config => config.channelCode.includes(this.configService.config.exportType));
|
|
127
|
-
|
|
128
|
-
return this.userService.getMarketingImageConfig(id);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
126
|
private transformImagesArrayIntoObject(images: { [imageCode: string]: string }[]) {
|
|
132
127
|
const result: { [imageCode: string]: string } = {};
|
|
133
128
|
images.forEach(image => {
|
|
@@ -137,14 +132,6 @@ export class ImagesService {
|
|
|
137
132
|
return result;
|
|
138
133
|
}
|
|
139
134
|
|
|
140
|
-
private transform(config: MarketingImageConfigInterface): { marketingImageCodes: string[] }[] {
|
|
141
|
-
return config.marketingImages.map(marketingImage => {
|
|
142
|
-
return {
|
|
143
|
-
marketingImageCodes: marketingImage.imageCodes,
|
|
144
|
-
};
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
135
|
protected getChannelPath(imageUrl: string, carId: string): string {
|
|
149
136
|
return `${imageUrl}/${[carId[0], carId[1], carId[2], carId].join('/')}`;
|
|
150
137
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { get, isEmpty, isNil, set, toNumber, toSafeInteger, upperFirst } from 'lodash';
|
|
2
2
|
import { DataSchemes } from '@bytebrand/car-schema';
|
|
3
3
|
import { CarDescriptionFactory, DescriptionTypeEnum } from '@bytebrand/car-description';
|
|
4
|
-
import { MappingService } from '../services
|
|
4
|
+
import { MappingService, UserService } from '../services';
|
|
5
5
|
import { MappingRules } from '../interfaces/mapping-rules.interface';
|
|
6
6
|
import { Injectable } from '@nestjs/common';
|
|
7
7
|
import { LoggerService } from '@bytebrand/cronicle-helper';
|
|
8
|
-
import { UserService } from '../services';
|
|
9
8
|
|
|
10
9
|
@Injectable()
|
|
11
10
|
export class As24Transformer {
|
|
@@ -114,7 +113,7 @@ export class As24Transformer {
|
|
|
114
113
|
|
|
115
114
|
protected numberToNumber(field: number): number {
|
|
116
115
|
const result = isNil(field) ? null : toNumber(field);
|
|
117
|
-
return
|
|
116
|
+
return result < 0 || isNaN(result) ? undefined : result;
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
protected numberToInteger(field: number): number {
|
|
@@ -8,7 +8,6 @@ import { Auto24XmlItem } from '../interfaces';
|
|
|
8
8
|
import { Injectable } from '@nestjs/common';
|
|
9
9
|
import { ConfigService, ImagesService } from '../services';
|
|
10
10
|
import { isNotEmptyArray } from '../utils/validator.utils';
|
|
11
|
-
import { ImageType } from '../enums';
|
|
12
11
|
|
|
13
12
|
@Injectable()
|
|
14
13
|
export class Auto24Transformer {
|
|
@@ -20,7 +19,7 @@ export class Auto24Transformer {
|
|
|
20
19
|
|
|
21
20
|
async transform(car: DataSchemes.Car, imboImages: ImboImageResponseInterface[]): Promise<Auto24XmlItem> {
|
|
22
21
|
const carId = toString(get(car, '_id', ''));
|
|
23
|
-
const transformedImages = await this.imageService.getImages(car, imboImages,
|
|
22
|
+
const transformedImages = await this.imageService.getImages(car, imboImages, this.configService.config.imageType);
|
|
24
23
|
let userlink = `https://www.${this.configService.config.domain}/search/vehicle/${carId}`;
|
|
25
24
|
if (this.configService.config.campaign) {
|
|
26
25
|
userlink += `?source=classifieds&medium=listing&campaign=${this.configService.config.campaign}`;
|
|
@@ -49,6 +48,11 @@ export class Auto24Transformer {
|
|
|
49
48
|
companyname: 'www.auto.de',
|
|
50
49
|
extras: this.getExtrasField(car),
|
|
51
50
|
sellertype: 'dealer',
|
|
51
|
+
condition: this.getCondition(car),
|
|
52
|
+
dealer_homepage_url: 'https://www.auto.de',
|
|
53
|
+
dealer_email: ' auto@auto.de',
|
|
54
|
+
dealer_name: ' Auto.de',
|
|
55
|
+
dealer_phone: '+498004030182',
|
|
52
56
|
};
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -133,4 +137,14 @@ export class Auto24Transformer {
|
|
|
133
137
|
})
|
|
134
138
|
.join(', ');
|
|
135
139
|
}
|
|
140
|
+
|
|
141
|
+
private getCondition(car: DataSchemes.Car): string {
|
|
142
|
+
const available = {
|
|
143
|
+
selector_condition_new: 'Neu',
|
|
144
|
+
selector_condition_used: 'Gebraucht',
|
|
145
|
+
selector_unknown: 'Gebraucht',
|
|
146
|
+
};
|
|
147
|
+
const condition = get(car, 'mainData.condition', 'selector_unknown');
|
|
148
|
+
return get(available, condition);
|
|
149
|
+
}
|
|
136
150
|
}
|