@manyos/smileconnect-api 1.58.1 → 1.59.1
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/Dockerfile
CHANGED
|
@@ -439,6 +439,9 @@ async function updateRelations(ticketConfig, userConfig, ticketId, relations) {
|
|
|
439
439
|
relations.ticketRelations = undefined
|
|
440
440
|
}
|
|
441
441
|
|
|
442
|
+
//Set error array
|
|
443
|
+
const errors = [];
|
|
444
|
+
|
|
442
445
|
//Check CI Relations
|
|
443
446
|
if (relations && relations.ciRelations && Array.isArray(relations.ciRelations)) {
|
|
444
447
|
const existingRelations = await getTicketCIRelations(ticketId);
|
|
@@ -451,7 +454,11 @@ async function updateRelations(ticketConfig, userConfig, ticketId, relations) {
|
|
|
451
454
|
const relationsExists = doesCIRelationExists(existingRelations, relation, relations.keepCIs);
|
|
452
455
|
log.debug('createRelation, already exists', relation, relationsExists);
|
|
453
456
|
if (!relationsExists) {
|
|
454
|
-
|
|
457
|
+
try {
|
|
458
|
+
await createTicketCIRelation(ticketConfig, ticketId, relation.ciId, relation.relationType);
|
|
459
|
+
} catch (e) {
|
|
460
|
+
errors.push(e);
|
|
461
|
+
}
|
|
455
462
|
}
|
|
456
463
|
}
|
|
457
464
|
}
|
|
@@ -462,7 +469,11 @@ async function updateRelations(ticketConfig, userConfig, ticketId, relations) {
|
|
|
462
469
|
const shouldRelationsExists = doesCIRelationExists(relations.ciRelations, relation, relations.keepCIs);
|
|
463
470
|
log.debug('deleteRelation, already exists', relation, shouldRelationsExists);
|
|
464
471
|
if (shouldRelationsExists !== true) {
|
|
465
|
-
|
|
472
|
+
try {
|
|
473
|
+
await deleteTicketCIRelation(ticketConfig, ticketId, relation.ciId);
|
|
474
|
+
} catch (e) {
|
|
475
|
+
errors.push(e);
|
|
476
|
+
}
|
|
466
477
|
}
|
|
467
478
|
}
|
|
468
479
|
}
|
|
@@ -504,6 +515,7 @@ async function updateRelations(ticketConfig, userConfig, ticketId, relations) {
|
|
|
504
515
|
}
|
|
505
516
|
}
|
|
506
517
|
}
|
|
518
|
+
return errors;
|
|
507
519
|
}
|
|
508
520
|
|
|
509
521
|
function getTicketConfigByTicketType(ticketType) {
|
|
@@ -315,7 +315,11 @@ async function updateTicket(ticketConfig, clientConfig, id, ticketData, globalSc
|
|
|
315
315
|
}
|
|
316
316
|
//todo Abfangen wenn getTicket nichts liefert.
|
|
317
317
|
const update = await arquery.updateEntry(ticketConfig.forms.regular, ticket.data.internalId, ticketData, clientConfig.options);
|
|
318
|
-
await ticketCIRelationController.updateRelations(ticketConfig, clientConfig, id, relations);
|
|
318
|
+
const relationErrors = await ticketCIRelationController.updateRelations(ticketConfig, clientConfig, id, relations);
|
|
319
|
+
if (relationErrors && relationErrors.length > 0) {
|
|
320
|
+
log.error(relationErrors)
|
|
321
|
+
throw relationErrors;
|
|
322
|
+
}
|
|
319
323
|
//run afterExecution
|
|
320
324
|
if (scripts && scripts.afterExecution) {
|
|
321
325
|
await scriptController.runScripts(scripts.afterExecution, ticketData, clientConfig.clientId, globalScriptParams);
|
package/docs/releases.md
CHANGED
package/package.json
CHANGED
|
@@ -79,16 +79,22 @@ module.exports = (function() {
|
|
|
79
79
|
let fileContent = null;
|
|
80
80
|
|
|
81
81
|
let file = null;
|
|
82
|
+
|
|
82
83
|
if (req.files != null && req.files.file != null) {
|
|
83
84
|
file = req.files.file;
|
|
85
|
+
} else if (req.body.data && req.body.data.fileName && req.body.data.fileContent && req.body.data.mimetype) {
|
|
86
|
+
log.debug('set file by data content - currently not implemented');
|
|
87
|
+
//funktioniert nicht. Wahrscheinlich ein encoding problem
|
|
88
|
+
file = {
|
|
89
|
+
name: req.body.data.fileName,
|
|
90
|
+
data: atob(req.body.data.fileContent),
|
|
91
|
+
mimetype: req.body.data.mimetype
|
|
92
|
+
}
|
|
84
93
|
}
|
|
94
|
+
|
|
85
95
|
if (file == null || file == undefined) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
} else {
|
|
89
|
-
req.errorStatus = 400;
|
|
90
|
-
next({errorMessage:"No file or data send"});
|
|
91
|
-
};
|
|
96
|
+
req.errorStatus = 400;
|
|
97
|
+
next({errorMessage:"No file or data send"});
|
|
92
98
|
} else {
|
|
93
99
|
//fileContent = JSON.parse(file.data);
|
|
94
100
|
ticketWorkLogController.setWorklogAttachment(req.ticketConfig, req.user.config, worklogId, file, attachmentId, req.globalScriptParams).then(
|
package/util/responsehandler.js
CHANGED
|
@@ -52,6 +52,13 @@ function errorHandler(err, req, res, next) {
|
|
|
52
52
|
res.status(errorStatus).json({"error": "You are not authorized for this request.", stackTrace: errorStack});
|
|
53
53
|
} else if (typeof errorStack === "string") {
|
|
54
54
|
res.status(errorStatus).json({"error": "Ooops. Something unexpected just happened.", "stackTrace":errorStack});
|
|
55
|
+
} else if (Array.isArray(err)) {
|
|
56
|
+
err = err.map(item => {
|
|
57
|
+
return {
|
|
58
|
+
message: item.stack
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
res.status(errorStatus).json({"error": err});
|
|
55
62
|
} else {
|
|
56
63
|
res.status(errorStatus).json({"error": err});
|
|
57
64
|
}
|