@eventconnectors/ndtrc_model 1.0.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/index.js +30 -0
- package/package.json +19 -0
- package/src/model/ConvertedEntry.js +22 -0
- package/src/model/FetchedEntry.js +55 -0
- package/src/model/ndtrc/Address.js +70 -0
- package/src/model/ndtrc/Calendar.js +240 -0
- package/src/model/ndtrc/Categories.js +149 -0
- package/src/model/ndtrc/ContactInfo.js +186 -0
- package/src/model/ndtrc/ExtraPriceInformation.js +16 -0
- package/src/model/ndtrc/File.js +155 -0
- package/src/model/ndtrc/GISCoordinate.js +19 -0
- package/src/model/ndtrc/Location.js +22 -0
- package/src/model/ndtrc/Performer.js +9 -0
- package/src/model/ndtrc/PriceElement.js +64 -0
- package/src/model/ndtrc/Promotion.js +51 -0
- package/src/model/ndtrc/RouteInfo.js +34 -0
- package/src/model/ndtrc/SubItemGroup.js +102 -0
- package/src/model/ndtrc/TRCItem.js +133 -0
- package/src/model/ndtrc/TRCItemCategories.js +105 -0
- package/src/model/ndtrc/TRCItemDetail.js +10 -0
- package/src/model/ndtrc/TRCItemGroup.js +74 -0
- package/src/model/ndtrc/TRCItemRelation.js +13 -0
- package/src/model/ndtrc/Translations.js +8 -0
- package/src/model/ndtrc/enums.js +33 -0
- package/src/resources/schema/NDTRC-types-EVENTS.txt +0 -0
- package/src/resources/schema/NDTRC-types-locaties.txt +0 -0
- package/src/util/StringUtils.js +12 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
const moment = require('moment');
|
|
2
|
+
const Calendar = require('./Calendar');
|
|
3
|
+
const Contactinfo = require('./ContactInfo');
|
|
4
|
+
const TRCItemCategories = require('./TRCItemCategories');
|
|
5
|
+
const Performer = require('./Performer');
|
|
6
|
+
const File = require('./File');
|
|
7
|
+
const TRCItemDetail = require('./TRCItemDetail');
|
|
8
|
+
const TrcitemRelation = require('./TRCItemRelation');
|
|
9
|
+
const Location = require('./Location');
|
|
10
|
+
const PriceElement = require('./PriceElement');
|
|
11
|
+
const ExtraPriceInformation = require('./ExtraPriceInformation');
|
|
12
|
+
const RouteInfo = require('./RouteInfo');
|
|
13
|
+
const Translations = require('./Translations');
|
|
14
|
+
const Promotion = require('./Promotion');
|
|
15
|
+
|
|
16
|
+
class TRCItem {
|
|
17
|
+
constructor({
|
|
18
|
+
trcid = '',
|
|
19
|
+
creationdate = null,
|
|
20
|
+
availablefrom = null,
|
|
21
|
+
availableto = null,
|
|
22
|
+
lastupdated = null,
|
|
23
|
+
lastimportedon = null,
|
|
24
|
+
createdby = '',
|
|
25
|
+
lastupdatedby = '',
|
|
26
|
+
owner = '',
|
|
27
|
+
legalowner = '',
|
|
28
|
+
externalid = '',
|
|
29
|
+
slug = '',
|
|
30
|
+
validator = '',
|
|
31
|
+
validatedby = null,
|
|
32
|
+
wfstatus = null,
|
|
33
|
+
cidn = '',
|
|
34
|
+
published = false,
|
|
35
|
+
deleted = false,
|
|
36
|
+
offline = null,
|
|
37
|
+
isprivate = null,
|
|
38
|
+
entitytype = null,
|
|
39
|
+
productiontrcid = '',
|
|
40
|
+
calendar = null,
|
|
41
|
+
contactinfo = null,
|
|
42
|
+
trcItemCategories = null,
|
|
43
|
+
performers = [],
|
|
44
|
+
files = [],
|
|
45
|
+
trcItemDetails = [],
|
|
46
|
+
trcitemRelation = null,
|
|
47
|
+
keywords = '',
|
|
48
|
+
markers = '',
|
|
49
|
+
location = null,
|
|
50
|
+
locationRef = '',
|
|
51
|
+
userorganisation = '',
|
|
52
|
+
priceElements = [],
|
|
53
|
+
extrapriceinformations = [],
|
|
54
|
+
routeInfo = null,
|
|
55
|
+
translations = null,
|
|
56
|
+
promotions = []
|
|
57
|
+
} = {}) {
|
|
58
|
+
this.trcid = trcid;
|
|
59
|
+
this.creationdate = creationdate ? moment(creationdate) : null;
|
|
60
|
+
this.availablefrom = availablefrom ? moment(availablefrom) : null;
|
|
61
|
+
this.availableto = availableto ? moment(availableto) : null;
|
|
62
|
+
this.lastupdated = lastupdated ? moment(lastupdated) : null;
|
|
63
|
+
this.lastimportedon = lastimportedon ? moment(lastimportedon) : null;
|
|
64
|
+
this.createdby = createdby;
|
|
65
|
+
this.lastupdatedby = lastupdatedby;
|
|
66
|
+
this.owner = owner;
|
|
67
|
+
this.legalowner = legalowner;
|
|
68
|
+
this.externalid = externalid;
|
|
69
|
+
this.slug = slug;
|
|
70
|
+
this.validator = validator;
|
|
71
|
+
this.validatedby = validatedby;
|
|
72
|
+
this.wfstatus = wfstatus;
|
|
73
|
+
this.cidn = cidn;
|
|
74
|
+
this.published = published;
|
|
75
|
+
this.deleted = deleted;
|
|
76
|
+
this.offline = offline;
|
|
77
|
+
this.isprivate = isprivate;
|
|
78
|
+
this.entitytype = entitytype;
|
|
79
|
+
this.productiontrcid = productiontrcid;
|
|
80
|
+
this.calendar = calendar ? new Calendar(calendar) : null;
|
|
81
|
+
this.contactinfo = contactinfo ? new Contactinfo(contactinfo) : null;
|
|
82
|
+
this.trcItemCategories = trcItemCategories ? new TRCItemCategories(trcItemCategories) : null;
|
|
83
|
+
this.performers = performers.map(performer => new Performer(performer));
|
|
84
|
+
this.files = files.map(file => new File(file));
|
|
85
|
+
this.trcItemDetails = trcItemDetails.map(detail => new TRCItemDetail(detail));
|
|
86
|
+
this.trcitemRelation = trcitemRelation ? new TrcitemRelation(trcitemRelation) : null;
|
|
87
|
+
this.keywords = keywords;
|
|
88
|
+
this.markers = markers;
|
|
89
|
+
this.location = location ? new Location(location) : null;
|
|
90
|
+
this.locationRef = locationRef;
|
|
91
|
+
this.userorganisation = userorganisation;
|
|
92
|
+
this.priceElements = priceElements.map(element => new PriceElement(element));
|
|
93
|
+
this.extrapriceinformations = extrapriceinformations.map(
|
|
94
|
+
info => new ExtraPriceInformation(info)
|
|
95
|
+
);
|
|
96
|
+
this.routeInfo = routeInfo ? new RouteInfo(routeInfo) : null;
|
|
97
|
+
this.translations = translations ? new Translations(translations) : new Translations();
|
|
98
|
+
this.promotions = promotions.map(promotion => new Promotion(promotion));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
TRCItem.WFStatus = {
|
|
103
|
+
DRAFT: 'draft',
|
|
104
|
+
READY_FOR_VALIDATION: 'readyforvalidation',
|
|
105
|
+
APPROVED: 'approved',
|
|
106
|
+
REJECTED: 'rejected',
|
|
107
|
+
DELETED: 'deleted',
|
|
108
|
+
ARCHIVED: 'archived'
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
TRCItem.EntityType = {
|
|
112
|
+
EVENEMENT: 'EVENEMENT',
|
|
113
|
+
LOCATIE: 'LOCATIE',
|
|
114
|
+
EVENEMENTGROEP: 'EVENEMENTGROEP',
|
|
115
|
+
PLAATSREGIO: 'PLAATSREGIO',
|
|
116
|
+
ROUTE: 'ROUTE'
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
TRCItem.Category = class Category {
|
|
120
|
+
constructor({ id = '', translations = [] } = {}) {
|
|
121
|
+
this.id = id;
|
|
122
|
+
this.translations = translations.map(translation => new TRCItem.Category.Translation(translation));
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
TRCItem.Category.Translation = class Translation {
|
|
127
|
+
constructor({ lang = '', text = '' } = {}) {
|
|
128
|
+
this.lang = lang;
|
|
129
|
+
this.text = text;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
module.exports = TRCItem;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const StringUtils = require('../../util/StringUtils'); // Import StringUtils voor validaties
|
|
2
|
+
|
|
3
|
+
class TRCItemCategories {
|
|
4
|
+
constructor({ types = [], categories = [], soldout = null, canceled = null } = {}) {
|
|
5
|
+
this.types = types.map(type => new TRCItemCategories.Type(type));
|
|
6
|
+
this.categories = categories.map(category => new TRCItemCategories.Category(category));
|
|
7
|
+
this.soldout = soldout;
|
|
8
|
+
this.canceled = canceled;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
cleanEmptyItems() {
|
|
12
|
+
this.categories = this.categories.filter(category => {
|
|
13
|
+
if (!category || StringUtils.isEmpty(category.catid)) return false;
|
|
14
|
+
|
|
15
|
+
const dataType = category.datatype?.toLowerCase();
|
|
16
|
+
if (dataType === 'freetext' && !category.value) return false;
|
|
17
|
+
if (dataType === 'multichoice' && !category.categoryvalues.length) return false;
|
|
18
|
+
if (dataType === 'choice' && !category.valueid) return false;
|
|
19
|
+
|
|
20
|
+
return true;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
this.types = this.types.filter(type => type && !StringUtils.isEmpty(type.catid));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
TRCItemCategories.Type = class Type {
|
|
28
|
+
constructor({ catid = '', isDefault = false, categoryTranslations = [] } = {}) {
|
|
29
|
+
this.catid = catid;
|
|
30
|
+
this.isDefault = isDefault;
|
|
31
|
+
this.categoryTranslations = categoryTranslations.map(
|
|
32
|
+
translation => new TRCItemCategories.CategoryTranslation(translation)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
TRCItemCategories.Category = class Category {
|
|
38
|
+
constructor({
|
|
39
|
+
catid = '',
|
|
40
|
+
valueid = '',
|
|
41
|
+
value = '',
|
|
42
|
+
datatype = '',
|
|
43
|
+
categoryvalues = [],
|
|
44
|
+
categoryTranslations = [],
|
|
45
|
+
parentCategoryTranslations = [],
|
|
46
|
+
valueCategoryTranslations = []
|
|
47
|
+
} = {}) {
|
|
48
|
+
this.catid = catid;
|
|
49
|
+
this.valueid = valueid;
|
|
50
|
+
this.value = value;
|
|
51
|
+
this.datatype = datatype;
|
|
52
|
+
this.categoryvalues = categoryvalues.map(
|
|
53
|
+
value => new TRCItemCategories.CategoryValue(value)
|
|
54
|
+
);
|
|
55
|
+
this.categoryTranslations = categoryTranslations.map(
|
|
56
|
+
translation => new TRCItemCategories.CategoryTranslation(translation)
|
|
57
|
+
);
|
|
58
|
+
this.parentCategoryTranslations = parentCategoryTranslations.map(
|
|
59
|
+
translation => new TRCItemCategories.CategoryTranslation(translation)
|
|
60
|
+
);
|
|
61
|
+
this.valueCategoryTranslations = valueCategoryTranslations.map(
|
|
62
|
+
translation => new TRCItemCategories.CategoryTranslation(translation)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
TRCItemCategories.Category.DataType = {
|
|
68
|
+
YESNO: 'yesno',
|
|
69
|
+
NULLABLE_YESNO: 'nullableyesno',
|
|
70
|
+
CHOICE: 'choice',
|
|
71
|
+
MULTICHOICE: 'multichoice',
|
|
72
|
+
FREETEXT: 'freetext',
|
|
73
|
+
INTEGER: 'integer',
|
|
74
|
+
DECIMAL: 'decimal',
|
|
75
|
+
DATE: 'date'
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
TRCItemCategories.CategoryValue = class CategoryValue {
|
|
79
|
+
constructor({ catid = '', categorytranslations = [] } = {}) {
|
|
80
|
+
this.catid = catid;
|
|
81
|
+
this.categorytranslations = categorytranslations.map(
|
|
82
|
+
translation => new TRCItemCategories.CategoryTranslation(translation)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
TRCItemCategories.CategoryTranslation = class CategoryTranslation {
|
|
88
|
+
constructor({
|
|
89
|
+
catid = '',
|
|
90
|
+
lang = '',
|
|
91
|
+
label = '',
|
|
92
|
+
unit = '',
|
|
93
|
+
value = '',
|
|
94
|
+
explanation = ''
|
|
95
|
+
} = {}) {
|
|
96
|
+
this.catid = catid;
|
|
97
|
+
this.lang = lang;
|
|
98
|
+
this.label = label;
|
|
99
|
+
this.unit = unit;
|
|
100
|
+
this.value = value;
|
|
101
|
+
this.explanation = explanation;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
module.exports = TRCItemCategories;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class TRCItemDetail {
|
|
2
|
+
constructor({ lang = '', longdescription = '', shortdescription = '', title = '' } = {}) {
|
|
3
|
+
this.lang = lang;
|
|
4
|
+
this.longdescription = longdescription;
|
|
5
|
+
this.shortdescription = shortdescription;
|
|
6
|
+
this.title = title;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
module.exports = TRCItemDetail;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const moment = require('moment');
|
|
2
|
+
const Calendar = require('./Calendar');
|
|
3
|
+
const Contactinfo = require('./ContactInfo');
|
|
4
|
+
const TRCItemCategories = require('./TRCItemCategories');
|
|
5
|
+
const File = require('./File');
|
|
6
|
+
const TRCItemDetail = require('./TRCItemDetail');
|
|
7
|
+
const PriceElement = require('./PriceElement');
|
|
8
|
+
const Translations = require('./Translations');
|
|
9
|
+
const Promotion = require('./Promotion');
|
|
10
|
+
const TRCItem = require('./TRCItem');
|
|
11
|
+
|
|
12
|
+
class TRCItemGroup {
|
|
13
|
+
constructor({
|
|
14
|
+
trcid = '',
|
|
15
|
+
creationdate = null,
|
|
16
|
+
availablefrom = null,
|
|
17
|
+
availableto = null,
|
|
18
|
+
lastupdated = null,
|
|
19
|
+
lastimportedon = null,
|
|
20
|
+
createdby = '',
|
|
21
|
+
lastupdatedby = '',
|
|
22
|
+
owner = '',
|
|
23
|
+
legalowner = '',
|
|
24
|
+
externalid = '',
|
|
25
|
+
validator = '',
|
|
26
|
+
wfstatus = null,
|
|
27
|
+
calendar = null,
|
|
28
|
+
contactinfo = null,
|
|
29
|
+
trcItemCategories = null,
|
|
30
|
+
files = [],
|
|
31
|
+
trcItemDetails = [],
|
|
32
|
+
keywords = '',
|
|
33
|
+
markers = '',
|
|
34
|
+
userorganisation = '',
|
|
35
|
+
priceElements = [],
|
|
36
|
+
translations = null,
|
|
37
|
+
promotions = [],
|
|
38
|
+
eventLinks = []
|
|
39
|
+
} = {}) {
|
|
40
|
+
this.trcid = trcid;
|
|
41
|
+
this.creationdate = creationdate ? moment(creationdate) : null;
|
|
42
|
+
this.availablefrom = availablefrom ? moment(availablefrom) : null;
|
|
43
|
+
this.availableto = availableto ? moment(availableto) : null;
|
|
44
|
+
this.lastupdated = lastupdated ? moment(lastupdated) : null;
|
|
45
|
+
this.lastimportedon = lastimportedon ? moment(lastimportedon) : null;
|
|
46
|
+
this.createdby = createdby;
|
|
47
|
+
this.lastupdatedby = lastupdatedby;
|
|
48
|
+
this.owner = owner;
|
|
49
|
+
this.legalowner = legalowner;
|
|
50
|
+
this.externalid = externalid;
|
|
51
|
+
this.validator = validator;
|
|
52
|
+
this.wfstatus = wfstatus;
|
|
53
|
+
this.calendar = calendar ? new Calendar(calendar) : null;
|
|
54
|
+
this.contactinfo = contactinfo ? new Contactinfo(contactinfo) : null;
|
|
55
|
+
this.trcItemCategories = trcItemCategories ? new TRCItemCategories(trcItemCategories) : null;
|
|
56
|
+
this.files = files.map(file => new File(file));
|
|
57
|
+
this.trcItemDetails = trcItemDetails.map(detail => new TRCItemDetail(detail));
|
|
58
|
+
this.keywords = keywords;
|
|
59
|
+
this.markers = markers;
|
|
60
|
+
this.userorganisation = userorganisation;
|
|
61
|
+
this.priceElements = priceElements.map(element => new PriceElement(element));
|
|
62
|
+
this.translations = translations ? new Translations(translations) : new Translations();
|
|
63
|
+
this.promotions = promotions.map(promotion => new Promotion(promotion));
|
|
64
|
+
this.eventLinks = eventLinks.map(link => new TRCItemGroup.EventLink(link));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
TRCItemGroup.EventLink = class EventLink {
|
|
69
|
+
constructor({ eventId = '' } = {}) {
|
|
70
|
+
this.eventId = eventId;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
module.exports = TRCItemGroup;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const SubItemGroup = require('./SubItemGroup');
|
|
2
|
+
|
|
3
|
+
class TrcitemRelation {
|
|
4
|
+
constructor({ subItemGroups = [] } = {}) {
|
|
5
|
+
this.subItemGroups = subItemGroups.map(group => new SubItemGroup(group));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
cleanEmptyItems() {
|
|
9
|
+
this.subItemGroups.forEach(group => group.cleanEmptyItems());
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = TrcitemRelation;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// enums.js
|
|
2
|
+
|
|
3
|
+
const Status = Object.freeze({
|
|
4
|
+
NORMAL: 'normal',
|
|
5
|
+
CANCELLED: 'cancelled',
|
|
6
|
+
SOLDOUT: 'soldout',
|
|
7
|
+
MOVEDTO: 'movedto',
|
|
8
|
+
PREMIERE: 'premiere',
|
|
9
|
+
REPPRISE: 'reprise',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const CalendarType = Object.freeze({
|
|
13
|
+
NONE: 'NONE',
|
|
14
|
+
ALWAYSOPEN: 'ALWAYSOPEN',
|
|
15
|
+
ONREQUEST: 'ONREQUEST',
|
|
16
|
+
OPENINGTIMES: 'OPENINGTIMES',
|
|
17
|
+
PATTERNDATES: 'PATTERNDATES',
|
|
18
|
+
SINGLEDATES: 'SINGLEDATES',
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const RecurrencyType = Object.freeze({
|
|
22
|
+
DAILY: 'daily',
|
|
23
|
+
WEEKLY: 'weekly',
|
|
24
|
+
MONTHLY_SIMPLE: 'monthlySimple',
|
|
25
|
+
MONTHLY_COMPLEX: 'monthlyComplex',
|
|
26
|
+
YEARLY: 'yearly',
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
module.exports = {
|
|
30
|
+
Status,
|
|
31
|
+
CalendarType,
|
|
32
|
+
RecurrencyType,
|
|
33
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class StringUtils {
|
|
2
|
+
/**
|
|
3
|
+
* Controleert of een string leeg, null of undefined is.
|
|
4
|
+
* @param {string|null|undefined} str
|
|
5
|
+
* @returns {boolean} true als de string leeg is.
|
|
6
|
+
*/
|
|
7
|
+
static isEmpty(str) {
|
|
8
|
+
return !str || str.trim().length === 0;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module.exports = StringUtils;
|