feat: match run model to run format
This commit is contained in:
@@ -2,95 +2,107 @@ import { Model, DataTypes, Optional } from 'sequelize';
|
|||||||
import sequelize from '../db/config';
|
import sequelize from '../db/config';
|
||||||
import Robot from './Robot';
|
import Robot from './Robot';
|
||||||
|
|
||||||
|
interface InterpreterSettings {
|
||||||
|
maxConcurrency: number;
|
||||||
|
maxRepeats: number;
|
||||||
|
debug: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
interface RunAttributes {
|
interface RunAttributes {
|
||||||
id: string;
|
id: string;
|
||||||
robotId: string;
|
status: string;
|
||||||
status: string;
|
name: string;
|
||||||
name: string;
|
robotId: string;
|
||||||
startedAt: Date;
|
startedAt: string;
|
||||||
finishedAt: Date;
|
finishedAt: string;
|
||||||
browserId: string;
|
browserId: string;
|
||||||
interpreterSettings: object;
|
interpreterSettings: InterpreterSettings;
|
||||||
log: string;
|
log: string;
|
||||||
serializableRun: object;
|
runId: string;
|
||||||
binaryRunUrl: string;
|
serializableOutput: Record<string, any[]>;
|
||||||
|
binaryOutput: Record<string, any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RunCreationAttributes extends Optional<RunAttributes, 'id'> { }
|
interface RunCreationAttributes extends Optional<RunAttributes, 'id'> { }
|
||||||
|
|
||||||
class Run extends Model<RunAttributes, RunCreationAttributes> implements RunAttributes {
|
class Run extends Model<RunAttributes, RunCreationAttributes> implements RunAttributes {
|
||||||
public id!: string;
|
public id!: string;
|
||||||
public robotId!: string;
|
public status!: string;
|
||||||
public status!: string;
|
public name!: string;
|
||||||
public name!: string;
|
public robotId!: string;
|
||||||
public startedAt!: Date;
|
public startedAt!: string;
|
||||||
public finishedAt!: Date;
|
public finishedAt!: string;
|
||||||
public browserId!: string;
|
public browserId!: string;
|
||||||
public interpreterSettings!: object;
|
public interpreterSettings!: InterpreterSettings;
|
||||||
public log!: string;
|
public log!: string;
|
||||||
public serializableRun!: object;
|
public runId!: string;
|
||||||
public binaryRunUrl!: string;
|
public serializableOutput!: Record<string, any[]>;
|
||||||
|
public binaryOutput!: Record<string, any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
Run.init(
|
Run.init(
|
||||||
{
|
{
|
||||||
id: {
|
id: {
|
||||||
type: DataTypes.UUID,
|
type: DataTypes.UUID,
|
||||||
defaultValue: DataTypes.UUIDV4,
|
defaultValue: DataTypes.UUIDV4,
|
||||||
primaryKey: true,
|
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,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
status: {
|
||||||
sequelize,
|
type: DataTypes.STRING(50),
|
||||||
tableName: 'run',
|
allowNull: false,
|
||||||
timestamps: 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' });
|
Run.belongsTo(Robot, { foreignKey: 'robotId' });
|
||||||
|
|
||||||
export default Run;
|
export default Run;
|
||||||
Reference in New Issue
Block a user