@manyos/smileconnect-api 1.41.1 → 1.41.3
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/conf/clients.json
CHANGED
package/conf/mapping.json
CHANGED
|
@@ -11,16 +11,13 @@ const scriptController = require('./scriptController');
|
|
|
11
11
|
|
|
12
12
|
const ticketCache = new CacheService(process.env.CACHETTL_TICKETS || 1); // Create a new cache service instance
|
|
13
13
|
|
|
14
|
-
async function createWorklog(ticketConfig, clientConfig, ticketId,
|
|
14
|
+
async function createWorklog(ticketConfig, clientConfig, ticketId, data, globalScriptParams) {
|
|
15
15
|
const scripts = clientConfig[ticketConfig.requestTypeWorkLog].scripts.POST;
|
|
16
16
|
const mapping = config.getMapping(ticketConfig.requestTypeWorkLog);
|
|
17
17
|
const fields = clientConfig[ticketConfig.requestTypeWorkLog].fields;
|
|
18
18
|
|
|
19
19
|
log.debug('mapping', mapping);
|
|
20
|
-
|
|
21
|
-
"summary" : summary,
|
|
22
|
-
"text" : text
|
|
23
|
-
};
|
|
20
|
+
|
|
24
21
|
const requestType = ticketConfig.requestType;
|
|
25
22
|
if (requestType === 'incident') {
|
|
26
23
|
data[searchUtil.mapFieldNameReverse('Incident Number', mapping)] = ticketId;
|
|
@@ -53,10 +50,14 @@ async function createWorklog(ticketConfig, clientConfig, ticketId, summary, text
|
|
|
53
50
|
}
|
|
54
51
|
|
|
55
52
|
const clientConstants = clientConfig[ticketConfig.requestTypeWorkLog].constants;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
const viewAccessConstant = clientConstants.find(element => element.name === "View Access")
|
|
54
|
+
//run only if isPublic is set and no Constant is defined
|
|
55
|
+
if (data.isPublic && !viewAccessConstant) {
|
|
56
|
+
if (data.isPublic === true) {
|
|
57
|
+
clientConstants.push({"name": "View Access", "value" : "Public"});
|
|
58
|
+
} else {
|
|
59
|
+
clientConstants.push({"name": "View Access", "value" : "Internal"});
|
|
60
|
+
}
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
//run preScripts
|
package/docs/releases.md
CHANGED
package/package.json
CHANGED
|
@@ -159,13 +159,8 @@ module.exports = (function() {
|
|
|
159
159
|
next({validationErrors: result.array()});
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
const reqPublic = req.body.data.isPublic;
|
|
163
|
-
let isPublic = false;
|
|
164
|
-
if (reqPublic != null && reqPublic != undefined && reqPublic === true) {
|
|
165
|
-
isPublic = true;
|
|
166
|
-
}
|
|
167
162
|
|
|
168
|
-
ticketWorkLogController.createWorklog(req.ticketConfig, req.user.config, ticketId, req.body.data
|
|
163
|
+
ticketWorkLogController.createWorklog(req.ticketConfig, req.user.config, ticketId, req.body.data, req.globalScriptParams)
|
|
169
164
|
.then(result => {
|
|
170
165
|
const worklogId = result['0'];
|
|
171
166
|
req.eventData.ticketNumber2 = worklogId;
|
package/test/workorderTest.js
CHANGED
|
@@ -273,7 +273,7 @@ describe('Integration Tests - Workorders', function () {
|
|
|
273
273
|
chai.request(server)
|
|
274
274
|
.post(`/v1/workorders/${workorder.id}/worklogs`)
|
|
275
275
|
.set('Authorization', 'Bearer ' + authUser.access_token)
|
|
276
|
-
.send({data: {summary: "Worklog Summary", text: "Worklog Text"}})
|
|
276
|
+
.send({data: {summary: "Worklog Summary", text: "Worklog Text", isPublic: true}})
|
|
277
277
|
.end(function (err, res) {
|
|
278
278
|
res.should.have.status(200);
|
|
279
279
|
res.body.data.should.be.an('object');
|