@bytebrand/export-cars 1.9.0 → 1.10.0
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 +4 -0
- package/dist/configs/config.js +5 -0
- package/dist/configs/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 +1 -0
- package/dist/configs/facebook-shop.config.js.map +1 -1
- package/dist/configs/fb.config.js +2 -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 +1 -1
- package/dist/export.command.js +2 -2
- 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.js +7 -5
- 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/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 +2 -2
- 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 +5 -0
- package/src/configs/dasparking.config.ts +2 -1
- package/src/configs/eauto.config.ts +3 -4
- package/src/configs/facebook-shop.config.ts +2 -1
- package/src/configs/fb.config.ts +3 -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 +1 -1
- 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 +7 -6
- 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/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.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "bytebrand",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"engines": {
|
|
67
67
|
"node": ">=14.0.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "37593dea01bef934aa28dee2dfc50c29fad9aeef"
|
|
70
70
|
}
|
|
@@ -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
|
+
marketingImageId: number;
|
|
8
9
|
upaUrl: string;
|
|
9
10
|
imboUrl: string;
|
|
10
11
|
imageUrl: string;
|
|
@@ -40,6 +41,7 @@ export class Config {
|
|
|
40
41
|
remoteDirectory: 'import_dev',
|
|
41
42
|
imageUrl: 'https://images.autode-dev.de/cache_test',
|
|
42
43
|
baseImageUrl: 'https://images.autode-dev.de',
|
|
44
|
+
marketingImageId: 8,
|
|
43
45
|
},
|
|
44
46
|
[Environment.DEVELOP]: {
|
|
45
47
|
domain: 'autode-dev.de',
|
|
@@ -48,6 +50,7 @@ export class Config {
|
|
|
48
50
|
remoteDirectory: 'import_dev',
|
|
49
51
|
imageUrl: 'https://images.autode-dev.de/cache_test',
|
|
50
52
|
baseImageUrl: 'https://images.autode-dev.de',
|
|
53
|
+
marketingImageId: 8,
|
|
51
54
|
},
|
|
52
55
|
[Environment.PRODUCTION]: {
|
|
53
56
|
domain: 'auto.de',
|
|
@@ -56,6 +59,7 @@ export class Config {
|
|
|
56
59
|
remoteDirectory: 'import',
|
|
57
60
|
imageUrl: 'https://images.auto.de/generated_images',
|
|
58
61
|
baseImageUrl: 'https://images.auto.de',
|
|
62
|
+
marketingImageId: 1,
|
|
59
63
|
},
|
|
60
64
|
};
|
|
61
65
|
|
|
@@ -65,6 +69,7 @@ export class Config {
|
|
|
65
69
|
this.cpc = params.cpc;
|
|
66
70
|
this.criteoMarketingImagesConfigId = this.environmentConfig[params.environment].criteoMarketingImagesConfigId;
|
|
67
71
|
this.domain = this.environmentConfig[params.environment].domain;
|
|
72
|
+
this.marketingImageId = this.environmentConfig[params.environment].marketingImageId;
|
|
68
73
|
this.baseImageUrl = this.environmentConfig[params.environment].baseImageUrl;
|
|
69
74
|
this.mappingSpreadsheetId = '147qz9sTgs1wi13ua8YKa0IgfxAn1X_qH6LkGnAnzeyY';
|
|
70
75
|
this.dealersSpreadsheetId = '1gWrcA-uRTpna1h66Mbe2Y7NA0tIhlUaQXBcS4a_UzOw';
|
|
@@ -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,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 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;
|
|
10
11
|
this.outputFiles = [
|
|
11
12
|
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.FACEBOOK_SHOP}.${FileType.XML}`,
|
|
12
13
|
];
|
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,9 @@ 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;
|
|
10
11
|
this.outputFiles = [
|
|
11
|
-
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.FB}.${FileType.XML}
|
|
12
|
+
`${this.pathesConfig.localConvertedDirectory}/api_export_cars_${ExportType.FB}.${FileType.XML}`,
|
|
12
13
|
];
|
|
13
14
|
}
|
|
14
15
|
}
|
|
@@ -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
2
|
import { Command, CommandRunner, InquirerService } from 'nest-commander';
|
|
3
|
-
import { ConfigService } from './services
|
|
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';
|
|
@@ -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 {
|
|
@@ -96,10 +96,10 @@ export class ImagesService {
|
|
|
96
96
|
const marketingImageConfigs = this.transform(configs);
|
|
97
97
|
|
|
98
98
|
const defImages = [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
'https://images.auto.de/carimage/noimage/7pNvWELuWhZX/large-cached.jpeg',
|
|
100
|
+
'https://images.auto.de/carimage/noimage/GvyXmrpaf1D6/large-cached.jpeg',
|
|
101
|
+
'https://images.auto.de/carimage/noimage/gY1zF8PXzH2W/large-cached.jpeg',
|
|
102
|
+
'https://images.auto.de/carimage/noimage/pFyfBsqBHEso/large-cached.jpeg',
|
|
103
103
|
];
|
|
104
104
|
|
|
105
105
|
const imageUrls = [];
|
|
@@ -123,8 +123,9 @@ export class ImagesService {
|
|
|
123
123
|
|
|
124
124
|
async getMarketingImageConfigs(): Promise<MarketingImageConfigsInterface> {
|
|
125
125
|
const configs = await this.userService.getMarketingImageConfigs();
|
|
126
|
-
const
|
|
127
|
-
|
|
126
|
+
const responseData = configs.find(config => config.channelCode.includes(this.configService.config.exportType));
|
|
127
|
+
let id;
|
|
128
|
+
!responseData?.id ? (id = this.configService.config.marketingImageId) : (id = responseData.id);
|
|
128
129
|
return this.userService.getMarketingImageConfig(id);
|
|
129
130
|
}
|
|
130
131
|
|
|
@@ -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
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { TranslatorExtended } from '@bytebrand/schema-tools';
|
|
2
2
|
import { de, deVehicleDetailsPage, deVehicleProps } from '@bytebrand/i18n-dictionaries';
|
|
3
|
-
import {
|
|
3
|
+
import {get, toString, isEmpty, toSafeInteger } from 'lodash';
|
|
4
4
|
import * as moment from 'moment';
|
|
5
5
|
import { DataSchemes } from '@bytebrand/car-schema';
|
|
6
6
|
import { DePostalCodesService } from '@bytebrand/car-basic-data-scope';
|
|
7
7
|
import { DePostalCodesEntryInterface } from '@bytebrand/car-basic-data-scope/dist/interfaces/DePostalCodesInterface';
|
|
8
|
+
|
|
8
9
|
import { ConfigService, ImagesService } from '../services';
|
|
9
10
|
import { Injectable } from '@nestjs/common';
|
|
10
11
|
import { DEFAULT_ADDR1, DEFAULT_CITY, DEFAULT_ZIP, MIN_MILEAGES } from '../constants/autouncle.contants';
|
|
@@ -34,7 +35,10 @@ export class AutouncleTransformer {
|
|
|
34
35
|
}): Promise<AutouncleJsonItem> {
|
|
35
36
|
const autodeId = toString(get(car, '_id', ''));
|
|
36
37
|
const address = await this.getAddress(car, owner);
|
|
37
|
-
|
|
38
|
+
const image_urls = await this.imageService.getImages(car, images, this.configService.config.imageType);
|
|
39
|
+
const transformed_images = image_urls.map(url => {
|
|
40
|
+
return { url };
|
|
41
|
+
});
|
|
38
42
|
return {
|
|
39
43
|
back_link: `https://www.${this.configService.config.domain}/search/vehicle/${autodeId}?source=classifieds&medium=cpc&campaign=autouncle`,
|
|
40
44
|
make: toString(get(car, 'mainData.make', '')),
|
|
@@ -61,7 +65,7 @@ export class AutouncleTransformer {
|
|
|
61
65
|
seller_name: 'auto.de',
|
|
62
66
|
seller_id: toString(get(car, 'metaData.ownerId', '')),
|
|
63
67
|
description: toString(get(car, 'offer.offerDescription', '')),
|
|
64
|
-
images:
|
|
68
|
+
images: transformed_images,
|
|
65
69
|
fuel_economy: toString(get(car, 'consumption.consumptionCombined', '')),
|
|
66
70
|
co2_emission: toString(get(car, 'environmentEmissions.co2', '')),
|
|
67
71
|
co2_effiency_class: toString(get(car, 'environmentEmissions.energyEfficiencyClass', '')),
|
|
@@ -229,10 +233,4 @@ export class AutouncleTransformer {
|
|
|
229
233
|
private has4WD(): string {
|
|
230
234
|
return '';
|
|
231
235
|
}
|
|
232
|
-
|
|
233
|
-
private getImagesField(car: DataSchemes.Car, images: ImboImageResponseInterface[]): { url: string }[] {
|
|
234
|
-
return this.imageService.getDefaultImages(car, images).map(url => {
|
|
235
|
-
return { url };
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
236
|
}
|
|
@@ -7,7 +7,7 @@ import { TranslatorExtended } from '@bytebrand/schema-tools';
|
|
|
7
7
|
import { DataSchemes } from '@bytebrand/car-schema';
|
|
8
8
|
|
|
9
9
|
import { FacebookShopItem } from '../interfaces';
|
|
10
|
-
import { ConfigService } from '../services';
|
|
10
|
+
import { ConfigService, ImagesService } from '../services';
|
|
11
11
|
import { Description } from '../interfaces/description.interface';
|
|
12
12
|
import { FbDescription } from './fb-description.transformer';
|
|
13
13
|
import { FbEquipment } from './fb-equipment.transformer';
|
|
@@ -16,12 +16,14 @@ import { FbEquipment } from './fb-equipment.transformer';
|
|
|
16
16
|
export class FacebookShopTransformer {
|
|
17
17
|
private translator: TranslatorExtended;
|
|
18
18
|
|
|
19
|
-
constructor(private readonly configService: ConfigService) {
|
|
19
|
+
constructor(private readonly configService: ConfigService, private readonly imageService: ImagesService) {
|
|
20
20
|
const dict = { ...de, ...deVehicleProps, ...deVehicleDetailsPage };
|
|
21
21
|
this.translator = new TranslatorExtended(dict);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
async transform({ car }: { car: DataSchemes.Car }): Promise<FacebookShopItem> {
|
|
24
|
+
async transform({ car, images }: { car: DataSchemes.Car; images: any }): Promise<FacebookShopItem> {
|
|
25
|
+
const imageLinks = await this.imageService.getImages(car, images, this.configService.config.imageType);
|
|
26
|
+
|
|
25
27
|
return {
|
|
26
28
|
id: { value: get(car, 'metaData.vehicleId'), isGoogle: true },
|
|
27
29
|
title: { value: this.getTitle(car), isGoogle: true },
|
|
@@ -30,9 +32,9 @@ export class FacebookShopTransformer {
|
|
|
30
32
|
condition: { value: this.getCondition(car), isGoogle: true },
|
|
31
33
|
price: { value: this.getPrice(car), isGoogle: true },
|
|
32
34
|
link: { value: this.getCarLink(car), isGoogle: true },
|
|
33
|
-
image_link: { value:
|
|
35
|
+
image_link: { value: imageLinks[0], isGoogle: true },
|
|
34
36
|
brand: { value: get(car, 'mainData.make', ''), isGoogle: true },
|
|
35
|
-
additional_image_link: { value:
|
|
37
|
+
additional_image_link: { value: imageLinks[0], isGoogle: false },
|
|
36
38
|
quantity_to_sell_on_facebook: { value: 1, isGoogle: true },
|
|
37
39
|
google_product_category: { value: '916', isGoogle: true },
|
|
38
40
|
sale_price: { value: this.getPrice(car), isGoogle: true },
|
|
@@ -83,12 +85,4 @@ export class FacebookShopTransformer {
|
|
|
83
85
|
private getDescription(car: DataSchemes.Car): Description[] {
|
|
84
86
|
return FbDescription.create(car, this.translator, new FbEquipment()).getDescriptionArray();
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
//todo: move to image service
|
|
88
|
-
private getImageLink(car: DataSchemes.Car): string {
|
|
89
|
-
const mainImageId = get(car, 'metaData.mainImageId', '');
|
|
90
|
-
return mainImageId
|
|
91
|
-
? `${this.configService.config.baseImageUrl}/carimage/${car._id}/${mainImageId}/large-cached.webp`
|
|
92
|
-
: `${this.configService.config.baseImageUrl}/carimage/noimage/7pNvWELuWhZX/large-cached.jpeg`;
|
|
93
|
-
}
|
|
94
88
|
}
|
|
@@ -63,6 +63,10 @@ export class FbTransformer {
|
|
|
63
63
|
const year = this.getYear(car);
|
|
64
64
|
const dealerInfo = this.getDealerItems(car);
|
|
65
65
|
const address = await this.getAddress(car, owner);
|
|
66
|
+
const image_links = await this.imagesService.getImages(car, images, ImageType.marketing);
|
|
67
|
+
const transformedImages = image_links.map(el => {
|
|
68
|
+
return { url: el };
|
|
69
|
+
});
|
|
66
70
|
|
|
67
71
|
return {
|
|
68
72
|
fb_page_id: '176306386132',
|
|
@@ -77,7 +81,7 @@ export class FbTransformer {
|
|
|
77
81
|
make: toString(get(car, 'mainData.make', '')),
|
|
78
82
|
model: toString(get(car, 'mainData.model', '')),
|
|
79
83
|
trim: this.getTrim(car),
|
|
80
|
-
image:
|
|
84
|
+
image: transformedImages,
|
|
81
85
|
year: toString(year),
|
|
82
86
|
mileage: {
|
|
83
87
|
value: this.getMileage(car),
|
|
@@ -282,14 +286,17 @@ export class FbTransformer {
|
|
|
282
286
|
},
|
|
283
287
|
};
|
|
284
288
|
}
|
|
289
|
+
|
|
285
290
|
private isEmptyLocation(location: DePostalCodesEntryInterface): boolean {
|
|
286
291
|
if (!location) return true;
|
|
287
292
|
return !location['Place Name'] || !(location.Latitude && location.Longitude);
|
|
288
293
|
}
|
|
294
|
+
|
|
289
295
|
private isEmptyAddress(address: unknown): boolean {
|
|
290
296
|
if (!address) return true;
|
|
291
297
|
return ['city', 'zip', 'country'].every((key: string) => isEmpty(address[key]));
|
|
292
298
|
}
|
|
299
|
+
|
|
293
300
|
private async getCoords(
|
|
294
301
|
car: DataSchemes.Car,
|
|
295
302
|
locationEntry: DePostalCodesEntryInterface,
|
|
@@ -325,6 +332,7 @@ export class FbTransformer {
|
|
|
325
332
|
}
|
|
326
333
|
return this.translator.translateVal(colorSelection);
|
|
327
334
|
}
|
|
335
|
+
|
|
328
336
|
private getInteriorColor(car: DataSchemes.Car): string {
|
|
329
337
|
let colorSelection = get(car, 'interior.interiorColor', 'other');
|
|
330
338
|
if (!colorSelection || colorSelection === 'selector_unknown') {
|
|
@@ -23,6 +23,7 @@ export class GoogleTransformer {
|
|
|
23
23
|
|
|
24
24
|
async transform({ car, images }: { car: DataSchemes.Car; images: Array<any> }): Promise<GoogleXmlItem> {
|
|
25
25
|
const carId = toString(get(car, '_id', ''));
|
|
26
|
+
const transformedImages = await this.imageService.getImages(car, images, this.configService.config.imageType);
|
|
26
27
|
|
|
27
28
|
return {
|
|
28
29
|
id: carId,
|
|
@@ -31,7 +32,7 @@ export class GoogleTransformer {
|
|
|
31
32
|
google_product_category: this.getBreadcrumbs(car),
|
|
32
33
|
product_type: this.getCategory(car),
|
|
33
34
|
link: this.getLink(car),
|
|
34
|
-
image_link:
|
|
35
|
+
image_link: transformedImages[0],
|
|
35
36
|
condition: this.mapState(car),
|
|
36
37
|
availability: this.getAvailability(car),
|
|
37
38
|
brand: get(car, 'mainData.make', ''),
|