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: {}, }); diff --git a/server/src/models/Run.ts b/server/src/models/Run.ts index 1c8e4dc6..c7f9f6f2 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?: boolean; 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!: boolean; 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.BOOLEAN, + allowNull: true, + }, serializableOutput: { type: DataTypes.JSONB, allowNull: true, 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: {}, }); 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: {}, });