@manyos/smileconnect-api 1.41.2 → 1.41.4
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
|
@@ -607,7 +607,8 @@
|
|
|
607
607
|
"taskWorklog": {
|
|
608
608
|
"fields": [
|
|
609
609
|
"Summary",
|
|
610
|
-
"Notes"
|
|
610
|
+
"Notes",
|
|
611
|
+
"View Access"
|
|
611
612
|
],
|
|
612
613
|
"constants": [
|
|
613
614
|
{
|
|
@@ -621,10 +622,6 @@
|
|
|
621
622
|
{
|
|
622
623
|
"name": "Communication Source",
|
|
623
624
|
"value": "Other"
|
|
624
|
-
},
|
|
625
|
-
{
|
|
626
|
-
"name": "View Access",
|
|
627
|
-
"value": "Internal"
|
|
628
625
|
}
|
|
629
626
|
],
|
|
630
627
|
"basequery": "",
|
package/conf/mapping.json
CHANGED
|
@@ -113,7 +113,7 @@ async function createTask(clientConfig, rootForm, rootRequestId, taskData, creat
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
//Todo make dynamic
|
|
116
|
-
async function createWorklog(clientConfig, taskId,
|
|
116
|
+
async function createWorklog(clientConfig, taskId, data, globalScriptParams) {
|
|
117
117
|
const task = await getTask(clientConfig,taskId)
|
|
118
118
|
const fields = clientConfig.taskWorklog.fields;
|
|
119
119
|
|
|
@@ -124,19 +124,12 @@ async function createWorklog(clientConfig, taskId, summary, text, attachment, gl
|
|
|
124
124
|
const mapping = config.getMapping('taskWorklog');
|
|
125
125
|
|
|
126
126
|
log.debug('mapping', mapping);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
"summary" : summary,
|
|
130
|
-
"text" : text,
|
|
131
|
-
"TaskOrTaskGroupID" : taskId,
|
|
132
|
-
"TaskOrTaskGroupInstanceId" : taskInstanceId
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
fields.push(
|
|
127
|
+
|
|
128
|
+
/*fields.push(
|
|
136
129
|
'Secure Log',
|
|
137
130
|
'TaskOrTaskGroupID',
|
|
138
131
|
'TaskOrTaskGroupInstanceId'
|
|
139
|
-
)
|
|
132
|
+
);*/
|
|
140
133
|
|
|
141
134
|
//run preScripts
|
|
142
135
|
if (scripts && scripts.preMapping) {
|
|
@@ -145,6 +138,10 @@ async function createWorklog(clientConfig, taskId, summary, text, attachment, gl
|
|
|
145
138
|
|
|
146
139
|
data = mappingUtil.applyMapping2Remedy(data, mapping, clientConfig.taskWorklog.constants, fields);
|
|
147
140
|
|
|
141
|
+
//add task ID fields after Mapping
|
|
142
|
+
data["TaskOrTaskGroupID"] = taskId
|
|
143
|
+
data["TaskOrTaskGroupInstanceId"] = taskInstanceId
|
|
144
|
+
|
|
148
145
|
//run postScripts
|
|
149
146
|
if (scripts && scripts.postMapping) {
|
|
150
147
|
await scriptController.runScripts(scripts.postMapping, data, clientConfig.clientId, globalScriptParams);
|
|
@@ -50,7 +50,9 @@ async function createWorklog(ticketConfig, clientConfig, ticketId, data, globalS
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const clientConstants = clientConfig[ticketConfig.requestTypeWorkLog].constants;
|
|
53
|
-
|
|
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) {
|
|
54
56
|
if (data.isPublic === true) {
|
|
55
57
|
clientConstants.push({"name": "View Access", "value" : "Public"});
|
|
56
58
|
} else {
|
package/docs/releases.md
CHANGED
package/package.json
CHANGED
package/routes/taskRoutes.js
CHANGED
|
@@ -181,7 +181,7 @@ module.exports = (function () {
|
|
|
181
181
|
req.errorStatus = 422;
|
|
182
182
|
next(errors.array());
|
|
183
183
|
} else {
|
|
184
|
-
task.createWorklog(req.user.config, taskId, req.body.data
|
|
184
|
+
task.createWorklog(req.user.config, taskId, req.body.data, req.globalScriptParams)
|
|
185
185
|
.then(createResult => {
|
|
186
186
|
const worklogId = createResult['0'];
|
|
187
187
|
task.getTaskWorklog(req.user.config, taskId, worklogId, req.globalScriptParams).then(result => {
|
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');
|
|
@@ -494,7 +494,7 @@ describe('Integration Tests - Workorders', function () {
|
|
|
494
494
|
chai.request(server)
|
|
495
495
|
.post(`/v1/workorders/${workorder.id}/tasks/${task.id}/worklogs`)
|
|
496
496
|
.set('Authorization', 'Bearer ' + authUser.access_token)
|
|
497
|
-
.send({data: {summary: "Worklog Summary", text: "Worklog Text"}})
|
|
497
|
+
.send({data: {summary: "Worklog Summary", text: "Worklog Text", "viewAccess": "Public"}})
|
|
498
498
|
.end(function (err, res) {
|
|
499
499
|
res.should.have.status(200);
|
|
500
500
|
res.body.data.should.be.an('object');
|