@5minds/node-red-contrib-processcube
Advanced tools
Comparing version 1.6.0-process-instance-delete-hotfix-120ac3-m4vdm2ls to 1.6.0-process-instance-delete-hotfix-31cc24-m4vf42in
{ | ||
"name": "@5minds/node-red-contrib-processcube", | ||
"version": "1.6.0-process-instance-delete-hotfix-120ac3-m4vdm2ls", | ||
"version": "1.6.0-process-instance-delete-hotfix-31cc24-m4vf42in", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Node-RED nodes for ProcessCube", |
@@ -21,10 +21,22 @@ module.exports = function (RED) { | ||
const isHours = msg.payload.time_unit | ||
? msg.payload.time_unit.toLowerCase() === 'hours' | ||
: config.time_unit.toLowerCase() === 'hours'; | ||
const multiplier = isHours ? 1 : 24; | ||
// Gültige Werte für time_type | ||
const validTimeTypes = ['days', 'hours']; | ||
const timeType = msg.payload.time_type | ||
? msg.payload.time_type.toLowerCase() | ||
: config.time_type?.toLowerCase(); | ||
// time_type validieren | ||
if (!timeType || !validTimeTypes.includes(timeType)) { | ||
node.error(`Invalid time_type provided: ${timeType}. Allowed values are 'days' or 'hours'.`); | ||
return; | ||
} | ||
// Zeitmultiplikator berechnen | ||
const multiplier = timeType === 'hours' ? 1 : 24; | ||
node.log(`Time type: ${timeType}, multiplier: ${multiplier}`); | ||
const deletionDate = new Date(Date.now() - timeToUse * multiplier * 60 * 60 * 1000); | ||
node.log(`Errechnetes Datum: ${deletionDate}`); | ||
const modelId = msg.payload.processModelId?.trim() || config.modelid?.trim(); | ||
if (!modelId) { | ||
@@ -31,0 +43,0 @@ node.error('processModelId is not defined or empty.'); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
515759
9872