diff --git a/server/src/models/Run.ts b/server/src/models/Run.ts index ab514c2a..3b181114 100644 --- a/server/src/models/Run.ts +++ b/server/src/models/Run.ts @@ -2,95 +2,107 @@ import { Model, DataTypes, Optional } from 'sequelize'; import sequelize from '../db/config'; import Robot from './Robot'; +interface InterpreterSettings { + maxConcurrency: number; + maxRepeats: number; + debug: boolean; +} + interface RunAttributes { - id: string; - robotId: string; - status: string; - name: string; - startedAt: Date; - finishedAt: Date; - browserId: string; - interpreterSettings: object; - log: string; - serializableRun: object; - binaryRunUrl: string; + id: string; + status: string; + name: string; + robotId: string; + startedAt: string; + finishedAt: string; + browserId: string; + interpreterSettings: InterpreterSettings; + log: string; + runId: string; + serializableOutput: Record; + binaryOutput: Record; } interface RunCreationAttributes extends Optional { } class Run extends Model implements RunAttributes { - public id!: string; - public robotId!: string; - public status!: string; - public name!: string; - public startedAt!: Date; - public finishedAt!: Date; - public browserId!: string; - public interpreterSettings!: object; - public log!: string; - public serializableRun!: object; - public binaryRunUrl!: string; + public id!: string; + public status!: string; + public name!: string; + public robotId!: string; + public startedAt!: string; + public finishedAt!: string; + public browserId!: string; + public interpreterSettings!: InterpreterSettings; + public log!: string; + public runId!: string; + public serializableOutput!: Record; + public binaryOutput!: Record; } Run.init( - { - id: { - type: DataTypes.UUID, - defaultValue: DataTypes.UUIDV4, - primaryKey: true, - }, - robotId: { - type: DataTypes.UUID, - allowNull: false, - references: { - model: Robot, - key: 'id', - }, - }, - status: { - type: DataTypes.STRING(50), - allowNull: false, - }, - name: { - type: DataTypes.STRING(255), - allowNull: false, - }, - startedAt: { - type: DataTypes.DATE, - allowNull: false, - }, - finishedAt: { - type: DataTypes.DATE, - allowNull: false, - }, - browserId: { - type: DataTypes.UUID, - allowNull: false, - }, - interpreterSettings: { - type: DataTypes.JSONB, - allowNull: true, - }, - log: { - type: DataTypes.TEXT, - allowNull: true, - }, - serializableRun: { - type: DataTypes.JSONB, - allowNull: true, - }, - binaryRunUrl: { - type: DataTypes.TEXT, - allowNull: true, - }, + { + id: { + type: DataTypes.UUID, + defaultValue: DataTypes.UUIDV4, + primaryKey: true, }, - { - sequelize, - tableName: 'run', - timestamps: false, - } + status: { + type: DataTypes.STRING(50), + allowNull: false, + }, + name: { + type: DataTypes.STRING(255), + allowNull: false, + }, + robotId: { + type: DataTypes.UUID, + allowNull: false, + references: { + model: Robot, + key: 'id', + }, + }, + startedAt: { + type: DataTypes.STRING(255), + allowNull: false, + }, + finishedAt: { + type: DataTypes.STRING(255), + allowNull: false, + }, + browserId: { + type: DataTypes.UUID, + allowNull: false, + }, + interpreterSettings: { + type: DataTypes.JSONB, + allowNull: false, + }, + log: { + type: DataTypes.TEXT, + allowNull: true, + }, + runId: { + type: DataTypes.UUID, + allowNull: false, + }, + serializableOutput: { + type: DataTypes.JSONB, + allowNull: true, + }, + binaryOutput: { + type: DataTypes.JSONB, + allowNull: true, + }, + }, + { + sequelize, + tableName: 'run', + timestamps: false, + } ); Run.belongsTo(Robot, { foreignKey: 'robotId' }); -export default Run; +export default Run; \ No newline at end of file