@bytebrand/export-cars 1.21.7 → 1.21.8
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/.editorconfig +8 -8
- package/.eslintignore +1 -1
- package/.eslintrc.js +24 -24
- package/.prettierrc.js +7 -7
- package/README.md +65 -65
- package/dist/configs/index.d.ts +1 -0
- package/dist/configs/index.js +1 -0
- package/dist/configs/index.js.map +1 -1
- package/dist/configs/santander.config.d.ts +5 -0
- package/dist/configs/santander.config.js +18 -0
- package/dist/configs/santander.config.js.map +1 -0
- package/dist/enums/export-type.enum.d.ts +1 -0
- package/dist/enums/export-type.enum.js +1 -0
- package/dist/enums/export-type.enum.js.map +1 -1
- package/dist/export.command.js +1 -1
- package/dist/export.command.js.map +1 -1
- package/dist/export.schema.d.ts +6 -2
- package/dist/export.schema.js +4 -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/santander.exporter.d.ts +12 -0
- package/dist/exporters/santander.exporter.js +63 -0
- package/dist/exporters/santander.exporter.js.map +1 -0
- package/dist/formats/auto24-xml.builder.js +2 -2
- package/dist/formats/google-xml.builder.js +3 -3
- package/dist/formats/modix-xml.builder.js +2 -2
- package/dist/formats/ooyyo-xml.builder.js +1 -1
- package/dist/formats/santander-csv.builder.d.ts +6 -0
- package/dist/formats/santander-csv.builder.js +17 -0
- package/dist/formats/santander-csv.builder.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/nest-cli.json +5 -5
- package/package.json +61 -61
- package/src/app.module.ts +38 -38
- package/src/configs/alleskralle.config.ts +15 -15
- package/src/configs/as24.config.ts +13 -13
- package/src/configs/auto24.config.ts +15 -15
- package/src/configs/autoboerse.config.ts +16 -16
- package/src/configs/autouncle.config.ts +14 -14
- package/src/configs/awin.config.ts +15 -15
- package/src/configs/by-owner.config.ts +14 -14
- package/src/configs/config.ts +83 -83
- package/src/configs/criteo.config.ts +17 -17
- package/src/configs/dasparking.config.ts +15 -15
- package/src/configs/eauto.config.ts +15 -15
- package/src/configs/evium.config.ts +18 -18
- package/src/configs/facebook-shop.config.ts +16 -16
- package/src/configs/fb.config.ts +16 -16
- package/src/configs/google.config.ts +14 -14
- package/src/configs/index.ts +22 -21
- package/src/configs/kleinanzeigeFocus.config.ts +14 -14
- package/src/configs/marktde.config.ts +18 -18
- package/src/configs/meinstadt.config.ts +15 -15
- package/src/configs/mitula.config.ts +14 -14
- package/src/configs/ooyyo.config.ts +15 -15
- package/src/configs/santander.config.ts +15 -0
- package/src/configs/trovit.config.ts +14 -14
- package/src/configs/yescar.config.ts +17 -17
- package/src/constants/autouncle.contants.ts +4 -4
- package/src/constants/fb.constants.ts +7 -7
- package/src/constants/index.ts +1 -1
- package/src/constants/modix/body-color-name.constant.ts +20 -20
- package/src/constants/modix/category.constant.ts +14 -14
- package/src/constants/modix/fuel.constant.ts +14 -14
- package/src/constants/modix/index.ts +7 -7
- package/src/constants/modix/manufacturers.constant.ts +7498 -7498
- package/src/constants/modix/transmission.constant.ts +8 -8
- package/src/constants/modix/usage-type.constant.ts +13 -13
- package/src/constants/modix/vehicle-class.constant.ts +17 -17
- package/src/enums/environment.enum.ts +5 -5
- package/src/enums/export-type.enum.ts +33 -32
- package/src/enums/file-types.enum.ts +8 -8
- package/src/enums/image-type.enum.ts +4 -4
- package/src/enums/index.ts +4 -4
- package/src/export.command.ts +37 -37
- package/src/export.schema.ts +134 -128
- package/src/exporters/as24.exporter.ts +69 -69
- package/src/exporters/auto24.exporter.ts +48 -48
- package/src/exporters/autouncle.exporter.ts +60 -60
- package/src/exporters/awin.exporter.ts +47 -47
- package/src/exporters/by-owner.exporter.ts +44 -44
- package/src/exporters/facebook-shop.exporter.ts +51 -51
- package/src/exporters/fb.exporter.ts +52 -52
- package/src/exporters/google.exporter.ts +45 -45
- package/src/exporters/index.ts +15 -14
- package/src/exporters/meinstadt.exporter.ts +55 -55
- package/src/exporters/mobile.exporter.ts +64 -64
- package/src/exporters/modix.exporter.ts +56 -56
- package/src/exporters/ooyyo.exporter.ts +48 -48
- package/src/exporters/rubrikk.exporter.ts +53 -53
- package/src/exporters/santander.exporter.ts +50 -0
- package/src/exporters/trovit.exporter.ts +51 -51
- package/src/formats/auto24-xml.builder.ts +54 -54
- package/src/formats/autouncle-json.builder.ts +20 -20
- package/src/formats/awin-csv.builder.ts +16 -16
- package/src/formats/facebook-shop.builder.ts +69 -69
- package/src/formats/fb-xml.builder.ts +71 -71
- package/src/formats/google-xml.builder.ts +35 -35
- package/src/formats/index.ts +5 -5
- package/src/formats/meinstadt-json.builder.ts +19 -19
- package/src/formats/modix-xml.builder.ts +180 -180
- package/src/formats/ooyyo-xml.builder.ts +48 -48
- package/src/formats/rubrikk-xml.builder.ts +27 -27
- package/src/formats/santander-csv.builder.ts +15 -0
- package/src/formats/trovit-xml.builder.ts +44 -44
- package/src/interfaces/atributes-wrap-item.intreface.ts +6 -6
- package/src/interfaces/dealers-mapping.interface.ts +7 -7
- package/src/interfaces/description.interface.ts +24 -24
- package/src/interfaces/export-item.interface.ts +366 -366
- package/src/interfaces/exporter.interface.ts +3 -3
- package/src/interfaces/index.ts +3 -3
- package/src/interfaces/input.interface.ts +6 -6
- package/src/interfaces/mapping-rules.interface.ts +11 -11
- package/src/interfaces/modix/index.ts +1 -1
- package/src/interfaces/modix/modix-item-list.interface.ts +5 -5
- package/src/interfaces/params.interface.ts +13 -13
- package/src/interfaces/rule-parser.interface.ts +3 -3
- package/src/main.ts +14 -14
- package/src/rules/abstract.rule.ts +37 -37
- package/src/rules/date.rule.ts +19 -19
- package/src/rules/number.rule.ts +15 -15
- package/src/rules/string.rule.ts +8 -8
- package/src/services/car.service.ts +49 -49
- package/src/services/config.service.ts +15 -15
- package/src/services/images.service.ts +207 -207
- package/src/services/index.ts +9 -9
- package/src/services/loader.service.ts +29 -29
- package/src/services/mapping.service.ts +91 -91
- package/src/services/request.service.ts +44 -44
- package/src/services/rules.service.ts +61 -61
- package/src/services/transformer.service.ts +129 -129
- package/src/services/user.service.ts +57 -57
- package/src/transformers/as24.transformer.ts +253 -253
- package/src/transformers/auto24.transfomer.ts +155 -155
- package/src/transformers/autouncle.transformer.ts +236 -236
- package/src/transformers/awin.transformer.ts +193 -193
- package/src/transformers/by-owner.transformer.ts +354 -354
- package/src/transformers/facebook-shop.transformer.ts +93 -93
- package/src/transformers/fb-description.transformer.ts +316 -316
- package/src/transformers/fb-equipment.transformer.ts +161 -161
- package/src/transformers/fb.transformer.ts +655 -655
- package/src/transformers/google.transformer.ts +169 -169
- package/src/transformers/index.ts +5 -5
- package/src/transformers/meinstadt.transformer.ts +92 -92
- package/src/transformers/mobile.transformer.ts +482 -482
- package/src/transformers/modix.transformer.ts +227 -227
- package/src/transformers/ooyyo.transformer.ts +109 -109
- package/src/transformers/rubrikk.transformer.ts +200 -200
- package/src/transformers/trovit.transformer.ts +63 -63
- package/src/utils/converter.utils.ts +15 -15
- package/src/utils/index.ts +2 -2
- package/src/utils/validator.utils.ts +7 -7
- package/tsconfig.build.json +4 -4
- package/tsconfig.json +29 -29
|
@@ -1,180 +1,180 @@
|
|
|
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
|
-
case 'options': {
|
|
56
|
-
item += this.mapOptions(car);
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
default: {
|
|
60
|
-
item += this.getElement(tag, value, false);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
item += '\n</vehicle>';
|
|
65
|
-
|
|
66
|
-
await this.write(item);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
tagWrapper(wrapTag: string, data: tagWrapperItem) {
|
|
70
|
-
let item = `<${wrapTag}>\n`;
|
|
71
|
-
|
|
72
|
-
for (const tag in data) {
|
|
73
|
-
item += this.getElement(tag, data[tag]?.value, false, data[tag]?.atributes);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
item += `</${wrapTag}>\n`;
|
|
77
|
-
return item;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
mapSameTags(wrapTag: string, data: mapSameTagsItem[]) {
|
|
81
|
-
let item = `\n<${wrapTag}>\n`;
|
|
82
|
-
|
|
83
|
-
data.forEach(({ tag, atributes, value }) => {
|
|
84
|
-
item += this.getElement(tag, value, false, atributes);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
item += `</${wrapTag}> \n`;
|
|
88
|
-
return item;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
mapColors(colorData: bodyColorItem) {
|
|
92
|
-
let item = `<colors> \n <bodyColors> \n <bodyColor id="${colorData.id}"> \n`;
|
|
93
|
-
|
|
94
|
-
for (const tag in colorData.data) {
|
|
95
|
-
item += this.getElement(tag, colorData.data[tag].value, false, colorData.data[tag]?.atributes);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
item += '</bodyColor> \n </bodyColors> \n </colors> \n';
|
|
99
|
-
|
|
100
|
-
return item;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
mapIdentification(identificationData: identificationItem) {
|
|
104
|
-
let item = '\n<identification>\n';
|
|
105
|
-
|
|
106
|
-
for (const tag in identificationData) {
|
|
107
|
-
if (tag === 'hsnTsn') {
|
|
108
|
-
item += '<hsnTsn>\n';
|
|
109
|
-
|
|
110
|
-
item += this.getElement(
|
|
111
|
-
'hsn',
|
|
112
|
-
identificationData.hsnTsn.hsn.value,
|
|
113
|
-
false,
|
|
114
|
-
identificationData.hsnTsn.hsn.atributes,
|
|
115
|
-
);
|
|
116
|
-
item += this.getElement(
|
|
117
|
-
'tsn',
|
|
118
|
-
identificationData.hsnTsn.tsn.value,
|
|
119
|
-
false,
|
|
120
|
-
identificationData.hsnTsn.tsn.atributes,
|
|
121
|
-
);
|
|
122
|
-
item += '</hsnTsn>\n';
|
|
123
|
-
} else {
|
|
124
|
-
item += this.getElement(tag, identificationData[tag]?.value, false, identificationData[tag]?.atributes);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
item += '</identification>\n';
|
|
128
|
-
return item;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
mapPrice({ grossPrice, vatReclaimable }: priceItem) {
|
|
132
|
-
let item = `\n<prices>\n<price vatReclaimable="${vatReclaimable}" currency="EUR" type="2">\n`;
|
|
133
|
-
item += this.getElement('grossPrice', grossPrice.value, false, grossPrice.atributes);
|
|
134
|
-
item += '</price>\n</prices>\n';
|
|
135
|
-
return item;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
mapImages(imageData: imageItem) {
|
|
139
|
-
let item = `\n<media>\n<images url="${imageData.url}/">\n`;
|
|
140
|
-
|
|
141
|
-
imageData.imageList.forEach(image => {
|
|
142
|
-
item += `<image name="${image.atributes?.name}" position="${image.atributes?.position}" />\n`;
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
item += '\n</images>\n</media>';
|
|
146
|
-
return item;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
mapDealer(addressData: tagWrapperItem, imprintData: tagWrapperItem) {
|
|
150
|
-
//todo add modkey attribute
|
|
151
|
-
let item = '\n<dealer>\n';
|
|
152
|
-
|
|
153
|
-
item += this.tagWrapper('address', addressData);
|
|
154
|
-
item += '\n';
|
|
155
|
-
item += this.tagWrapper('imprint', imprintData);
|
|
156
|
-
|
|
157
|
-
item += '\n</dealer>\n';
|
|
158
|
-
return item;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
async buildEnd(): Promise<void> {
|
|
162
|
-
await this.write('\n</vehicles>\n</vehiclePool>\n</automotive>');
|
|
163
|
-
await this.end();
|
|
164
|
-
}
|
|
165
|
-
// { [id: string]: string }
|
|
166
|
-
mapOptions(car: ModixXmlItem) {
|
|
167
|
-
const result = [];
|
|
168
|
-
|
|
169
|
-
for (const id in car.options) {
|
|
170
|
-
const value = car.options[id];
|
|
171
|
-
result.push(
|
|
172
|
-
`<option id="${id}">
|
|
173
|
-
<value>${value}</value>
|
|
174
|
-
</option>`
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return `<options>${result.join('')}</options>`
|
|
179
|
-
}
|
|
180
|
-
}
|
|
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
|
+
case 'options': {
|
|
56
|
+
item += this.mapOptions(car);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
default: {
|
|
60
|
+
item += this.getElement(tag, value, false);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
item += '\n</vehicle>';
|
|
65
|
+
|
|
66
|
+
await this.write(item);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
tagWrapper(wrapTag: string, data: tagWrapperItem) {
|
|
70
|
+
let item = `<${wrapTag}>\n`;
|
|
71
|
+
|
|
72
|
+
for (const tag in data) {
|
|
73
|
+
item += this.getElement(tag, data[tag]?.value, false, data[tag]?.atributes);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
item += `</${wrapTag}>\n`;
|
|
77
|
+
return item;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
mapSameTags(wrapTag: string, data: mapSameTagsItem[]) {
|
|
81
|
+
let item = `\n<${wrapTag}>\n`;
|
|
82
|
+
|
|
83
|
+
data.forEach(({ tag, atributes, value }) => {
|
|
84
|
+
item += this.getElement(tag, value, false, atributes);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
item += `</${wrapTag}> \n`;
|
|
88
|
+
return item;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
mapColors(colorData: bodyColorItem) {
|
|
92
|
+
let item = `<colors> \n <bodyColors> \n <bodyColor id="${colorData.id}"> \n`;
|
|
93
|
+
|
|
94
|
+
for (const tag in colorData.data) {
|
|
95
|
+
item += this.getElement(tag, colorData.data[tag].value, false, colorData.data[tag]?.atributes);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
item += '</bodyColor> \n </bodyColors> \n </colors> \n';
|
|
99
|
+
|
|
100
|
+
return item;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
mapIdentification(identificationData: identificationItem) {
|
|
104
|
+
let item = '\n<identification>\n';
|
|
105
|
+
|
|
106
|
+
for (const tag in identificationData) {
|
|
107
|
+
if (tag === 'hsnTsn') {
|
|
108
|
+
item += '<hsnTsn>\n';
|
|
109
|
+
|
|
110
|
+
item += this.getElement(
|
|
111
|
+
'hsn',
|
|
112
|
+
identificationData.hsnTsn.hsn.value,
|
|
113
|
+
false,
|
|
114
|
+
identificationData.hsnTsn.hsn.atributes,
|
|
115
|
+
);
|
|
116
|
+
item += this.getElement(
|
|
117
|
+
'tsn',
|
|
118
|
+
identificationData.hsnTsn.tsn.value,
|
|
119
|
+
false,
|
|
120
|
+
identificationData.hsnTsn.tsn.atributes,
|
|
121
|
+
);
|
|
122
|
+
item += '</hsnTsn>\n';
|
|
123
|
+
} else {
|
|
124
|
+
item += this.getElement(tag, identificationData[tag]?.value, false, identificationData[tag]?.atributes);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
item += '</identification>\n';
|
|
128
|
+
return item;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
mapPrice({ grossPrice, vatReclaimable }: priceItem) {
|
|
132
|
+
let item = `\n<prices>\n<price vatReclaimable="${vatReclaimable}" currency="EUR" type="2">\n`;
|
|
133
|
+
item += this.getElement('grossPrice', grossPrice.value, false, grossPrice.atributes);
|
|
134
|
+
item += '</price>\n</prices>\n';
|
|
135
|
+
return item;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
mapImages(imageData: imageItem) {
|
|
139
|
+
let item = `\n<media>\n<images url="${imageData.url}/">\n`;
|
|
140
|
+
|
|
141
|
+
imageData.imageList.forEach(image => {
|
|
142
|
+
item += `<image name="${image.atributes?.name}" position="${image.atributes?.position}" />\n`;
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
item += '\n</images>\n</media>';
|
|
146
|
+
return item;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
mapDealer(addressData: tagWrapperItem, imprintData: tagWrapperItem) {
|
|
150
|
+
//todo add modkey attribute
|
|
151
|
+
let item = '\n<dealer>\n';
|
|
152
|
+
|
|
153
|
+
item += this.tagWrapper('address', addressData);
|
|
154
|
+
item += '\n';
|
|
155
|
+
item += this.tagWrapper('imprint', imprintData);
|
|
156
|
+
|
|
157
|
+
item += '\n</dealer>\n';
|
|
158
|
+
return item;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async buildEnd(): Promise<void> {
|
|
162
|
+
await this.write('\n</vehicles>\n</vehiclePool>\n</automotive>');
|
|
163
|
+
await this.end();
|
|
164
|
+
}
|
|
165
|
+
// { [id: string]: string }
|
|
166
|
+
mapOptions(car: ModixXmlItem) {
|
|
167
|
+
const result = [];
|
|
168
|
+
|
|
169
|
+
for (const id in car.options) {
|
|
170
|
+
const value = car.options[id];
|
|
171
|
+
result.push(
|
|
172
|
+
`<option id="${id}">
|
|
173
|
+
<value>${value}</value>
|
|
174
|
+
</option>`
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return `<options>${result.join('')}</options>`
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
-
import { OoyyoXmlItem } from '../interfaces';
|
|
3
|
-
|
|
4
|
-
export class OoyyoXmlBuilder extends XMLBuilderBase {
|
|
5
|
-
async buildStart(): Promise<void> {
|
|
6
|
-
await this.write(`<?xml version="1.0" encoding="UTF-8"?>
|
|
7
|
-
<ooyyo xsi:noNamespaceSchemaLocation="OoyyoFormat.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">`);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async addItem(car: OoyyoXmlItem): Promise<void> {
|
|
11
|
-
let item = '';
|
|
12
|
-
|
|
13
|
-
item += '\n<ad>\n';
|
|
14
|
-
item += this.getElement('url', car.url, true);
|
|
15
|
-
item += this.getElement('title', car.title, true);
|
|
16
|
-
item += this.getElement('content', car.content, true);
|
|
17
|
-
item += this.getElement('price', car.price, true, { unit: 'euro' });
|
|
18
|
-
item += this.getElement('make', car.make, true);
|
|
19
|
-
item += this.getElement('model', car.model, true);
|
|
20
|
-
item += this.getElement('trim', car.trim, true);
|
|
21
|
-
item += this.getElement('engine_size', car.engine_size, true, { unit: 'cc' });
|
|
22
|
-
item += this.getElement('body_type', car.body_type, true);
|
|
23
|
-
item += this.getElement('color', car.color, true);
|
|
24
|
-
item += this.getElement('year', car.year, true);
|
|
25
|
-
item += this.getElement('mileage', car.mileage, true, { unit: 'km' });
|
|
26
|
-
item += this.getElement('fuel_type', car.fuel_type, true);
|
|
27
|
-
item += this.getElement('transmission', car.transmission, true);
|
|
28
|
-
item += this.getElement('euronorm', car.euronorm, true);
|
|
29
|
-
item += this.getElement('power', car.power, true, { unit: 'kw' });
|
|
30
|
-
item += this.getElement('doors', car.doors, true);
|
|
31
|
-
item += this.getElement('seats', car.seats, true);
|
|
32
|
-
item += this.getElement('gears', car.gears, true);
|
|
33
|
-
item += this.getElementsTree('location', car.location, true);
|
|
34
|
-
item += this.getElementsList('pictures', 'picture', car.pictures, true);
|
|
35
|
-
item += this.getElement('vin', car.vin, true);
|
|
36
|
-
item += this.getElement('is_new', car.is_new, true);
|
|
37
|
-
item += this.getElement('date', car.date, true);
|
|
38
|
-
item += this.getElement('time', car.time, true);
|
|
39
|
-
item += '</ad>';
|
|
40
|
-
|
|
41
|
-
await this.write(item);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
async buildEnd(): Promise<void> {
|
|
45
|
-
await this.write('\n</ooyyo>');
|
|
46
|
-
await this.end();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
+
import { OoyyoXmlItem } from '../interfaces';
|
|
3
|
+
|
|
4
|
+
export class OoyyoXmlBuilder extends XMLBuilderBase {
|
|
5
|
+
async buildStart(): Promise<void> {
|
|
6
|
+
await this.write(`<?xml version="1.0" encoding="UTF-8"?>
|
|
7
|
+
<ooyyo xsi:noNamespaceSchemaLocation="OoyyoFormat.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async addItem(car: OoyyoXmlItem): Promise<void> {
|
|
11
|
+
let item = '';
|
|
12
|
+
|
|
13
|
+
item += '\n<ad>\n';
|
|
14
|
+
item += this.getElement('url', car.url, true);
|
|
15
|
+
item += this.getElement('title', car.title, true);
|
|
16
|
+
item += this.getElement('content', car.content, true);
|
|
17
|
+
item += this.getElement('price', car.price, true, { unit: 'euro' });
|
|
18
|
+
item += this.getElement('make', car.make, true);
|
|
19
|
+
item += this.getElement('model', car.model, true);
|
|
20
|
+
item += this.getElement('trim', car.trim, true);
|
|
21
|
+
item += this.getElement('engine_size', car.engine_size, true, { unit: 'cc' });
|
|
22
|
+
item += this.getElement('body_type', car.body_type, true);
|
|
23
|
+
item += this.getElement('color', car.color, true);
|
|
24
|
+
item += this.getElement('year', car.year, true);
|
|
25
|
+
item += this.getElement('mileage', car.mileage, true, { unit: 'km' });
|
|
26
|
+
item += this.getElement('fuel_type', car.fuel_type, true);
|
|
27
|
+
item += this.getElement('transmission', car.transmission, true);
|
|
28
|
+
item += this.getElement('euronorm', car.euronorm, true);
|
|
29
|
+
item += this.getElement('power', car.power, true, { unit: 'kw' });
|
|
30
|
+
item += this.getElement('doors', car.doors, true);
|
|
31
|
+
item += this.getElement('seats', car.seats, true);
|
|
32
|
+
item += this.getElement('gears', car.gears, true);
|
|
33
|
+
item += this.getElementsTree('location', car.location, true);
|
|
34
|
+
item += this.getElementsList('pictures', 'picture', car.pictures, true);
|
|
35
|
+
item += this.getElement('vin', car.vin, true);
|
|
36
|
+
item += this.getElement('is_new', car.is_new, true);
|
|
37
|
+
item += this.getElement('date', car.date, true);
|
|
38
|
+
item += this.getElement('time', car.time, true);
|
|
39
|
+
item += '</ad>';
|
|
40
|
+
|
|
41
|
+
await this.write(item);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async buildEnd(): Promise<void> {
|
|
45
|
+
await this.write('\n</ooyyo>');
|
|
46
|
+
await this.end();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
-
import { RubrikkXmlItem } from '../interfaces';
|
|
3
|
-
|
|
4
|
-
export class RubrikkXmlBuilder extends XMLBuilderBase {
|
|
5
|
-
async buildStart(): Promise<void> {
|
|
6
|
-
await this.write('<?xml version="1.0" encoding="UTF-8"?><rubrikk>');
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
async addItem(car: RubrikkXmlItem): Promise<void> {
|
|
10
|
-
let item = '\n<ad>\n';
|
|
11
|
-
|
|
12
|
-
const tags = Object.keys(car);
|
|
13
|
-
|
|
14
|
-
for (const tag of tags) {
|
|
15
|
-
const value = car[tag];
|
|
16
|
-
item += this.getElement(tag, value, true);
|
|
17
|
-
}
|
|
18
|
-
item += '</ad>';
|
|
19
|
-
|
|
20
|
-
await this.write(item);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async buildEnd(): Promise<void> {
|
|
24
|
-
await this.write('</rubrikk>');
|
|
25
|
-
await this.end();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
+
import { RubrikkXmlItem } from '../interfaces';
|
|
3
|
+
|
|
4
|
+
export class RubrikkXmlBuilder extends XMLBuilderBase {
|
|
5
|
+
async buildStart(): Promise<void> {
|
|
6
|
+
await this.write('<?xml version="1.0" encoding="UTF-8"?><rubrikk>');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async addItem(car: RubrikkXmlItem): Promise<void> {
|
|
10
|
+
let item = '\n<ad>\n';
|
|
11
|
+
|
|
12
|
+
const tags = Object.keys(car);
|
|
13
|
+
|
|
14
|
+
for (const tag of tags) {
|
|
15
|
+
const value = car[tag];
|
|
16
|
+
item += this.getElement(tag, value, true);
|
|
17
|
+
}
|
|
18
|
+
item += '</ad>';
|
|
19
|
+
|
|
20
|
+
await this.write(item);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async buildEnd(): Promise<void> {
|
|
24
|
+
await this.write('</rubrikk>');
|
|
25
|
+
await this.end();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
+
|
|
3
|
+
export class SantanderCSVBuilder extends XMLBuilderBase {
|
|
4
|
+
async buildStart(): Promise<void> {
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
async addItem(car: unknown): Promise<void> {
|
|
8
|
+
let values = Object.values(car);
|
|
9
|
+
await this.write(values.join('","') + '\n');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async buildEnd(): Promise<void> {
|
|
13
|
+
await this.end();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
-
import { TrovitXmlItem } from '../interfaces';
|
|
3
|
-
|
|
4
|
-
export class TrovitXmlBuilder extends XMLBuilderBase {
|
|
5
|
-
async buildStart(): Promise<void> {
|
|
6
|
-
await this.write('<?xml version="1.0" encoding="utf-8"?>\n<trovit>\n');
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
async addItem(car: TrovitXmlItem): Promise<void> {
|
|
10
|
-
let item = '\n<ad>\n';
|
|
11
|
-
|
|
12
|
-
const tags = Object.keys(car);
|
|
13
|
-
|
|
14
|
-
for (const tag of tags) {
|
|
15
|
-
if (tag === 'pictures') {
|
|
16
|
-
item += this.mapPictures(car[tag]);
|
|
17
|
-
} else {
|
|
18
|
-
item += this.getElement(tag, car[tag]?.value, true, car[tag]?.atributes);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
item += '</ad>';
|
|
22
|
-
|
|
23
|
-
await this.write(item);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async buildEnd(): Promise<void> {
|
|
27
|
-
await this.write('</trovit>');
|
|
28
|
-
await this.end();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
mapPictures(images: Array<string>) {
|
|
32
|
-
let item = '<pictures>';
|
|
33
|
-
|
|
34
|
-
images.map(url => {
|
|
35
|
-
item += '<picture>\n';
|
|
36
|
-
item += this.getElement('picture_url', url, true);
|
|
37
|
-
item += '</picture>\n';
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
item += '</pictures>\n';
|
|
41
|
-
|
|
42
|
-
return item;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
import { XMLBuilderBase } from '@bytebrand/cronicle-helper';
|
|
2
|
+
import { TrovitXmlItem } from '../interfaces';
|
|
3
|
+
|
|
4
|
+
export class TrovitXmlBuilder extends XMLBuilderBase {
|
|
5
|
+
async buildStart(): Promise<void> {
|
|
6
|
+
await this.write('<?xml version="1.0" encoding="utf-8"?>\n<trovit>\n');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async addItem(car: TrovitXmlItem): Promise<void> {
|
|
10
|
+
let item = '\n<ad>\n';
|
|
11
|
+
|
|
12
|
+
const tags = Object.keys(car);
|
|
13
|
+
|
|
14
|
+
for (const tag of tags) {
|
|
15
|
+
if (tag === 'pictures') {
|
|
16
|
+
item += this.mapPictures(car[tag]);
|
|
17
|
+
} else {
|
|
18
|
+
item += this.getElement(tag, car[tag]?.value, true, car[tag]?.atributes);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
item += '</ad>';
|
|
22
|
+
|
|
23
|
+
await this.write(item);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async buildEnd(): Promise<void> {
|
|
27
|
+
await this.write('</trovit>');
|
|
28
|
+
await this.end();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
mapPictures(images: Array<string>) {
|
|
32
|
+
let item = '<pictures>';
|
|
33
|
+
|
|
34
|
+
images.map(url => {
|
|
35
|
+
item += '<picture>\n';
|
|
36
|
+
item += this.getElement('picture_url', url, true);
|
|
37
|
+
item += '</picture>\n';
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
item += '</pictures>\n';
|
|
41
|
+
|
|
42
|
+
return item;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface IAtributeWrapItem {
|
|
2
|
-
value: string | boolean | number;
|
|
3
|
-
atributes?: {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
};
|
|
6
|
-
}
|
|
1
|
+
export interface IAtributeWrapItem {
|
|
2
|
+
value: string | boolean | number;
|
|
3
|
+
atributes?: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export interface DealersMapping {
|
|
2
|
-
firebaseUserId: string;
|
|
3
|
-
dealerId: string;
|
|
4
|
-
dealerEmail: string;
|
|
5
|
-
combinationId: string;
|
|
6
|
-
aos24Id?: string;
|
|
7
|
-
}
|
|
1
|
+
export interface DealersMapping {
|
|
2
|
+
firebaseUserId: string;
|
|
3
|
+
dealerId: string;
|
|
4
|
+
dealerEmail: string;
|
|
5
|
+
combinationId: string;
|
|
6
|
+
aos24Id?: string;
|
|
7
|
+
}
|