feat: Convert model files to JS
This commit is contained in:
48
packages/backend/src/models/execution.js
Normal file
48
packages/backend/src/models/execution.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import Base from './base';
|
||||
import Flow from './flow';
|
||||
import ExecutionStep from './execution-step';
|
||||
import Telemetry from '../helpers/telemetry';
|
||||
|
||||
class Execution extends Base {
|
||||
static tableName = 'executions';
|
||||
|
||||
static jsonSchema = {
|
||||
type: 'object',
|
||||
|
||||
properties: {
|
||||
id: { type: 'string', format: 'uuid' },
|
||||
flowId: { type: 'string', format: 'uuid' },
|
||||
testRun: { type: 'boolean', default: false },
|
||||
internalId: { type: 'string' },
|
||||
deletedAt: { type: 'string' },
|
||||
createdAt: { type: 'string' },
|
||||
updatedAt: { type: 'string' },
|
||||
},
|
||||
};
|
||||
|
||||
static relationMappings = () => ({
|
||||
flow: {
|
||||
relation: Base.BelongsToOneRelation,
|
||||
modelClass: Flow,
|
||||
join: {
|
||||
from: 'executions.flow_id',
|
||||
to: 'flows.id',
|
||||
},
|
||||
},
|
||||
executionSteps: {
|
||||
relation: Base.HasManyRelation,
|
||||
modelClass: ExecutionStep,
|
||||
join: {
|
||||
from: 'executions.id',
|
||||
to: 'execution_steps.execution_id',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
async $afterInsert(queryContext) {
|
||||
await super.$afterInsert(queryContext);
|
||||
Telemetry.executionCreated(this);
|
||||
}
|
||||
}
|
||||
|
||||
export default Execution;
|
Reference in New Issue
Block a user