@manyos/smileconnect-api 1.41.1 → 1.41.2

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
@@ -495,7 +495,8 @@
495
495
  "workOrderWorklog": {
496
496
  "fields": [
497
497
  "Description",
498
- "Detailed Description"
498
+ "Detailed Description",
499
+ "View Access"
499
500
  ],
500
501
  "constants": [
501
502
  {
package/conf/mapping.json CHANGED
@@ -419,6 +419,10 @@
419
419
  {
420
420
  "oldName": "Work Log ID",
421
421
  "newName": "id"
422
+ },
423
+ {
424
+ "oldName": "View Access",
425
+ "newName": "viewAccess"
422
426
  }
423
427
  ],
424
428
  "incidentWorklog": [
@@ -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, summary, text, isPublic, globalScriptParams) {
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
- let data = {
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,12 @@ async function createWorklog(ticketConfig, clientConfig, ticketId, summary, text
53
50
  }
54
51
 
55
52
  const clientConstants = clientConfig[ticketConfig.requestTypeWorkLog].constants;
56
- if (isPublic == true) {
57
- clientConstants.push({"name": "View Access", "value" : "Public"});
58
- } else {
59
- clientConstants.push({"name": "View Access", "value" : "Internal"});
53
+ if (data.isPublic) {
54
+ if (data.isPublic === true) {
55
+ clientConstants.push({"name": "View Access", "value" : "Public"});
56
+ } else {
57
+ clientConstants.push({"name": "View Access", "value" : "Internal"});
58
+ }
60
59
  }
61
60
 
62
61
  //run preScripts
package/docs/releases.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## API
4
4
 
5
+ ### 1.41.2 - 10.08.21
6
+
7
+ Fix mapping for Ticket Worklogs
8
+
5
9
  ### 1.41.1 - 10.08.21
6
10
 
7
11
  Fix issue with sort in Remedy Adapter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.41.1",
3
+ "version": "1.41.2",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -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.summary, req.body.data.text, isPublic, req.globalScriptParams)
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;
@@ -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", viewAccess: "Internal"}})
277
277
  .end(function (err, res) {
278
278
  res.should.have.status(200);
279
279
  res.body.data.should.be.an('object');