260307:1319 20260307:1300 fix n8n workflow project_id, issued_date and received_date
Build and Deploy / deploy (push) Successful in 4m11s

This commit is contained in:
admin
2026-03-07 13:19:03 +07:00
parent 65a758298a
commit e70fc95fa0
5 changed files with 1250 additions and 11 deletions
+133
View File
@@ -0,0 +1,133 @@
const fs = require('fs');
const filepath = 'd:/nap-dms.lcbp3/specs/03-Data-and-Storage/n8n.workflow.json';
const workflow = JSON.parse(fs.readFileSync(filepath, 'utf8'));
const switchNodeIndex = workflow.nodes.findIndex(n => n.name === 'Route by Confidence');
if (switchNodeIndex > -1) {
workflow.nodes[switchNodeIndex] = {
id: "23d11b5e-49b4-4b53-911b-76b6bb77aab8",
name: "Route by Confidence",
type: "n8n-nodes-base.switch",
typeVersion: 3.2,
position: [6840, 3696],
parameters: {
rules: {
values: [
{
conditions: {
options: {
caseSensitive: true,
leftValue: "",
typeValidation: "strict",
version: 2
},
conditions: [
{
leftValue: "={{ $json.route_index }}",
rightValue: 0,
operator: {
type: "number",
operation: "equals",
singleValue: true
}
}
],
combinator: "and"
},
renameOutput: true,
outputKey: "Auto Ingest"
},
{
conditions: {
options: {
caseSensitive: true,
leftValue: "",
typeValidation: "strict",
version: 2
},
conditions: [
{
leftValue: "={{ $json.route_index }}",
rightValue: 1,
operator: {
type: "number",
operation: "equals",
singleValue: true
}
}
],
combinator: "and"
},
renameOutput: true,
outputKey: "Review Queue"
},
{
conditions: {
options: {
caseSensitive: true,
leftValue: "",
typeValidation: "strict",
version: 2
},
conditions: [
{
leftValue: "={{ $json.route_index }}",
rightValue: 2,
operator: {
type: "number",
operation: "equals",
singleValue: true
}
}
],
combinator: "and"
},
renameOutput: true,
outputKey: "Reject"
},
{
conditions: {
options: {
caseSensitive: true,
leftValue: "",
typeValidation: "strict",
version: 2
},
conditions: [
{
leftValue: "={{ $json.route_index }}",
rightValue: 3,
operator: {
type: "number",
operation: "equals",
singleValue: true
}
}
],
combinator: "and"
},
renameOutput: true,
outputKey: "Error Log"
}
]
}
}
};
if (workflow.connections['Confidence Router'] || workflow.connections['Route by Confidence']) {
workflow.connections['Route by Confidence'] = {
'main': [
[ { 'node': 'Import to Backend', 'type': 'main', 'index': 0 } ],
[ { 'node': 'Insert Review Queue', 'type': 'main', 'index': 0 } ],
[ { 'node': 'Log Reject to CSV', 'type': 'main', 'index': 0 } ],
[ { 'node': 'Log Error to CSV', 'type': 'main', 'index': 0 } ]
]
};
}
fs.writeFileSync(filepath, JSON.stringify(workflow, null, 2));
console.log("Updated Switch node to use typeVersion 3.2 properly.");
} else {
console.log("Could not find Route by Confidence node.");
}
+8 -2
View File
@@ -1,7 +1,7 @@
{
"name": "backend",
"version": "1.5.1",
"description": "",
"description": "<p align=\"center\">\r <a href=\"http://nestjs.com/\" target=\"blank\"><img src=\"https://nestjs.com/img/logo-small.svg\" width=\"120\" alt=\"Nest Logo\" /></a>\r </p>",
"author": "",
"private": true,
"license": "UNLICENSED",
@@ -135,5 +135,11 @@
"overrides": {
"fast-xml-parser": "^5.3.5"
}
}
},
"main": "index.js",
"directories": {
"test": "test"
},
"keywords": [],
"type": "commonjs"
}
@@ -41,4 +41,20 @@ export class ImportCorrespondenceDto {
@IsObject()
@IsOptional()
details?: Record<string, any>;
@IsNumber()
@IsNotEmpty()
project_id!: number;
@IsString()
@IsOptional()
issued_date?: string;
@IsString()
@IsOptional()
received_date?: string;
@IsString()
@IsOptional()
body?: string;
}