@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.
- package/.github/workflows/nodejs.yml +26 -0
- package/CHANGELOG.md +75 -0
- package/Dockerfile +21 -0
- package/README.md +1 -0
- package/app.js +316 -0
- package/conf/clients.json +2491 -0
- package/conf/mapping.json +1048 -0
- package/conf/scripts/p1.js +11 -0
- package/conf/scripts/p2.js +1 -0
- package/conf/scripts/p3.js +1 -0
- package/conf/scripts/p4.js +2 -0
- package/conf/scripts/script1.js +2 -0
- package/conf/scripts/script2.js +2 -0
- package/conf/scripts/script3.js +2 -0
- package/controller/cmdbobjectController.js +291 -0
- package/controller/eventLogController.js +78 -0
- package/controller/orgdataController.js +440 -0
- package/controller/relatedObjectsController.js +194 -0
- package/controller/scriptController.js +213 -0
- package/controller/taskController.js +368 -0
- package/controller/templateController.js +97 -0
- package/controller/ticketCIRelationController.js +522 -0
- package/controller/ticketController.js +329 -0
- package/controller/ticketWorkLogController.js +195 -0
- package/docs/.gitattributes +48 -0
- package/docs/404.html +13 -0
- package/docs/CNAME +1 -0
- package/docs/Gemfile +7 -0
- package/docs/Gemfile.lock +249 -0
- package/docs/_config.yml +257 -0
- package/docs/_data/SocialNetworks.yml +92 -0
- package/docs/_data/ui-text.yml +494 -0
- package/docs/_includes/disqus.html +17 -0
- package/docs/_includes/ext-css.html +7 -0
- package/docs/_includes/ext-js.html +7 -0
- package/docs/_includes/fb-comment.html +14 -0
- package/docs/_includes/footer-minimal.html +16 -0
- package/docs/_includes/footer-scripts.html +32 -0
- package/docs/_includes/footer.html +51 -0
- package/docs/_includes/google_analytics.html +14 -0
- package/docs/_includes/gtag.html +11 -0
- package/docs/_includes/gtm_body.html +6 -0
- package/docs/_includes/gtm_head.html +9 -0
- package/docs/_includes/head.html +131 -0
- package/docs/_includes/header.html +76 -0
- package/docs/_includes/just_comments.html +4 -0
- package/docs/_includes/matomo.html +17 -0
- package/docs/_includes/nav.html +57 -0
- package/docs/_includes/social-share.html +42 -0
- package/docs/_includes/staticman-comment.html +22 -0
- package/docs/_includes/staticman-comments.html +81 -0
- package/docs/_layouts/base.html +35 -0
- package/docs/_layouts/default.html +9 -0
- package/docs/_layouts/minimal.html +26 -0
- package/docs/_layouts/page.html +26 -0
- package/docs/_layouts/post.html +82 -0
- package/docs/_posts/2015-02-28-test-markdown.md +77 -0
- package/docs/aboutme.md +18 -0
- package/docs/css/bootstrap-social.css +147 -0
- package/docs/css/bootstrap-theme.css +476 -0
- package/docs/css/bootstrap-theme.css.map +1 -0
- package/docs/css/bootstrap-theme.min.css +5 -0
- package/docs/css/bootstrap.css +6566 -0
- package/docs/css/bootstrap.css.map +1 -0
- package/docs/css/bootstrap.min.css +5 -0
- package/docs/css/main-minimal.css +13 -0
- package/docs/css/main.css +788 -0
- package/docs/css/normalize.css +427 -0
- package/docs/css/pygment_highlights.css +61 -0
- package/docs/css/staticman.css +180 -0
- package/docs/eventlog/events.md +65 -0
- package/docs/feed.xml +24 -0
- package/docs/general/architecture.md +10 -0
- package/docs/general/config.md +192 -0
- package/docs/general/field-management.md +119 -0
- package/docs/general/release-notes.md +9 -0
- package/docs/getting-started.md +19 -0
- package/docs/howto/cmdbobjects.md +339 -0
- package/docs/howto/incident-worklogs.md +186 -0
- package/docs/howto/incidents.md +244 -0
- package/docs/howto/sample-config.md +518 -0
- package/docs/howto/token.md +71 -0
- package/docs/howto/worklog-attachment.md +113 -0
- package/docs/img/404-southpark.jpg +0 -0
- package/docs/img/architecture.jpeg +0 -0
- package/docs/img/attachment-upload.png +0 -0
- package/docs/img/avatar-icon.png +0 -0
- package/docs/img/bgimage.png +0 -0
- package/docs/img/gb-isapi.jpg +0 -0
- package/docs/img/install-steps.gif +0 -0
- package/docs/img/workflow.png +0 -0
- package/docs/index.md +41 -0
- package/docs/installation.md +123 -0
- package/docs/js/bootstrap.js +2306 -0
- package/docs/js/bootstrap.min.js +7 -0
- package/docs/js/jquery-1.11.2.min.js +4 -0
- package/docs/js/main.js +140 -0
- package/docs/js/staticman.js +54 -0
- package/docs/openapi.json +15097 -0
- package/docs/postinstall.md +169 -0
- package/docs/preinstall.md +19 -0
- package/docs/spec/index.html +24 -0
- package/docs/staticman.yml +110 -0
- package/docs/tags.html +34 -0
- package/docs/workflow.md +127 -0
- package/nodemon.json +3 -0
- package/package.json +46 -0
- package/routes/appConfigRoutes.js +352 -0
- package/routes/ciRelationRoutes.js +38 -0
- package/routes/cmdbObjectRoutes.js +154 -0
- package/routes/organisationRoutes.js +121 -0
- package/routes/peopleRelationRoutes.js +38 -0
- package/routes/personRoutes.js +131 -0
- package/routes/supportgroupRoutes.js +122 -0
- package/routes/taskRoutes.js +306 -0
- package/routes/templateRoutes.js +67 -0
- package/routes/ticketRoutes.js +181 -0
- package/routes/ticketWorkLogRoutes.js +185 -0
- package/screwdriver.yaml +52 -0
- package/test/appTest.js +3 -0
- package/test/changeTest.js +541 -0
- package/test/cmdbobjectTest.js +167 -0
- package/test/files/logo.png +0 -0
- package/test/incidentTest.js +539 -0
- package/test/orgdataTest.js +156 -0
- package/test/problemTest.js +512 -0
- package/test/templateTest.js +80 -0
- package/test/testUtils.js +21 -0
- package/test/workorderTest.js +544 -0
- package/util/arquery.js +416 -0
- package/util/auth.js +37 -0
- package/util/cache.service.js +52 -0
- package/util/config.js +361 -0
- package/util/constants.js +73 -0
- package/util/mappingUtil.js +96 -0
- package/util/paramHelper.js +43 -0
- package/util/relationUtil.js +63 -0
- package/util/responsehandler.js +92 -0
- package/util/schemas/clientConfigSchema.js +180 -0
- package/util/schemas/fieldMappingSchema.js +211 -0
- package/util/searchUtil.js +148 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const log = require('@manyos/logger').setupLog('SMILEconnect_' + path.basename(__filename));
|
|
3
|
+
const {body, validationResult, oneOf} = require('express-validator/check');
|
|
4
|
+
const ticketController = require('../controller/ticketController');
|
|
5
|
+
const templateController = require('../controller/templateController');
|
|
6
|
+
const ticketCIRelationController = require('../controller/ticketCIRelationController');
|
|
7
|
+
const eventLog = require('../controller/eventLogController');
|
|
8
|
+
const CONSTANTS = require('../util/constants');
|
|
9
|
+
|
|
10
|
+
module.exports = (function() {
|
|
11
|
+
const ticketRoutes = require('express').Router();
|
|
12
|
+
|
|
13
|
+
const errorFormatter = ({location, msg, param, value, nestedErrors}) => {
|
|
14
|
+
// Build your resulting errors however you want! String, object, whatever - it works!
|
|
15
|
+
return `${location}[${param}]: ${msg}`;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
ticketRoutes.get('/', function (req, res, next) {
|
|
19
|
+
eventLog.setEventData(
|
|
20
|
+
req,
|
|
21
|
+
req.parentEventBase,
|
|
22
|
+
CONSTANTS.EVENT_ACTION_QUERY,
|
|
23
|
+
req.ticketConfig.forms.regular
|
|
24
|
+
);
|
|
25
|
+
const includeString = req.query.include;
|
|
26
|
+
|
|
27
|
+
const options = {};
|
|
28
|
+
const limit = req.query.limit;
|
|
29
|
+
if (limit != null && limit != undefined) {
|
|
30
|
+
options.limit = Number.parseInt(limit);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const offset = req.query.offset;
|
|
34
|
+
if (offset != null && offset != undefined) {
|
|
35
|
+
options.offset = Number.parseInt(offset);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ticketController.getTickets(req.ticketConfig, req.user.config, includeString, options).then(function (result) {
|
|
39
|
+
log.debug('result', result);
|
|
40
|
+
req.includeObjectsList = result.included;
|
|
41
|
+
req.result = {data:result.data};
|
|
42
|
+
next();
|
|
43
|
+
}).catch(function (reason) {
|
|
44
|
+
next(reason);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
ticketRoutes.post('/', [body('data.summary').isLength({min: 3})], function (req, res, next) {
|
|
49
|
+
//todo Errorhandling prüfen. Wenn parameter fehlen, wird nicht zurückgegeben welche
|
|
50
|
+
const origData = JSON.parse(JSON.stringify(req.body));
|
|
51
|
+
const includeString = req.query.include;
|
|
52
|
+
eventLog.setEventData(
|
|
53
|
+
req,
|
|
54
|
+
req.parentEventBase,
|
|
55
|
+
CONSTANTS.EVENT_ACTION_CREATE,
|
|
56
|
+
req.ticketConfig.forms.new,
|
|
57
|
+
null,
|
|
58
|
+
origData
|
|
59
|
+
);
|
|
60
|
+
const errors = validationResult(req).formatWith(errorFormatter);
|
|
61
|
+
if (!errors.isEmpty()) {
|
|
62
|
+
req.errorStatus = 422;
|
|
63
|
+
next(errors.array());
|
|
64
|
+
} else {
|
|
65
|
+
const relations = req.body.data.relations;
|
|
66
|
+
ticketController.createTicket(req.ticketConfig, req.user.config, req.body.data).then(async function (createResult) {
|
|
67
|
+
const ticketId = createResult.data[0][req.ticketConfig.ticketIdField];
|
|
68
|
+
eventLog.setTicketId(req, ticketId);
|
|
69
|
+
req.eventData.ticketNumber = ticketId;
|
|
70
|
+
await ticketCIRelationController.updateRelations(req.ticketConfig, req.user.config, ticketId, relations);
|
|
71
|
+
getTicket(req, res, next, req.user.config, ticketId, null, includeString);
|
|
72
|
+
}).catch(function (reason) {
|
|
73
|
+
next(reason);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
ticketRoutes.post('/search', [
|
|
79
|
+
body('searchString').isLength({ min: 1})
|
|
80
|
+
], function (req, res, next) {
|
|
81
|
+
|
|
82
|
+
const origData = JSON.parse(JSON.stringify(req.body));
|
|
83
|
+
const includeString = req.query.include;
|
|
84
|
+
eventLog.setEventData(
|
|
85
|
+
req,
|
|
86
|
+
req.parentEventBase,
|
|
87
|
+
CONSTANTS.EVENT_ACTION_SEARCH,
|
|
88
|
+
req.parentForm,
|
|
89
|
+
null,
|
|
90
|
+
origData
|
|
91
|
+
);
|
|
92
|
+
const options = {};
|
|
93
|
+
const offset = req.body.offset;
|
|
94
|
+
if (offset != null && offset != undefined && Number.isInteger(offset)) {
|
|
95
|
+
options.offset = offset;
|
|
96
|
+
}
|
|
97
|
+
const limit = req.body.limit;
|
|
98
|
+
if (limit != null && limit != undefined && Number.isInteger(limit)) {
|
|
99
|
+
options.limit = limit;
|
|
100
|
+
}
|
|
101
|
+
// check sorting
|
|
102
|
+
const sort = req.body.sort;
|
|
103
|
+
if (sort != null && sort != undefined) {
|
|
104
|
+
options.sort = sort;
|
|
105
|
+
}
|
|
106
|
+
log.debug('start global search', req.body);
|
|
107
|
+
const valResult = validationResult(req).formatWith(errorFormatter);
|
|
108
|
+
log.debug('validationResult', valResult.array());
|
|
109
|
+
if (!valResult.isEmpty()) {
|
|
110
|
+
next(valResult.array());
|
|
111
|
+
} else {
|
|
112
|
+
ticketController.searchTicket(req.ticketConfig, req.user.config, req.body.searchString, req.body.fields, options, includeString).then(function (result) {
|
|
113
|
+
log.debug('result', result);
|
|
114
|
+
req.includeObjectsList = result.included;
|
|
115
|
+
req.result = {data:result.data};
|
|
116
|
+
next();
|
|
117
|
+
}).catch(function (reason) {
|
|
118
|
+
next(reason);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
ticketRoutes.get('/:id', function (req, res, next) {
|
|
124
|
+
const id = req.params.id;
|
|
125
|
+
const includeString = req.query.include;
|
|
126
|
+
eventLog.setEventData(
|
|
127
|
+
req,
|
|
128
|
+
req.parentEventBase,
|
|
129
|
+
CONSTANTS.EVENT_ACTION_SEARCH,
|
|
130
|
+
req.parentForm,
|
|
131
|
+
id
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
getTicket(req, res, next, req.user.config, id, null, includeString);
|
|
135
|
+
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
function getTicket(req, res, next, clientConfig, id, mapping, includeString) {
|
|
139
|
+
ticketController.getTicket(req.ticketConfig, clientConfig, id, mapping, includeString).then(function (result) {
|
|
140
|
+
log.debug('result', result);
|
|
141
|
+
req.includeObjectsList = result.included;
|
|
142
|
+
req.result = {data:result.data || {}};
|
|
143
|
+
if (!result.data) {
|
|
144
|
+
req.responseStatus = 404;
|
|
145
|
+
}
|
|
146
|
+
next();
|
|
147
|
+
}).catch(function (reason) {
|
|
148
|
+
next (reason);
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
ticketRoutes.put('/:id', function (req, res, next) {
|
|
153
|
+
const id = req.params.id;
|
|
154
|
+
const origData = JSON.parse(JSON.stringify(req.body));
|
|
155
|
+
const includeString = req.query.include;
|
|
156
|
+
eventLog.setEventData(
|
|
157
|
+
req,
|
|
158
|
+
req.parentEventBase,
|
|
159
|
+
CONSTANTS.EVENT_ACTION_MODIFY,
|
|
160
|
+
req.ticketConfig.forms.regular,
|
|
161
|
+
id,
|
|
162
|
+
origData
|
|
163
|
+
);
|
|
164
|
+
const errors = validationResult(req).formatWith(errorFormatter);
|
|
165
|
+
if (!errors.isEmpty()) {
|
|
166
|
+
req.errorStatus = 422;
|
|
167
|
+
next(errors.array());
|
|
168
|
+
} else {
|
|
169
|
+
const relations = req.body.data.relations;
|
|
170
|
+
ticketController.updateTicket(req.ticketConfig, req.user.config, id, req.body.data)
|
|
171
|
+
.then(async function (updateResult) {
|
|
172
|
+
await ticketCIRelationController.updateRelations(req.ticketConfig, req.user.config, id, relations);
|
|
173
|
+
getTicket(req, res, next, req.user.config, id, null, includeString);
|
|
174
|
+
}).catch(function (reason) {
|
|
175
|
+
next(reason);
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
return ticketRoutes;
|
|
181
|
+
})();
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const log = require('@manyos/logger').setupLog('SMILEconnect_' + path.basename(__filename));
|
|
3
|
+
const {body, validationResult, oneOf} = require('express-validator/check');
|
|
4
|
+
const ticketWorkLogController = require('../controller/ticketWorkLogController');
|
|
5
|
+
const eventLog = require('../controller/eventLogController');
|
|
6
|
+
const CONSTANTS = require('../util/constants');
|
|
7
|
+
|
|
8
|
+
module.exports = (function() {
|
|
9
|
+
const ticketWorkLogRoutes = require('express').Router();
|
|
10
|
+
|
|
11
|
+
const errorFormatter = ({location, msg, param, value, nestedErrors}) => {
|
|
12
|
+
// Build your resulting errors however you want! String, object, whatever - it works!
|
|
13
|
+
return `${location}[${param}]: ${msg}`;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
ticketWorkLogRoutes.get('/', function (req, res, next) {
|
|
17
|
+
const id = req.parentId;
|
|
18
|
+
eventLog.setEventData(
|
|
19
|
+
req,
|
|
20
|
+
req.parentEventBase,
|
|
21
|
+
CONSTANTS.EVENT_ACTION_QUERY,
|
|
22
|
+
req.ticketConfig.forms.workLog,
|
|
23
|
+
id
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
ticketWorkLogController.getWorklogs(req.ticketConfig, req.user.config, id).then(function (result) {
|
|
27
|
+
req.result = {
|
|
28
|
+
data: result.data
|
|
29
|
+
};
|
|
30
|
+
next();
|
|
31
|
+
}).catch(function (reason) {
|
|
32
|
+
next(reason);
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
ticketWorkLogRoutes.get('/:worklogId', function (req, res, next) {
|
|
37
|
+
const ticketId = req.parentId;
|
|
38
|
+
const worklogId = req.params.worklogId;
|
|
39
|
+
eventLog.setEventData(
|
|
40
|
+
req,
|
|
41
|
+
req.parentEventBase,
|
|
42
|
+
CONSTANTS.EVENT_ACTION_QUERY,
|
|
43
|
+
req.ticketConfig.forms.workLog,
|
|
44
|
+
ticketId,
|
|
45
|
+
null,
|
|
46
|
+
worklogId
|
|
47
|
+
);
|
|
48
|
+
ticketWorkLogController.getWorklog(req.ticketConfig, req.user.config, ticketId, worklogId).then(function (result) {
|
|
49
|
+
req.result = result;
|
|
50
|
+
next();
|
|
51
|
+
}).catch(function (reason) {
|
|
52
|
+
next(reason);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
ticketWorkLogRoutes.post('/:worklogId/attachment', function (req, res, next) {
|
|
57
|
+
res.redirect(307, 'attachments/1');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
ticketWorkLogRoutes.post('/:worklogId/attachments/:attachmentId',
|
|
61
|
+
function (req, res, next) {
|
|
62
|
+
const ticketId = req.parentId;
|
|
63
|
+
const worklogId = req.params.worklogId;
|
|
64
|
+
const attachmentId = req.params.attachmentId;
|
|
65
|
+
|
|
66
|
+
eventLog.setEventData(
|
|
67
|
+
req,
|
|
68
|
+
req.parentEventBase,
|
|
69
|
+
CONSTANTS.EVENT_ACTION_CREATE,
|
|
70
|
+
req.ticketConfig.forms.workLog,
|
|
71
|
+
ticketId,
|
|
72
|
+
null,
|
|
73
|
+
worklogId
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
log.debug('files', req.files);
|
|
77
|
+
let fileContent = null;
|
|
78
|
+
|
|
79
|
+
let file = null;
|
|
80
|
+
if (req.files != null && req.files.file != null) {
|
|
81
|
+
file = req.files.file;
|
|
82
|
+
}
|
|
83
|
+
if (file == null || file == undefined) {
|
|
84
|
+
if (req.body.data != null && req.body.data != undefined) {
|
|
85
|
+
fileContent = req.body.data;
|
|
86
|
+
} else {
|
|
87
|
+
req.errorStatus = 400;
|
|
88
|
+
next({errorMessage:"No file or data send"});
|
|
89
|
+
};
|
|
90
|
+
} else {
|
|
91
|
+
//fileContent = JSON.parse(file.data);
|
|
92
|
+
ticketWorkLogController.setWorklogAttachment(req.ticketConfig, req.user.config, worklogId, file, attachmentId).then(
|
|
93
|
+
uploadResult => {
|
|
94
|
+
req.result = uploadResult;
|
|
95
|
+
next();
|
|
96
|
+
})
|
|
97
|
+
.catch(error => {
|
|
98
|
+
next(error);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
//defaults to attachment1 for compatibility
|
|
104
|
+
ticketWorkLogRoutes.get('/:worklogId/attachment', function (req, res, next) {
|
|
105
|
+
res.redirect('attachments/1');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
ticketWorkLogRoutes.get('/:worklogId/attachments/:attachmentId', function (req, res, next) {
|
|
109
|
+
const ticketId = req.parentId;
|
|
110
|
+
const worklogId = req.params.worklogId;
|
|
111
|
+
const attachmentId = req.params.attachmentId;
|
|
112
|
+
|
|
113
|
+
eventLog.setEventData(
|
|
114
|
+
req,
|
|
115
|
+
req.parentEventBase,
|
|
116
|
+
CONSTANTS.EVENT_ACTION_QUERY,
|
|
117
|
+
req.ticketConfig.forms.workLog,
|
|
118
|
+
ticketId,
|
|
119
|
+
null,
|
|
120
|
+
worklogId
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
//fileContent = JSON.parse(file.data);
|
|
124
|
+
ticketWorkLogController.getWorklogAttachment(req.ticketConfig, req.user.config, worklogId, attachmentId).then(
|
|
125
|
+
downloadResult => {
|
|
126
|
+
req.downloadResult = downloadResult;
|
|
127
|
+
next();
|
|
128
|
+
})
|
|
129
|
+
.catch(error => {
|
|
130
|
+
req.errorStatus = 404;
|
|
131
|
+
next(error);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
ticketWorkLogRoutes.post('/',[
|
|
137
|
+
body('data.summary').isLength({ min: 1, max: 100}),
|
|
138
|
+
body('data.text').isLength({ min: 1})
|
|
139
|
+
],
|
|
140
|
+
function (req, res, next) {
|
|
141
|
+
const origData = JSON.parse(JSON.stringify(req.body));
|
|
142
|
+
const ticketId = req.parentId;
|
|
143
|
+
|
|
144
|
+
eventLog.setEventData(
|
|
145
|
+
req,
|
|
146
|
+
req.parentEventBase,
|
|
147
|
+
CONSTANTS.EVENT_ACTION_CREATE,
|
|
148
|
+
req.ticketConfig.forms.workLog,
|
|
149
|
+
ticketId,
|
|
150
|
+
origData
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const errorFormatter = ({location, msg, param, value, nestedErrors}) => {
|
|
154
|
+
// Build your resulting errors however you want! String, object, whatever - it works!
|
|
155
|
+
return `${location}[${param}]: ${msg}`;
|
|
156
|
+
};
|
|
157
|
+
const result = validationResult(req).formatWith(errorFormatter);
|
|
158
|
+
if (!result.isEmpty()) {
|
|
159
|
+
req.errorStatus = 400;
|
|
160
|
+
next({validationErrors: result.array()});
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const reqPublic = req.body.data.isPublic;
|
|
164
|
+
let isPublic = false;
|
|
165
|
+
if (reqPublic != null && reqPublic != undefined && reqPublic.toLowerCase() === 'true') {
|
|
166
|
+
isPublic = true;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
ticketWorkLogController.createWorklog(req.ticketConfig, req.user.config, ticketId, req.body.data.summary, req.body.data.text, isPublic)
|
|
170
|
+
.then(result => {
|
|
171
|
+
const worklogId = result['0'];
|
|
172
|
+
req.eventData.ticketNumber2 = worklogId;
|
|
173
|
+
log.debug('WorkLog created', worklogId);
|
|
174
|
+
ticketWorkLogController.getWorklog(req.ticketConfig, req.user.config, ticketId, worklogId).then(worklogResult => {
|
|
175
|
+
req.result = worklogResult;
|
|
176
|
+
next();
|
|
177
|
+
});
|
|
178
|
+
})
|
|
179
|
+
.catch(error => {
|
|
180
|
+
next(error);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
return ticketWorkLogRoutes;
|
|
185
|
+
})();
|
package/screwdriver.yaml
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Shared definition block
|
|
2
|
+
shared:
|
|
3
|
+
# Source: https://hub.docker.com/r/library/buildpack-deps/
|
|
4
|
+
image: node:10
|
|
5
|
+
secrets:
|
|
6
|
+
- SCM_ACCESS_TOKEN
|
|
7
|
+
- SCM_USERNAME
|
|
8
|
+
# Job definition block
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
requires: [~pr, ~commit]
|
|
12
|
+
# Steps definition block.
|
|
13
|
+
environment:
|
|
14
|
+
SSO_ISSUER: https://sso.manyos.it/auth/realms/itsmproxy
|
|
15
|
+
SSO_PUBLIC_KEY: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk6LRzGvjoxuHGnA4MT8D73O/GMSA1hJz1syqsBJY+F2OZRcKz/+gEnlnB3EPAxF7Luoz4nFh1Aaz21DkN2bL8W544+MV4JGl61f4N5HAnBT1635rN5xkbubgmuNQCnKKFu7OlAD3QxiDwecg1bJvFhJW9Qj5YhOwGuX5/4sOSCjmdTcKT1mCHL61FJ5mzxtbrct97zVwXmi4F4KDKj2PsW+qxUg0Jz/06iTVjtv2H1yBq16tqvCyq9WR6nZELmSsDNyyiTuKGJeiF+LXfIjtI9WZgPTGvIWQ3RIqObBm50bEBLHL5aHm2iSGDKoSMOGf/3aQ5NnZEgjMNdkTEjkWVQIDAQAB
|
|
16
|
+
BASEURL: https://rapi.port.manyos.io
|
|
17
|
+
AR_SERVER: pier1
|
|
18
|
+
AR_PORT: 9502
|
|
19
|
+
LOGLEVEL: debug
|
|
20
|
+
EVENTLOG_ENABLE: false
|
|
21
|
+
steps:
|
|
22
|
+
- init: npm install
|
|
23
|
+
- runtest: npm test
|
|
24
|
+
- generate-artifacts: find ./artifacts -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
|
|
25
|
+
- copy-to-artifacts-dir: echo $SD_ARTIFACTS_DIR && cp -r ./artifacts $SD_ARTIFACTS_DIR
|
|
26
|
+
secrets:
|
|
27
|
+
- TEST_ID
|
|
28
|
+
- TEST_SECRET
|
|
29
|
+
- AR_USER
|
|
30
|
+
- AR_PASSWORD
|
|
31
|
+
|
|
32
|
+
# test:
|
|
33
|
+
# requires: [main] # second_job will run after main job is done
|
|
34
|
+
# environment:
|
|
35
|
+
# - SSO_ISSUER: https://sso.manyos.it/auth/realms/itsmproxy
|
|
36
|
+
# - SSO_PUBLIC_KEY: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk6LRzGvjoxuHGnA4MT8D73O/GMSA1hJz1syqsBJY+F2OZRcKz/+gEnlnB3EPAxF7Luoz4nFh1Aaz21DkN2bL8W544+MV4JGl61f4N5HAnBT1635rN5xkbubgmuNQCnKKFu7OlAD3QxiDwecg1bJvFhJW9Qj5YhOwGuX5/4sOSCjmdTcKT1mCHL61FJ5mzxtbrct97zVwXmi4F4KDKj2PsW+qxUg0Jz/06iTVjtv2H1yBq16tqvCyq9WR6nZELmSsDNyyiTuKGJeiF+LXfIjtI9WZgPTGvIWQ3RIqObBm50bEBLHL5aHm2iSGDKoSMOGf/3aQ5NnZEgjMNdkTEjkWVQIDAQAB
|
|
37
|
+
# - BASEURL: https://rapi.port.manyos.io
|
|
38
|
+
# - AR_SERVER: pier1
|
|
39
|
+
# - AR_PORT: 9502
|
|
40
|
+
# - LOGLEVEL: debug
|
|
41
|
+
# - EVENTLOG_ENABLE: false
|
|
42
|
+
# steps:
|
|
43
|
+
# - install: npm install
|
|
44
|
+
# - build: npm test
|
|
45
|
+
# - get-metadata: meta get example
|
|
46
|
+
# secrets:
|
|
47
|
+
# - SCM_ACCESS_TOKEN
|
|
48
|
+
# - SCM_USERNAME
|
|
49
|
+
# - TEST_ID
|
|
50
|
+
# - TEST_USERNAME
|
|
51
|
+
# - AR_USER
|
|
52
|
+
# - AR_PASSWORD
|
package/test/appTest.js
ADDED