@manyos/smileconnect-api 1.28.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.
Files changed (141) hide show
  1. package/.github/workflows/nodejs.yml +26 -0
  2. package/CHANGELOG.md +75 -0
  3. package/Dockerfile +21 -0
  4. package/README.md +1 -0
  5. package/app.js +316 -0
  6. package/conf/clients.json +2491 -0
  7. package/conf/mapping.json +1048 -0
  8. package/conf/scripts/p1.js +11 -0
  9. package/conf/scripts/p2.js +1 -0
  10. package/conf/scripts/p3.js +1 -0
  11. package/conf/scripts/p4.js +2 -0
  12. package/conf/scripts/script1.js +2 -0
  13. package/conf/scripts/script2.js +2 -0
  14. package/conf/scripts/script3.js +2 -0
  15. package/controller/cmdbobjectController.js +291 -0
  16. package/controller/eventLogController.js +78 -0
  17. package/controller/orgdataController.js +440 -0
  18. package/controller/relatedObjectsController.js +194 -0
  19. package/controller/scriptController.js +213 -0
  20. package/controller/taskController.js +368 -0
  21. package/controller/templateController.js +97 -0
  22. package/controller/ticketCIRelationController.js +522 -0
  23. package/controller/ticketController.js +329 -0
  24. package/controller/ticketWorkLogController.js +195 -0
  25. package/docs/.gitattributes +48 -0
  26. package/docs/404.html +13 -0
  27. package/docs/CNAME +1 -0
  28. package/docs/Gemfile +7 -0
  29. package/docs/Gemfile.lock +249 -0
  30. package/docs/_config.yml +257 -0
  31. package/docs/_data/SocialNetworks.yml +92 -0
  32. package/docs/_data/ui-text.yml +494 -0
  33. package/docs/_includes/disqus.html +17 -0
  34. package/docs/_includes/ext-css.html +7 -0
  35. package/docs/_includes/ext-js.html +7 -0
  36. package/docs/_includes/fb-comment.html +14 -0
  37. package/docs/_includes/footer-minimal.html +16 -0
  38. package/docs/_includes/footer-scripts.html +32 -0
  39. package/docs/_includes/footer.html +51 -0
  40. package/docs/_includes/google_analytics.html +14 -0
  41. package/docs/_includes/gtag.html +11 -0
  42. package/docs/_includes/gtm_body.html +6 -0
  43. package/docs/_includes/gtm_head.html +9 -0
  44. package/docs/_includes/head.html +131 -0
  45. package/docs/_includes/header.html +76 -0
  46. package/docs/_includes/just_comments.html +4 -0
  47. package/docs/_includes/matomo.html +17 -0
  48. package/docs/_includes/nav.html +57 -0
  49. package/docs/_includes/social-share.html +42 -0
  50. package/docs/_includes/staticman-comment.html +22 -0
  51. package/docs/_includes/staticman-comments.html +81 -0
  52. package/docs/_layouts/base.html +35 -0
  53. package/docs/_layouts/default.html +9 -0
  54. package/docs/_layouts/minimal.html +26 -0
  55. package/docs/_layouts/page.html +26 -0
  56. package/docs/_layouts/post.html +82 -0
  57. package/docs/_posts/2015-02-28-test-markdown.md +77 -0
  58. package/docs/aboutme.md +18 -0
  59. package/docs/css/bootstrap-social.css +147 -0
  60. package/docs/css/bootstrap-theme.css +476 -0
  61. package/docs/css/bootstrap-theme.css.map +1 -0
  62. package/docs/css/bootstrap-theme.min.css +5 -0
  63. package/docs/css/bootstrap.css +6566 -0
  64. package/docs/css/bootstrap.css.map +1 -0
  65. package/docs/css/bootstrap.min.css +5 -0
  66. package/docs/css/main-minimal.css +13 -0
  67. package/docs/css/main.css +788 -0
  68. package/docs/css/normalize.css +427 -0
  69. package/docs/css/pygment_highlights.css +61 -0
  70. package/docs/css/staticman.css +180 -0
  71. package/docs/eventlog/events.md +65 -0
  72. package/docs/feed.xml +24 -0
  73. package/docs/general/architecture.md +10 -0
  74. package/docs/general/config.md +192 -0
  75. package/docs/general/field-management.md +119 -0
  76. package/docs/general/release-notes.md +9 -0
  77. package/docs/getting-started.md +19 -0
  78. package/docs/howto/cmdbobjects.md +339 -0
  79. package/docs/howto/incident-worklogs.md +186 -0
  80. package/docs/howto/incidents.md +244 -0
  81. package/docs/howto/sample-config.md +518 -0
  82. package/docs/howto/token.md +71 -0
  83. package/docs/howto/worklog-attachment.md +113 -0
  84. package/docs/img/404-southpark.jpg +0 -0
  85. package/docs/img/architecture.jpeg +0 -0
  86. package/docs/img/attachment-upload.png +0 -0
  87. package/docs/img/avatar-icon.png +0 -0
  88. package/docs/img/bgimage.png +0 -0
  89. package/docs/img/gb-isapi.jpg +0 -0
  90. package/docs/img/install-steps.gif +0 -0
  91. package/docs/img/workflow.png +0 -0
  92. package/docs/index.md +41 -0
  93. package/docs/installation.md +123 -0
  94. package/docs/js/bootstrap.js +2306 -0
  95. package/docs/js/bootstrap.min.js +7 -0
  96. package/docs/js/jquery-1.11.2.min.js +4 -0
  97. package/docs/js/main.js +140 -0
  98. package/docs/js/staticman.js +54 -0
  99. package/docs/openapi.json +15097 -0
  100. package/docs/postinstall.md +169 -0
  101. package/docs/preinstall.md +19 -0
  102. package/docs/spec/index.html +24 -0
  103. package/docs/staticman.yml +110 -0
  104. package/docs/tags.html +34 -0
  105. package/docs/workflow.md +127 -0
  106. package/nodemon.json +3 -0
  107. package/package.json +46 -0
  108. package/routes/appConfigRoutes.js +352 -0
  109. package/routes/ciRelationRoutes.js +38 -0
  110. package/routes/cmdbObjectRoutes.js +154 -0
  111. package/routes/organisationRoutes.js +121 -0
  112. package/routes/peopleRelationRoutes.js +38 -0
  113. package/routes/personRoutes.js +131 -0
  114. package/routes/supportgroupRoutes.js +122 -0
  115. package/routes/taskRoutes.js +306 -0
  116. package/routes/templateRoutes.js +67 -0
  117. package/routes/ticketRoutes.js +181 -0
  118. package/routes/ticketWorkLogRoutes.js +185 -0
  119. package/screwdriver.yaml +52 -0
  120. package/test/appTest.js +3 -0
  121. package/test/changeTest.js +541 -0
  122. package/test/cmdbobjectTest.js +167 -0
  123. package/test/files/logo.png +0 -0
  124. package/test/incidentTest.js +539 -0
  125. package/test/orgdataTest.js +156 -0
  126. package/test/problemTest.js +512 -0
  127. package/test/templateTest.js +80 -0
  128. package/test/testUtils.js +21 -0
  129. package/test/workorderTest.js +544 -0
  130. package/util/arquery.js +416 -0
  131. package/util/auth.js +37 -0
  132. package/util/cache.service.js +52 -0
  133. package/util/config.js +361 -0
  134. package/util/constants.js +73 -0
  135. package/util/mappingUtil.js +96 -0
  136. package/util/paramHelper.js +43 -0
  137. package/util/relationUtil.js +63 -0
  138. package/util/responsehandler.js +92 -0
  139. package/util/schemas/clientConfigSchema.js +180 -0
  140. package/util/schemas/fieldMappingSchema.js +211 -0
  141. package/util/searchUtil.js +148 -0
@@ -0,0 +1,11 @@
1
+ const allowedCats = [
2
+ "Request",
3
+ "Failure"
4
+ ];
5
+
6
+ //Validate opsCat1
7
+ if (requestData.opsCat1 && !allowedCats.find(element => element === requestData.opsCat1)) {
8
+ reject(`opsCat1 ${requestData.opsCat1} not in allowed values ${allowedCats}`);
9
+ }
10
+ requestData.summary = `Da kam an: ${requestData.summary}`
11
+ resolve();
@@ -0,0 +1 @@
1
+ resolve();
@@ -0,0 +1 @@
1
+ resolve();
@@ -0,0 +1,2 @@
1
+ //requestData.horst="da"
2
+ resolve();
@@ -0,0 +1,2 @@
1
+ //requestData.Status = "Horstdi";
2
+ resolve();
@@ -0,0 +1,2 @@
1
+ //requestData.Status = "Horstdi2";
2
+ resolve();
@@ -0,0 +1,2 @@
1
+ //reject('ich mag das nicht')
2
+ resolve()
@@ -0,0 +1,291 @@
1
+ require('dotenv').config();
2
+ const path = require('path');
3
+ const log = require('@manyos/logger').setupLog('SMILEconnect_' + path.basename(__filename));
4
+ const arquery = require('../util/arquery');
5
+ const CacheService = require ('../util/cache.service');
6
+ const config = require('../util/config');
7
+ const CONSTANTS = require('../util/constants');
8
+ const searchUtil = require('../util/searchUtil');
9
+ const {getIncludeArray} = require('../util/paramHelper');
10
+ const relationUtil = require('../util/relationUtil');
11
+ const ticketCIRelationController = require('../controller/ticketCIRelationController');
12
+
13
+ const cmdbCache = new CacheService(process.env.CACHETTL_CMDB || 600); // Create a new cache service instance
14
+ const schemaCache = new CacheService(process.env.CACHETTL_SCHEMANAMES || 3600); // Create a new cache service instance
15
+
16
+ function getCmdbObjects(config, category, ciIds, includeString) {
17
+ let query = '1=1';
18
+ if (category)
19
+ query = `'Category' = \"${category}\"`;
20
+
21
+ if (ciIds) {
22
+ let ciQuery = " AND (";
23
+ let x = 0;
24
+ for (x= 0; x<ciIds.length -1; x++) {
25
+ const ciInstanceId = ciIds[x].trim();
26
+ ciQuery = ciQuery + "'Instance Id' = \""+ciInstanceId + "\" OR ";
27
+ }
28
+ ciQuery = ciQuery + "'Instance Id' = \"" + ciIds[ciIds.length -1].trim() + "\"";
29
+ query = query + ciQuery + ')';
30
+ log.error('query', query);
31
+ }
32
+ return queryCMDBObject(config, query, null, null, includeString);
33
+ }
34
+
35
+ function getCIRelations(clientConfig, id) {
36
+ const query = `('Source.InstanceId'=\"${id}\" OR 'Destination.InstanceId'=\"${id}\")AND('MarkAsDeleted'=$NULL$ OR 'MarkAsDeleted'=\"No\")`;
37
+ return cmdbCache.get(query, function () {
38
+ return new Promise((resolve, reject) => {
39
+ arquery.executeARQuery('BMC.CORE:BMC_BaseRelationship', "'DatasetId'=\"BMC.ASSET\"", query, '490008000,490009000,400079600,Destination.ClassId, Source.ClassId', clientConfig.options)
40
+ .then(function (result) {
41
+ log.debug(result);
42
+ //const mapping = [{"oldName":"Model Number", "newName" : "model"}, {"oldName":"Model Number", "newName" : "model"}]
43
+ if (result && result.data) {
44
+ result.data.forEach(function (element) {
45
+ element.ciId = element['Source.InstanceId'];
46
+ element.ciClass = element['Source.ClassId'];
47
+ element.direction = 'parent';
48
+ element.relationClass = element['ClassId'];
49
+ if (element['Source.InstanceId'] === id) {
50
+ element.ciId = element['Destination.InstanceId'];
51
+ element.direction = 'child';
52
+ element.ciClass = element['Destination.ClassId'];
53
+ }
54
+ delete element['RequestId'];
55
+ delete element['ClassId'];
56
+ delete element['Source.InstanceId'];
57
+ delete element['Destination.InstanceId'];
58
+ delete element['Source.ClassId'];
59
+ delete element['Destination.ClassId'];
60
+ });
61
+ }
62
+ resolve(result.data || []);
63
+ })
64
+ .catch(function (reason) {
65
+ log.error(reason);
66
+ reject(reason);
67
+ })
68
+ });
69
+ });
70
+ }
71
+
72
+ function getPeopleRelations(clientConfig, reconId, relationType) {
73
+ const query = `'AssetInstanceId'=\"${reconId}\"`;
74
+ return cmdbCache.get(query + relationType, function () {
75
+ return new Promise((resolve, reject) => {
76
+ arquery.executeARQuery('AST:AssetPeople', `'Request_Type'="${relationType}"`, query, '304327610, 260100006, 260100003, 260100005', clientConfig.options)
77
+ .then(function (result) {
78
+ const relations = [];
79
+ if (result && result.data) {
80
+ result.data.forEach(function (element) {
81
+ if (element['Request_Type'] === 'People') {
82
+ relations.push({"id" : element['PeopleGroup Form Entry ID'], "role":element['PersonRole']});
83
+ } else if (element['Request_Type'] === 'People Organization') {
84
+ relations.push({"id" : element['PeopleGroup Form Entry ID'], "role":element['PersonRole']});
85
+ } else if (element['Request_Type'] === 'Support Group') {
86
+ relations.push({"id" : element['PeopleGroup Form Entry ID'], "role":element['PersonRole']});
87
+ }
88
+ });
89
+ }
90
+
91
+ log.debug(result);
92
+ resolve(relations || []);
93
+ })
94
+ .catch(function (reason) {
95
+ log.error(reason);
96
+ reject(reason);
97
+ })
98
+ });
99
+ });
100
+ }
101
+
102
+ function getSchemaName(classId) {
103
+ if (classId) {
104
+ return schemaCache.get(classId, async function () {
105
+ const result = await arquery.executeARQuery('SHR:SchemaNames', null, `'Lookup Keyword'="${classId}" AND 'Locale'=$NULL$`, 'Schema Name');
106
+ log.debug('lookup schema', classId, result);
107
+ if (result && result.data && Array.isArray(result.data) && result.data.length > 0) {
108
+ return result.data[0]['Schema Name'];
109
+ } else {
110
+ return undefined;
111
+ }
112
+ });
113
+ }
114
+ }
115
+
116
+ function queryCMDBObject(clientConfig, query, customFields, customOptions, includeString) {
117
+ let fields = clientConfig.cmdbobject.fields;
118
+ let deleteClassId = false;
119
+
120
+ const includeArray = getIncludeArray(includeString);
121
+ //check for customFields
122
+ if (customFields !== null && customFields !== undefined) {
123
+ fields = customFields;
124
+ }
125
+
126
+ if (!fields.includes('Class Id') && includeArray.includes('classAttributes')) {
127
+ fields.push('Class Id');
128
+ deleteClassId = true;
129
+ log.debug('Add classId');
130
+ }
131
+
132
+ const options = {
133
+ ...clientConfig.options, ...customOptions
134
+ };
135
+
136
+ log.debug('use joined options', options);
137
+
138
+ const key = clientConfig.cmdbobject.basequery + fields.toString() + query + JSON.stringify(options) + includeArray;
139
+ log.debug('Cachekey is', key);
140
+
141
+ const mapping = config.getMapping('cmdbobject');
142
+ log.debug('mapping', mapping);
143
+
144
+ return cmdbCache.get(key, async function () {
145
+ const result = await arquery.executeARQuery('AST:BaseElement', clientConfig.cmdbobject.basequery || null, query, fields.toString() || '1', options);
146
+ const globalRelationObjects = relationUtil.prepareGlobalRelationObject();
147
+ const cmdbObjects = [];
148
+ if (result && result.data && result.data.length) {
149
+ let x = 0;
150
+ for (x=0; x< result.data.length; x++) {
151
+ const cmdbObject = await handleCMDBObjectResult(result.data[x], mapping, clientConfig, includeArray, globalRelationObjects, deleteClassId);
152
+ cmdbObjects.push(cmdbObject);
153
+ }
154
+ }
155
+ log.debug('cahce', cmdbCache.getTtl(key));
156
+ return {
157
+ "data": cmdbObjects,
158
+ "included": globalRelationObjects
159
+ };
160
+ });
161
+ }
162
+
163
+ async function handleCMDBObjectResult(cmdbObject, mapping, clientConfig, includeArray, globalRelationObjects, deleteClassId) {
164
+ //get class form
165
+ const classId = cmdbObject['Class Id'];
166
+ if (deleteClassId === true) {
167
+ delete cmdbObject['Class Id'];
168
+ }
169
+ //Apply mapping
170
+ mapping.forEach(function (mappingEntry) {
171
+ try {
172
+ Object.defineProperty(cmdbObject, mappingEntry.newName, Object.getOwnPropertyDescriptor(cmdbObject, mappingEntry.oldName));
173
+ delete cmdbObject[mappingEntry.oldName];
174
+ } catch (e) {
175
+ //ignore missing mapping
176
+ }
177
+ });
178
+ delete cmdbObject['Request ID'];
179
+ if (cmdbObject.reconId && cmdbObject.classId && process.env.FEDERATED_BASE_URI) {
180
+ //create link to smartit
181
+ cmdbObject.federatedLink = (process.env.FEDERATED_BASE_URI || '') + cmdbObject.reconId + '/' + cmdbObject.classId;
182
+ }
183
+
184
+ cmdbObject.relations = {};
185
+
186
+ if (includeArray.includes('ciRelations')) {
187
+ const relations = await getCIRelations(clientConfig, cmdbObject.id);
188
+ cmdbObject.relations.ciRelations = relations;
189
+ }
190
+ if (includeArray.includes('ticketRelations')) {
191
+ const relations = await ticketCIRelationController.getCITicketRelations(cmdbObject.id);
192
+ cmdbObject.relations.ticketRelations = relations;
193
+ }
194
+ if (includeArray.includes('personRelations')) {
195
+ const relations = await getPeopleRelations(clientConfig, cmdbObject.reconId, 'People');
196
+ cmdbObject.relations.personRelations = relations;
197
+ }
198
+
199
+ if (includeArray.includes('supportGroupRelations')) {
200
+ const relations = await getPeopleRelations(clientConfig, cmdbObject.reconId, 'Support Group');
201
+ cmdbObject.relations.supportGroupRelations = relations;
202
+ }
203
+
204
+ if (includeArray.includes('organisationRelations')) {
205
+ const relations = await getPeopleRelations(clientConfig, cmdbObject.reconId, 'People Organization');
206
+ cmdbObject.relations.organisationRelations = relations;
207
+ }
208
+
209
+ if (includeArray.includes('classAttributes')) {
210
+ const classAttributes = await getCMDBObjectClassAttributes(cmdbObject.id,classId, clientConfig);
211
+ cmdbObject = {
212
+ ...cmdbObject, ...classAttributes
213
+ }
214
+ }
215
+
216
+ relationUtil.getRelatedObjectList(cmdbObject, includeArray, globalRelationObjects);
217
+
218
+ return cmdbObject;
219
+ }
220
+
221
+ async function getCMDBObjectClassAttributes(id, classId, clientConfig) {
222
+ const schemaName = await getSchemaName(classId);
223
+ const mapping = config.getMapping('cmdbobject_' + schemaName);
224
+ const fields = clientConfig.cmdbobject['fields_' + schemaName];
225
+ if (schemaName && fields && mapping) {
226
+ return cmdbCache.get(id+classId+fields, async function () {
227
+ const result = await arquery.executeARQuery(schemaName, null, `'179'="${id}"`, fields.toString());
228
+ log.debug('classAttributes Result', result);
229
+ if (result && result.data && Array.isArray(result.data)) {
230
+ const classObject = result.data[0];
231
+ mapping.forEach(function (mappingEntry) {
232
+ try {
233
+ Object.defineProperty(classObject, mappingEntry.newName, Object.getOwnPropertyDescriptor(classObject, mappingEntry.oldName));
234
+ delete classObject[mappingEntry.oldName];
235
+ } catch (e) {
236
+ //ignore missing mapping
237
+ }
238
+ });
239
+ delete classObject['Request ID'];
240
+ return classObject;
241
+ }
242
+ });
243
+ } else {
244
+ log.debug('no schemaname nor fieldconfig nor mapping found', {id, classId, schemaName, mapping});
245
+ return undefined;
246
+ }
247
+ }
248
+
249
+ async function getCmdbObject(config, id, includeString) {
250
+ const query = `'Instance Id'=\"${id}\"`;
251
+ const returnValue = await queryCMDBObject(config, query, null, null, includeString);
252
+ log.debug (returnValue);
253
+ const cmdbObject = returnValue.data[0];
254
+ return {data: cmdbObject, included: returnValue.included};
255
+ }
256
+
257
+ async function hasAccess(config, id) {
258
+ const query = `'Instance Id'=\"${id}\"`;
259
+ const returnValue = await queryCMDBObject(config, query, ['1']);
260
+ log.debug ('got', returnValue);
261
+ return returnValue.data.length === 1;
262
+ }
263
+
264
+ async function applyMapping(clientConfig, data) {
265
+ const mapping = config.getMapping('cmdbobject');
266
+ const mappedRecord = searchUtil.applyMapping2record(data, clientConfig, mapping);
267
+ return mappedRecord;
268
+ }
269
+
270
+ function searchCmdbObjectByName(config, name, includeString) {
271
+ const query = `'Name'LIKE\"%${name}%\"`;
272
+ return queryCMDBObject(config, query, null, null, includeString);
273
+ }
274
+
275
+ function searchCmdbObject(clientConfig, searchString, fields, options, includeString) {
276
+ const mapping = config.getMapping('cmdbobject');
277
+ const mappedString = searchUtil.applyMapping(searchString, mapping);
278
+ const customFields = searchUtil.getCustomFields(clientConfig.cmdbobject.fields, mapping, fields);
279
+ options.sort = searchUtil.applySortMapping(options.sort, mapping);
280
+ return queryCMDBObject(clientConfig, mappedString, customFields, options, includeString);
281
+ }
282
+
283
+ module.exports = {
284
+ getCmdbObjects,
285
+ getCmdbObject,
286
+ searchCmdbObjectByName,
287
+ searchCmdbObject,
288
+ getCIRelations,
289
+ hasAccess,
290
+ applyMapping
291
+ };
@@ -0,0 +1,78 @@
1
+ require('dotenv').config();
2
+ const path = require('path');
3
+ const log = require('@manyos/logger').setupLog('SMILEconnect_' + path.basename(__filename));
4
+ const arquery = require('../util/arquery');
5
+ const eventForm = 'MYS:SMILEconnect_QueueData';
6
+
7
+ function createEventLog(smileId, client, ticketNumber, schemaName, eventName, url, status, errorMsg, jsonData, ticketNumber2) {
8
+ return new Promise((resolve, reject) => {
9
+ let enable = process.env.EVENTLOG_ENABLE;
10
+ if (enable != null && enable != undefined && enable.toLowerCase() == 'true') {
11
+ const data = {
12
+ "InstanceId" : smileId,
13
+ "Status" : status,
14
+ "VendorID" : client,
15
+ "TicketNumber" : ticketNumber,
16
+ "TicketNumber2" : ticketNumber2,
17
+ "SchemaName" : schemaName,
18
+ "ErrorMsg" : errorMsg,
19
+ "Direction" : "Inbound",
20
+ "Event":eventName,
21
+ "URL":url
22
+ };
23
+ if (jsonData != null && jsonData != undefined) {
24
+ data['JsonValue'] = JSON.stringify(jsonData, null, 2);
25
+ }
26
+ arquery.createEntry(eventForm, data).then(function (result) {
27
+ resolve(result);
28
+ }).catch(error => {
29
+ reject(error);
30
+ });
31
+ } else {
32
+ resolve('Eventlog disabled');
33
+ }
34
+ });
35
+ }
36
+
37
+ function createErrorLog(smileId, client, ticketNumber, schemaName, eventName, url, errorMsg, jsonData, ticketNumber2) {
38
+ return createEventLog(smileId, client, ticketNumber, schemaName, eventName, url, 'Error', errorMsg, jsonData, ticketNumber2);
39
+ }
40
+
41
+ function createSuccessLog(smileId, client, ticketNumber, schemaName, eventName, url, jsonData, ticketNumber2) {
42
+ return createEventLog(smileId, client, ticketNumber, schemaName, eventName, url, 'Done', null, jsonData, ticketNumber2);
43
+ }
44
+
45
+ function setEventData(req, eventName, schemaName, ticketNumber, jsonData, ticketNumber2) {
46
+ req.eventData = {
47
+ event: eventName,
48
+ schema: schemaName,
49
+ "ticketNumber": ticketNumber,
50
+ "ticketNumber2": ticketNumber2,
51
+ "jsonData" : jsonData
52
+ };
53
+ }
54
+
55
+ function setEventData(req, eventBase, eventAction, schemaName, ticketNumber, jsonData, ticketNumber2) {
56
+ req.eventData = {
57
+ event: eventBase + '_' + eventAction,
58
+ schema: schemaName,
59
+ "ticketNumber": ticketNumber,
60
+ "ticketNumber2": ticketNumber2,
61
+ "jsonData" : jsonData
62
+ };
63
+ }
64
+
65
+ function setTicketId(req, ticketNumber) {
66
+ if (req.eventData === null || req.eventData === undefined) {
67
+ req.eventData = {};
68
+ }
69
+ req.eventData.ticketNumber = ticketNumber;
70
+ }
71
+
72
+ module.exports = {
73
+ createEventLog,
74
+ createSuccessLog,
75
+ createErrorLog,
76
+ setEventData,
77
+ setTicketId
78
+ };