@bytebrand/export-cars 1.2.2 → 1.3.2
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/README.md +0 -1
- package/dist/config/autoborse.config.d.ts +5 -0
- package/dist/config/autoborse.config.js +15 -0
- package/dist/config/autoborse.config.js.map +1 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +18 -0
- package/dist/config/index.js.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +18 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/modix/body-color-name.constant.d.ts +2 -0
- package/dist/constants/modix/body-color-name.constant.js +22 -0
- package/dist/constants/modix/body-color-name.constant.js.map +1 -0
- package/dist/constants/modix/category.constant.d.ts +2 -0
- package/dist/constants/modix/category.constant.js +14 -0
- package/dist/constants/modix/category.constant.js.map +1 -0
- package/dist/constants/modix/fuel.constant.d.ts +2 -0
- package/dist/constants/modix/fuel.constant.js +16 -0
- package/dist/constants/modix/fuel.constant.js.map +1 -0
- package/dist/constants/modix/index.d.ts +6 -0
- package/dist/constants/modix/index.js +23 -0
- package/dist/constants/modix/index.js.map +1 -0
- package/dist/constants/modix/manufacturers.constant.d.ts +4 -0
- package/dist/constants/modix/manufacturers.constant.js +7502 -0
- package/dist/constants/modix/manufacturers.constant.js.map +1 -0
- package/dist/constants/modix/transmission.constant.d.ts +2 -0
- package/dist/constants/modix/transmission.constant.js +10 -0
- package/dist/constants/modix/transmission.constant.js.map +1 -0
- package/dist/constants/modix/usage-type.constant.d.ts +3 -0
- package/dist/constants/modix/usage-type.constant.js +14 -0
- package/dist/constants/modix/usage-type.constant.js.map +1 -0
- package/dist/constants/modix/vehicle-class.constant.d.ts +2 -0
- package/dist/constants/modix/vehicle-class.constant.js +19 -0
- package/dist/constants/modix/vehicle-class.constant.js.map +1 -0
- package/dist/enums/export-type.enum.d.ts +2 -1
- package/dist/enums/export-type.enum.js +1 -0
- package/dist/enums/export-type.enum.js.map +1 -1
- package/dist/export.schema.d.ts +6 -1
- package/dist/export.schema.js +5 -0
- package/dist/export.schema.js.map +1 -1
- package/dist/exporters/index.d.ts +1 -0
- package/dist/exporters/index.js +1 -0
- package/dist/exporters/index.js.map +1 -1
- package/dist/exporters/modix.exporter.d.ts +13 -0
- package/dist/exporters/modix.exporter.js +64 -0
- package/dist/exporters/modix.exporter.js.map +1 -0
- package/dist/formats/auto24-xml.builder.d.ts +1 -1
- package/dist/formats/autouncle-json.builder.d.ts +1 -1
- package/dist/formats/fb-xml.builder.d.ts +1 -1
- package/dist/formats/google-xml.builder.d.ts +1 -1
- package/dist/formats/index.d.ts +1 -0
- package/dist/formats/index.js +1 -0
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/meinstadt-json.builder.d.ts +1 -1
- package/dist/formats/modix-xml.builder.d.ts +14 -0
- package/dist/formats/modix-xml.builder.js +124 -0
- package/dist/formats/modix-xml.builder.js.map +1 -0
- package/dist/formats/ooyyo-xml.builder.d.ts +1 -1
- package/dist/formats/rubrikk-xml.builder.d.ts +1 -1
- package/dist/interfaces/autoborse.intreface.d.ts +6 -0
- package/dist/interfaces/autoborse.intreface.js +3 -0
- package/dist/interfaces/autoborse.intreface.js.map +1 -0
- package/dist/interfaces/export-item.interface.d.ts +78 -0
- package/dist/interfaces/index.d.ts +2 -0
- package/dist/interfaces/index.js +19 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/modix/index.d.ts +2 -0
- package/dist/interfaces/modix/index.js +19 -0
- package/dist/interfaces/modix/index.js.map +1 -0
- package/dist/interfaces/modix/modix-item-list.interface.d.ts +4 -0
- package/dist/interfaces/modix/modix-item-list.interface.js +3 -0
- package/dist/interfaces/modix/modix-item-list.interface.js.map +1 -0
- package/dist/interfaces/modix/modix-wrap-item.intreface.d.ts +6 -0
- package/dist/interfaces/modix/modix-wrap-item.intreface.js +3 -0
- package/dist/interfaces/modix/modix-wrap-item.intreface.js.map +1 -0
- package/dist/transformers/auto24.transfomer.d.ts +1 -1
- package/dist/transformers/autouncle.transformer.d.ts +1 -1
- package/dist/transformers/autouncle.transformer.js +1 -1
- package/dist/transformers/autouncle.transformer.js.map +1 -1
- package/dist/transformers/google.transformer.d.ts +1 -1
- package/dist/transformers/index.d.ts +1 -0
- package/dist/transformers/index.js +1 -0
- package/dist/transformers/index.js.map +1 -1
- package/dist/transformers/meinstadt.transformer.d.ts +1 -1
- package/dist/transformers/modix.transformer.d.ts +29 -0
- package/dist/transformers/modix.transformer.js +181 -0
- package/dist/transformers/modix.transformer.js.map +1 -0
- package/dist/transformers/ooyyo.transformer.d.ts +1 -1
- package/dist/transformers/ooyyo.transformer.js +1 -1
- package/dist/transformers/ooyyo.transformer.js.map +1 -1
- package/dist/transformers/rubrikk.transformer.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/config/autoborse.config.ts +12 -0
- package/src/config/index.ts +1 -0
- package/src/constants/index.ts +1 -0
- package/src/constants/modix/body-color-name.constant.ts +20 -0
- package/src/constants/modix/category.constant.ts +13 -0
- package/src/constants/modix/fuel.constant.ts +14 -0
- package/src/constants/modix/index.ts +6 -0
- package/src/constants/modix/manufacturers.constant.ts +7498 -0
- package/src/constants/modix/transmission.constant.ts +8 -0
- package/src/constants/modix/usage-type.constant.ts +13 -0
- package/src/constants/modix/vehicle-class.constant.ts +17 -0
- package/src/enums/export-type.enum.ts +1 -0
- package/src/export.schema.ts +6 -1
- package/src/exporters/fb.exporter.ts +1 -1
- package/src/exporters/index.ts +1 -0
- package/src/exporters/meinstadt.exporter.ts +1 -1
- package/src/exporters/modix.exporter.ts +47 -0
- package/src/formats/auto24-xml.builder.ts +1 -1
- package/src/formats/autouncle-json.builder.ts +1 -1
- package/src/formats/fb-xml.builder.ts +1 -1
- package/src/formats/google-xml.builder.ts +1 -1
- package/src/formats/index.ts +1 -0
- package/src/formats/meinstadt-json.builder.ts +1 -1
- package/src/formats/modix-xml.builder.ts +167 -0
- package/src/formats/ooyyo-xml.builder.ts +1 -1
- package/src/formats/rubrikk-xml.builder.ts +1 -1
- package/src/interfaces/autoborse.intreface.ts +6 -0
- package/src/interfaces/export-item.interface.ts +84 -0
- package/src/interfaces/index.ts +2 -0
- package/src/interfaces/modix/index.ts +2 -0
- package/src/interfaces/modix/modix-item-list.interface.ts +5 -0
- package/src/interfaces/modix/modix-wrap-item.intreface.ts +6 -0
- package/src/transformers/auto24.transfomer.ts +1 -1
- package/src/transformers/autouncle.transformer.ts +2 -2
- package/src/transformers/google.transformer.ts +1 -1
- package/src/transformers/index.ts +1 -0
- package/src/transformers/meinstadt.transformer.ts +1 -1
- package/src/transformers/modix.transformer.ts +218 -0
- package/src/transformers/ooyyo.transformer.ts +2 -2
- package/src/transformers/rubrikk.transformer.ts +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IModixItemsList } from '../../interfaces';
|
|
2
|
+
|
|
3
|
+
export const TransmissionList: IModixItemsList = {
|
|
4
|
+
selector_gearbox_manualShift: { value: 'Manual gearbox', atributes: { id: 4 } },
|
|
5
|
+
selector_gearbox_semiAutomatic: { value: 'Semi-automatic gearbox', atributes: { id: 7 } },
|
|
6
|
+
selector_gearbox_automatic: { value: 'Automatic gearbox', atributes: { id: 7 } },
|
|
7
|
+
selector_unknown: { value: 'N/A' },
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IModixItemsList } from '../../interfaces';
|
|
2
|
+
|
|
3
|
+
export const UsageTypeList: IModixItemsList = {
|
|
4
|
+
selector_usageType_preRegistration: { value: '' },
|
|
5
|
+
selector_usageType_demonstrationCar: { value: 'Demonstration car', atributes: { id: 5 } },
|
|
6
|
+
selector_usageType_employeesCar: { value: "Employee's car", atributes: { id: 3 } },
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const UsageConditionList: IModixItemsList = {
|
|
10
|
+
selector_condition_used: { value: 'Used vehicle', atributes: { id: 2 } },
|
|
11
|
+
selector_condition_new: { value: 'New vehicle', atributes: { id: 1 } },
|
|
12
|
+
selector_unknown: { value: 'N/A' },
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IModixItemsList } from '../../interfaces';
|
|
2
|
+
|
|
3
|
+
export const VehicleClassList: IModixItemsList = {
|
|
4
|
+
selector_vehicleClass_constructionVehicle: { value: 'Construction machine', atributes: { id: 10 } },
|
|
5
|
+
selector_vehicleClass_truckOver75t: { value: 'Truck with more than 7.5t', atributes: { id: 6 } },
|
|
6
|
+
selector_vehicleClass_agrarianVehicle: { value: 'Agricultural vehicle', atributes: { id: 12 } },
|
|
7
|
+
selector_vehicleClass_truckUnder75t: { value: 'Truck under 7.5t', atributes: { id: 3 } },
|
|
8
|
+
selector_vehicleClass_semiTrailer: { value: 'Semi-trailer', atributes: { id: 9 } },
|
|
9
|
+
selector_vehicleClass_carTrailer: { value: 'Semi-trailer', atributes: { id: 9 } },
|
|
10
|
+
selector_vehicleClass_motorBike: { value: 'Motorbike', atributes: { id: 5 } },
|
|
11
|
+
selector_vehicleClass_forklift: { value: 'Forklift', atributes: { id: 13 } },
|
|
12
|
+
selector_vehicleClass_camperVan: { value: 'Caravan', atributes: { id: 4 } },
|
|
13
|
+
selector_vehicleClass_car: { value: 'Classic car', atributes: { id: 2 } },
|
|
14
|
+
selector_vehicleClass_trailer: { value: 'Trailer', atributes: { id: 8 } },
|
|
15
|
+
selector_vehicleClass_bus: { value: 'Bus', atributes: { id: 11 } },
|
|
16
|
+
selector_unknown: { value: 'Passenger car', atributes: { id: 1 } },
|
|
17
|
+
};
|
package/src/export.schema.ts
CHANGED
|
@@ -23,7 +23,8 @@ import { GoogleExporter } from './exporters/google.exporter';
|
|
|
23
23
|
import { MeinstadtExporter } from './exporters/meinstadt.exporter';
|
|
24
24
|
import { MobileExporter } from './exporters/mobile.exporter';
|
|
25
25
|
import { OoyyoExporter } from './exporters/ooyyo.exporter';
|
|
26
|
-
import { RubrikkExporter } from './exporters';
|
|
26
|
+
import { ModixExporter, RubrikkExporter } from './exporters';
|
|
27
|
+
import { AutoborseConfig } from './config';
|
|
27
28
|
|
|
28
29
|
export const exportSchema = {
|
|
29
30
|
[ExportType.EAUTO]: {
|
|
@@ -86,4 +87,8 @@ export const exportSchema = {
|
|
|
86
87
|
config: KleinanzeigeFocusConfig,
|
|
87
88
|
exporter: RubrikkExporter,
|
|
88
89
|
},
|
|
90
|
+
[ExportType.AUTOBORSE]: {
|
|
91
|
+
config: AutoborseConfig,
|
|
92
|
+
exporter: ModixExporter,
|
|
93
|
+
},
|
|
89
94
|
};
|
|
@@ -10,7 +10,7 @@ import { FbXmlBuilder } from '../formats/fb-xml.builder';
|
|
|
10
10
|
import { ModuleRef } from '@nestjs/core';
|
|
11
11
|
import { FbTransformer } from '../transformers/fb.transformer';
|
|
12
12
|
import { RulesService } from '../services/rules.service';
|
|
13
|
-
import { FbXmlItem } from '../interfaces
|
|
13
|
+
import { FbXmlItem } from '../interfaces';
|
|
14
14
|
|
|
15
15
|
@Injectable()
|
|
16
16
|
export class FbExporter implements Exporter {
|
package/src/exporters/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { MeinstadtJsonBuilder } from '../formats/meinstadt-json.builder';
|
|
|
11
11
|
import { get, isNil } from 'lodash';
|
|
12
12
|
import { MeinstadtTransformer } from '../transformers/meinstadt.transformer';
|
|
13
13
|
import { RulesService } from '../services/rules.service';
|
|
14
|
-
import { MeinstadtJsonItem } from '../interfaces
|
|
14
|
+
import { MeinstadtJsonItem } from '../interfaces';
|
|
15
15
|
|
|
16
16
|
@Injectable()
|
|
17
17
|
export class MeinstadtExporter implements Exporter {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { Exporter } from '../interfaces/exporter.interface';
|
|
3
|
+
import { CarService } from '../services/car.service';
|
|
4
|
+
import { ConfigService } from '../services/config.service';
|
|
5
|
+
import { LoaderService } from '../services/loader.service';
|
|
6
|
+
import { ModuleRef } from '@nestjs/core';
|
|
7
|
+
import { CronicleUtils } from '@bytebrand/cronicle-helper';
|
|
8
|
+
import { ModixXmlBuilder } from '../formats';
|
|
9
|
+
import { ModixTransformer } from '../transformers';
|
|
10
|
+
import { FsChunkInterface } from '@bytebrand/chunkable';
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class ModixExporter implements Exporter {
|
|
14
|
+
constructor(
|
|
15
|
+
private carService: CarService,
|
|
16
|
+
private configService: ConfigService,
|
|
17
|
+
private loaderService: LoaderService,
|
|
18
|
+
private moduleRef: ModuleRef,
|
|
19
|
+
) {}
|
|
20
|
+
async export(): Promise<void> {
|
|
21
|
+
for (const file of this.configService.config.outputFiles) {
|
|
22
|
+
const exists = await CronicleUtils.exists(file);
|
|
23
|
+
exists && (await CronicleUtils.unlink(file));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const [fileXml] = this.configService.config.outputFiles;
|
|
27
|
+
|
|
28
|
+
const modixXmlBuilder = new ModixXmlBuilder(fileXml);
|
|
29
|
+
const modixTransformer = await this.moduleRef.create(ModixTransformer);
|
|
30
|
+
|
|
31
|
+
await modixXmlBuilder.buildStart();
|
|
32
|
+
await this.loaderService.process(async (chunk: FsChunkInterface) => {
|
|
33
|
+
if (chunk && chunk.data) {
|
|
34
|
+
for (let i = 0; i < chunk.data.length; i += 1) {
|
|
35
|
+
const data = chunk.data[i];
|
|
36
|
+
const { car, images } = data;
|
|
37
|
+
|
|
38
|
+
const transformed_car = await modixTransformer.transform({ car, images });
|
|
39
|
+
await modixXmlBuilder.addItem(transformed_car);
|
|
40
|
+
this.carService.counter.countCar(images);
|
|
41
|
+
}
|
|
42
|
+
chunk.data = null;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
await modixXmlBuilder.buildEnd();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
-
import { Auto24XmlItem } from '../interfaces
|
|
2
|
+
import { Auto24XmlItem } from '../interfaces';
|
|
3
3
|
|
|
4
4
|
export class Auto24XmlBuilder extends XMLBuilderBase {
|
|
5
5
|
async buildStart(totalResults = 0): Promise<void> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
-
import { AutouncleJsonItem } from '../interfaces
|
|
2
|
+
import { AutouncleJsonItem } from '../interfaces';
|
|
3
3
|
|
|
4
4
|
export class AutouncleJsonBuilder extends XMLBuilderBase {
|
|
5
5
|
async buildStart(): Promise<void> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
2
|
import { isObject } from 'lodash';
|
|
3
3
|
import { Description, DescriptionValue } from '../interfaces/description.interface';
|
|
4
|
-
import { FbXmlItem } from '../interfaces
|
|
4
|
+
import { FbXmlItem } from '../interfaces';
|
|
5
5
|
|
|
6
6
|
export class FbXmlBuilder extends XMLBuilderBase {
|
|
7
7
|
async buildStart(url?: string): Promise<void> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
-
import { GoogleXmlItem, FbXmlItem } from '../interfaces
|
|
2
|
+
import { GoogleXmlItem, FbXmlItem } from '../interfaces';
|
|
3
3
|
|
|
4
4
|
export class GoogleXmlBuilder extends XMLBuilderBase {
|
|
5
5
|
async buildStart(url?: string): Promise<void> {
|
package/src/formats/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
-
import { MeinstadtJsonItem } from '../interfaces
|
|
2
|
+
import { MeinstadtJsonItem } from '../interfaces';
|
|
3
3
|
|
|
4
4
|
export class MeinstadtJsonBuilder extends XMLBuilderBase {
|
|
5
5
|
async buildStart(): Promise<void> {
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
+
import {
|
|
3
|
+
ModixXmlItem,
|
|
4
|
+
bodyColorItem,
|
|
5
|
+
identificationItem,
|
|
6
|
+
imageItem,
|
|
7
|
+
mapSameTagsItem,
|
|
8
|
+
priceItem,
|
|
9
|
+
tagWrapperItem,
|
|
10
|
+
} from '../interfaces';
|
|
11
|
+
|
|
12
|
+
export class ModixXmlBuilder extends XMLBuilderBase {
|
|
13
|
+
async buildStart(): Promise<void> {
|
|
14
|
+
await this.write(
|
|
15
|
+
'<?xml version="1.0" encoding="UTF-8"?>\n<automotive version="3.0">\n<vehiclePool lang="de-DE">\n<vehicles>',
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async addItem(car: ModixXmlItem): Promise<void> {
|
|
20
|
+
//todo add internalDescription, modkey, cipher attributes for vehicle tag
|
|
21
|
+
let item = "\n<vehicle lang='de-DE'>\n";
|
|
22
|
+
const tags = Object.keys(car);
|
|
23
|
+
|
|
24
|
+
for (const tag of tags) {
|
|
25
|
+
const value = car[tag];
|
|
26
|
+
switch (tag) {
|
|
27
|
+
case 'maindata': {
|
|
28
|
+
item += this.tagWrapper('maindata', car.maindata);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case 'dates': {
|
|
32
|
+
item += this.mapSameTags('dates', car.dates);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
case 'bodyColors': {
|
|
36
|
+
item += this.mapColors(car.bodyColors);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case 'identification': {
|
|
40
|
+
item += this.mapIdentification(car.identification);
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case 'prices': {
|
|
44
|
+
item += this.mapPrice(car.prices);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case 'images': {
|
|
48
|
+
item += this.mapImages(car.images);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case 'dealer': {
|
|
52
|
+
item += this.mapDealer(car.dealer.address, car.dealer.imprint);
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
default: {
|
|
56
|
+
item += this.getElement(tag, value, false);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
item += '\n</vehicle>';
|
|
61
|
+
|
|
62
|
+
await this.write(item);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
tagWrapper(wrapTag: string, data: tagWrapperItem) {
|
|
66
|
+
let item = `<${wrapTag}>\n`;
|
|
67
|
+
|
|
68
|
+
for (const tag in data) {
|
|
69
|
+
item += this.getElement(tag, data[tag]?.value, false, data[tag]?.atributes);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
item += `</${wrapTag}>\n`;
|
|
73
|
+
return item;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
mapSameTags(wrapTag: string, data: mapSameTagsItem[]) {
|
|
77
|
+
let item = `\n<${wrapTag}>\n`;
|
|
78
|
+
|
|
79
|
+
data.forEach(({ tag, atributes, value }) => {
|
|
80
|
+
item += this.getElement(tag, value, false, atributes);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
item += `</${wrapTag}> \n`;
|
|
84
|
+
return item;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
mapColors(colorData: bodyColorItem) {
|
|
88
|
+
let item = `<colors> \n <bodyColors> \n <bodyColor id="${colorData.id}"> \n`;
|
|
89
|
+
|
|
90
|
+
for (const tag in colorData.data) {
|
|
91
|
+
item += this.getElement(tag, colorData.data[tag].value, false, colorData.data[tag]?.atributes);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
item += '</bodyColor> \n </bodyColors> \n </colors> \n';
|
|
95
|
+
|
|
96
|
+
return item;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
mapIdentification(identificationData: identificationItem) {
|
|
100
|
+
let item = '\n<identification>\n';
|
|
101
|
+
|
|
102
|
+
for (const tag in identificationData) {
|
|
103
|
+
if (tag === 'hsnTsn') {
|
|
104
|
+
item += '<hsnTsn>\n';
|
|
105
|
+
|
|
106
|
+
item += this.getElement(
|
|
107
|
+
'hsn',
|
|
108
|
+
identificationData.hsnTsn.hsn.value,
|
|
109
|
+
false,
|
|
110
|
+
identificationData.hsnTsn.hsn.atributes,
|
|
111
|
+
);
|
|
112
|
+
item += this.getElement(
|
|
113
|
+
'tsn',
|
|
114
|
+
identificationData.hsnTsn.tsn.value,
|
|
115
|
+
false,
|
|
116
|
+
identificationData.hsnTsn.tsn.atributes,
|
|
117
|
+
);
|
|
118
|
+
item += '</hsnTsn>\n';
|
|
119
|
+
} else {
|
|
120
|
+
item += this.getElement(tag, identificationData[tag]?.value, false, identificationData[tag]?.atributes);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
item += '</identification>\n';
|
|
124
|
+
return item;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
mapPrice({ grossPrice, vatReclaimable }: priceItem) {
|
|
128
|
+
let item = `\n<prices>\n<price vatReclaimable="${vatReclaimable}" currency="EUR" type="1">\n`;
|
|
129
|
+
item += this.getElement('grossPrice', grossPrice.value, false, grossPrice.atributes);
|
|
130
|
+
item += '</price>\n</prices>\n';
|
|
131
|
+
return item;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
mapImages(imageData: imageItem) {
|
|
135
|
+
let item = `\n<media>\n<images url="${imageData.url}">\n`;
|
|
136
|
+
|
|
137
|
+
item += '\n<meta>\n';
|
|
138
|
+
imageData.imageList.forEach(image => {
|
|
139
|
+
item += `<media name="${image.atributes?.name}" position="${image.atributes?.position}" />`;
|
|
140
|
+
});
|
|
141
|
+
item += '\n</meta>\n';
|
|
142
|
+
|
|
143
|
+
imageData.imageList.forEach(image => {
|
|
144
|
+
item += `<media name="${image.atributes?.name}" position="${image.atributes?.position}" />\n`;
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
item += '\n</images>\n</media>';
|
|
148
|
+
return item;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
mapDealer(addressData: tagWrapperItem, imprintData: tagWrapperItem) {
|
|
152
|
+
//todo add modkey attribute
|
|
153
|
+
let item = '\n<dealer>\n';
|
|
154
|
+
|
|
155
|
+
item += this.tagWrapper('address', addressData);
|
|
156
|
+
item += '\n';
|
|
157
|
+
item += this.tagWrapper('imprint', imprintData);
|
|
158
|
+
|
|
159
|
+
item += '\n</dealer>\n';
|
|
160
|
+
return item;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async buildEnd(): Promise<void> {
|
|
164
|
+
await this.write('\n</vehicles>\n</vehiclePool>\n</automotive>');
|
|
165
|
+
await this.end();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
-
import { OoyyoXmlItem } from '../interfaces
|
|
2
|
+
import { OoyyoXmlItem } from '../interfaces';
|
|
3
3
|
|
|
4
4
|
export class OoyyoXmlBuilder extends XMLBuilderBase {
|
|
5
5
|
async buildStart(): Promise<void> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
-
import { RubrikkXmlItem } from '../interfaces
|
|
2
|
+
import { RubrikkXmlItem } from '../interfaces';
|
|
3
3
|
|
|
4
4
|
export class RubrikkXmlBuilder extends XMLBuilderBase {
|
|
5
5
|
async buildStart(): Promise<void> {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IModixWrapItem } from './autoborse.intreface';
|
|
2
|
+
|
|
1
3
|
export interface FbXmlItem {
|
|
2
4
|
url: string;
|
|
3
5
|
title: string;
|
|
@@ -192,3 +194,85 @@ export interface RubrikkXmlItem {
|
|
|
192
194
|
motoring__power_hp: number;
|
|
193
195
|
motoring__transmission: string;
|
|
194
196
|
}
|
|
197
|
+
|
|
198
|
+
export interface ModixXmlItem {
|
|
199
|
+
maindata: {
|
|
200
|
+
category: IModixWrapItem;
|
|
201
|
+
manufacturer: IModixWrapItem;
|
|
202
|
+
model: IModixWrapItem;
|
|
203
|
+
submodel: IModixWrapItem;
|
|
204
|
+
mileage: IModixWrapItem;
|
|
205
|
+
cylinderCapacity: IModixWrapItem;
|
|
206
|
+
enginePower: IModixWrapItem;
|
|
207
|
+
fuel: IModixWrapItem;
|
|
208
|
+
accident: IModixWrapItem;
|
|
209
|
+
transmission: IModixWrapItem;
|
|
210
|
+
usageCategory: IModixWrapItem;
|
|
211
|
+
bodyStyle: IModixWrapItem;
|
|
212
|
+
isOnline: IModixWrapItem;
|
|
213
|
+
};
|
|
214
|
+
bodyColors: bodyColorItem;
|
|
215
|
+
dates: mapSameTagsItem[];
|
|
216
|
+
identification: identificationItem;
|
|
217
|
+
prices: priceItem;
|
|
218
|
+
images: imageItem;
|
|
219
|
+
dealer: dealerItem;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface mapSameTagsItem {
|
|
223
|
+
tag: string;
|
|
224
|
+
value: any;
|
|
225
|
+
atributes?: any;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface tagWrapperItem {
|
|
229
|
+
[key: string]: { value: any; atributes?: any };
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface bodyColorItem {
|
|
233
|
+
id: number;
|
|
234
|
+
data: {
|
|
235
|
+
name: IModixWrapItem;
|
|
236
|
+
description: IModixWrapItem;
|
|
237
|
+
paint: IModixWrapItem;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface identificationItem {
|
|
242
|
+
hsnTsn: {
|
|
243
|
+
hsn: IModixWrapItem;
|
|
244
|
+
tsn: IModixWrapItem;
|
|
245
|
+
};
|
|
246
|
+
vin: IModixWrapItem;
|
|
247
|
+
datEuropacode: IModixWrapItem;
|
|
248
|
+
schwackecode: IModixWrapItem;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export interface imageItem {
|
|
252
|
+
url: string;
|
|
253
|
+
imageList: IModixWrapItem[];
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export interface priceItem {
|
|
257
|
+
vatReclaimable: boolean;
|
|
258
|
+
grossPrice: IModixWrapItem;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface dealerItem {
|
|
262
|
+
address: {
|
|
263
|
+
company: IModixWrapItem;
|
|
264
|
+
street: IModixWrapItem;
|
|
265
|
+
city: IModixWrapItem;
|
|
266
|
+
zip: IModixWrapItem;
|
|
267
|
+
country: IModixWrapItem;
|
|
268
|
+
phone: IModixWrapItem;
|
|
269
|
+
fax: IModixWrapItem;
|
|
270
|
+
email: IModixWrapItem;
|
|
271
|
+
homepage: IModixWrapItem;
|
|
272
|
+
};
|
|
273
|
+
imprint: {
|
|
274
|
+
registerId: IModixWrapItem;
|
|
275
|
+
representitive: IModixWrapItem;
|
|
276
|
+
vatid: IModixWrapItem;
|
|
277
|
+
};
|
|
278
|
+
}
|
|
@@ -4,7 +4,7 @@ import { get, toString, isNil, isEmpty, first } from 'lodash';
|
|
|
4
4
|
import * as moment from 'moment';
|
|
5
5
|
import { DataSchemes } from '@bytebrand/car-schema';
|
|
6
6
|
import { ImboImageResponseInterface } from '@bytebrand/chunkable';
|
|
7
|
-
import { Auto24XmlItem } from '../interfaces
|
|
7
|
+
import { Auto24XmlItem } from '../interfaces';
|
|
8
8
|
import { Injectable } from '@nestjs/common';
|
|
9
9
|
import { ConfigService } from '../services/config.service';
|
|
10
10
|
import { isNotEmptyArray } from '../utils/validator.utils';
|
|
@@ -8,7 +8,7 @@ import { DePostalCodesEntryInterface } from '@bytebrand/car-basic-data-scope/dis
|
|
|
8
8
|
import { ConfigService } from '../services/config.service';
|
|
9
9
|
import { Injectable } from '@nestjs/common';
|
|
10
10
|
import { DEFAULT_ADDR1, DEFAULT_CITY, DEFAULT_ZIP, MIN_MILEAGES } from '../constants/autouncle.contants';
|
|
11
|
-
import { AutouncleJsonItem } from '../interfaces
|
|
11
|
+
import { AutouncleJsonItem } from '../interfaces';
|
|
12
12
|
import { isNotEmptyArray } from '../utils/validator.utils';
|
|
13
13
|
|
|
14
14
|
@Injectable()
|
|
@@ -36,7 +36,7 @@ export class AutouncleTransformer {
|
|
|
36
36
|
const address = await this.getAddress(car, owner);
|
|
37
37
|
|
|
38
38
|
return {
|
|
39
|
-
back_link: `https://www.${this.configService.config.url}/search/vehicle/${autodeId}?source=
|
|
39
|
+
back_link: `https://www.${this.configService.config.url}/search/vehicle/${autodeId}?source=classifieds&medium=cpc&campaign=autouncle`,
|
|
40
40
|
make: toString(get(car, 'mainData.make', '')),
|
|
41
41
|
model_name: toString(get(car, 'mainData.model', '')),
|
|
42
42
|
model_variant: toString(get(car, 'mainData.subModel', '')),
|
|
@@ -6,7 +6,7 @@ import { de, deVehicleDetailsPage, deVehicleProps } from '@bytebrand/i18n-dictio
|
|
|
6
6
|
import { Injectable } from '@nestjs/common';
|
|
7
7
|
import { UserService } from '../services/user.service';
|
|
8
8
|
import { ConfigService } from '../services/config.service';
|
|
9
|
-
import { GoogleXmlItem } from '../interfaces
|
|
9
|
+
import { GoogleXmlItem } from '../interfaces';
|
|
10
10
|
|
|
11
11
|
@Injectable()
|
|
12
12
|
export class GoogleTransformer {
|
|
@@ -4,7 +4,7 @@ import { DataSchemes } from '@bytebrand/car-schema';
|
|
|
4
4
|
import { de } from '@bytebrand/i18n-dictionaries';
|
|
5
5
|
import { Injectable } from '@nestjs/common';
|
|
6
6
|
import { ConfigService } from '../services/config.service';
|
|
7
|
-
import { MeinstadtJsonItem } from '../interfaces
|
|
7
|
+
import { MeinstadtJsonItem } from '../interfaces';
|
|
8
8
|
|
|
9
9
|
@Injectable()
|
|
10
10
|
export class MeinstadtTransformer {
|