@manyos/smileconnect-api 1.36.1 → 1.36.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
@@ -167,9 +167,20 @@
167
167
  ],
168
168
  "scripts": {
169
169
  "GET": {
170
- "postMapping": [
170
+ "preMapping": [
171
171
  "script1",
172
172
  "script2"
173
+ ],
174
+ "postMapping": [
175
+ "script2"
176
+ ]
177
+ },
178
+ "POST": {
179
+ "preMapping": [
180
+ "scriptPutPre"
181
+ ],
182
+ "postMapping": [
183
+ "scriptPutPost"
173
184
  ]
174
185
  }
175
186
  }
@@ -1,2 +1,2 @@
1
- //requestData.Status = "Horstdi";
1
+ //requestData.Name = "Horstdidü";
2
2
  resolve();
@@ -1,2 +1,2 @@
1
- requestData.Status = "Horstdi2";
1
+ //requestData.Status = "Horstdi2";
2
2
  resolve();
@@ -0,0 +1,2 @@
1
+ requestData.Name = requestData.Name + "Horstdidü";
2
+ resolve();
@@ -0,0 +1,2 @@
1
+ requestData.name = "Horstdidü" + requestData.name;
2
+ resolve();
@@ -375,7 +375,7 @@ async function createCmdbObject(assetConfig, clientConfig, classId, ciData) {
375
375
  const reconId = getRandomId();
376
376
  const instanceId = getRandomId();
377
377
 
378
- const scripts = clientConfig[CMDBOBJECT].scripts.PUT;
378
+ const scripts = clientConfig[CMDBOBJECT].scripts.POST;
379
379
  //const fields = clientConfig[ticketConfig.requestType].fields
380
380
 
381
381
  //run preScripts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manyos/smileconnect-api",
3
- "version": "1.36.1",
3
+ "version": "1.36.2",
4
4
  "description": "A proxy and abstraction layer for BMCs IT Service Management Suite",
5
5
  "main": "app.js",
6
6
  "scripts": {
@@ -197,7 +197,7 @@ module.exports = (function () {
197
197
  }
198
198
  });
199
199
 
200
- cmdbObjectRoutes.post('/', async function (req, res, next) {
200
+ cmdbObjectRoutes.post('/', checkSchema(fieldMappingSchemas.CMDBCreateDataSchema), async function (req, res, next) {
201
201
  const classId = req.body.classId;
202
202
  const includeString = req.query.include;
203
203
  eventLog.setEventData(
@@ -41,6 +41,21 @@ const fieldMappingItemSchema = {
41
41
  }*/
42
42
  };
43
43
 
44
+ const CMDBCreateDataSchema = {
45
+ 'classId' : {
46
+ in: ['body'],
47
+ exists: {
48
+ errorMessage: 'Is required'
49
+ }
50
+ },
51
+ 'data' : {
52
+ in: ['body'],
53
+ exists: {
54
+ errorMessage: 'Is required'
55
+ }
56
+ }
57
+ }
58
+
44
59
  const validateCMDBDataSchema = {
45
60
  'ciChanges' : {
46
61
  in: ['body'],
@@ -207,5 +222,5 @@ const fieldMappingSchema = {
207
222
  };
208
223
 
209
224
  module.exports = {
210
- fieldMappingSchema, fieldMappingItemSchema, validateCMDBDataSchema
225
+ fieldMappingSchema, fieldMappingItemSchema, validateCMDBDataSchema, CMDBCreateDataSchema
211
226
  };