From 5491a2ac6083e89e3ea89eb38b0410da39d40fd8 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 21 Oct 2024 18:29:26 +0530 Subject: [PATCH 1/5] feat: run by user id, schedule id, api id --- server/src/models/Run.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/server/src/models/Run.ts b/server/src/models/Run.ts index 1c8e4dc6..e64cab19 100644 --- a/server/src/models/Run.ts +++ b/server/src/models/Run.ts @@ -20,6 +20,9 @@ interface RunAttributes { interpreterSettings: InterpreterSettings; log: string; runId: string; + runByUserId?: string; + runByScheduleId?: string; + runByAPI?: string; serializableOutput: Record; binaryOutput: Record; } @@ -38,6 +41,9 @@ class Run extends Model implements RunAttr public interpreterSettings!: InterpreterSettings; public log!: string; public runId!: string; + public runByUserId!: string; + public runByScheduleId!: string; + public runByAPI!: string; public serializableOutput!: Record; public binaryOutput!: Record; } @@ -93,6 +99,18 @@ Run.init( type: DataTypes.UUID, allowNull: false, }, + runByUserId: { + type: DataTypes.UUID, + allowNull: true, + }, + runByScheduleId: { + type: DataTypes.UUID, + allowNull: true, + }, + runByAPI: { + type: DataTypes.STRING(255), + allowNull: true, + }, serializableOutput: { type: DataTypes.JSONB, allowNull: true, From dcaaa8459f8f0630a6f173e936f58f934652111e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 21 Oct 2024 18:55:11 +0530 Subject: [PATCH 2/5] feat: set req.user.id for runByUserId --- server/src/routes/storage.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/routes/storage.ts b/server/src/routes/storage.ts index ada5acdd..c684d6ea 100644 --- a/server/src/routes/storage.ts +++ b/server/src/routes/storage.ts @@ -148,6 +148,7 @@ router.put('/runs/:id', requireSignIn, async (req, res) => { interpreterSettings: req.body, log: '', runId, + runByUserId: req.user.id, serializableOutput: {}, binaryOutput: {}, }); From 70369875a8f46660ec6096b8f7094609640acfd3 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 21 Oct 2024 18:58:45 +0530 Subject: [PATCH 3/5] feat: runByAPI type boolean --- server/src/models/Run.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/models/Run.ts b/server/src/models/Run.ts index e64cab19..c7f9f6f2 100644 --- a/server/src/models/Run.ts +++ b/server/src/models/Run.ts @@ -22,7 +22,7 @@ interface RunAttributes { runId: string; runByUserId?: string; runByScheduleId?: string; - runByAPI?: string; + runByAPI?: boolean; serializableOutput: Record; binaryOutput: Record; } @@ -43,7 +43,7 @@ class Run extends Model implements RunAttr public runId!: string; public runByUserId!: string; public runByScheduleId!: string; - public runByAPI!: string; + public runByAPI!: boolean; public serializableOutput!: Record; public binaryOutput!: Record; } @@ -108,7 +108,7 @@ Run.init( allowNull: true, }, runByAPI: { - type: DataTypes.STRING(255), + type: DataTypes.BOOLEAN, allowNull: true, }, serializableOutput: { From 4a1526023026019fd0ec48575748591f21ff3499 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 21 Oct 2024 19:07:47 +0530 Subject: [PATCH 4/5] feat: set runByScheduledId --- server/src/workflow-management/scheduler/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/workflow-management/scheduler/index.ts b/server/src/workflow-management/scheduler/index.ts index 1b9d1460..36f39a4c 100644 --- a/server/src/workflow-management/scheduler/index.ts +++ b/server/src/workflow-management/scheduler/index.ts @@ -59,6 +59,7 @@ async function createWorkflowAndStoreMetadata(id: string, userId: string) { interpreterSettings: { maxConcurrency: 1, maxRepeats: 1, debug: true }, log: '', runId, + runByScheduleId: uuid(), serializableOutput: {}, binaryOutput: {}, }); From 413a11dd2c462de42c9daf4ff4a9a324e7a93e1f Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Mon, 21 Oct 2024 19:09:02 +0530 Subject: [PATCH 5/5] feat: set runByAPI true --- server/src/api/record.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/api/record.ts b/server/src/api/record.ts index 20e38928..b8f1f2bc 100644 --- a/server/src/api/record.ts +++ b/server/src/api/record.ts @@ -222,6 +222,7 @@ async function createWorkflowAndStoreMetadata(id: string, userId: string) { interpreterSettings: { maxConcurrency: 1, maxRepeats: 1, debug: true }, log: '', runId, + runByAPI: true, serializableOutput: {}, binaryOutput: {}, });