@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 +12 -1
- package/conf/scripts/script1.js +1 -1
- package/conf/scripts/script2.js +1 -1
- package/conf/scripts/scriptPutPost.js +2 -0
- package/conf/scripts/scriptPutPre.js +2 -0
- package/controller/cmdbobjectController.js +1 -1
- package/package.json +1 -1
- package/routes/cmdbObjectRoutes.js +1 -1
- package/util/schemas/fieldMappingSchema.js +16 -1
package/conf/clients.json
CHANGED
|
@@ -167,9 +167,20 @@
|
|
|
167
167
|
],
|
|
168
168
|
"scripts": {
|
|
169
169
|
"GET": {
|
|
170
|
-
"
|
|
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
|
}
|
package/conf/scripts/script1.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
//requestData.
|
|
1
|
+
//requestData.Name = "Horstdidü";
|
|
2
2
|
resolve();
|
package/conf/scripts/script2.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
requestData.Status = "Horstdi2";
|
|
1
|
+
//requestData.Status = "Horstdi2";
|
|
2
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.
|
|
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
|
@@ -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
|
};
|