feat: match exact format of file system robot
This commit is contained in:
@@ -5,42 +5,36 @@ import Run from './Run';
|
||||
interface RobotMeta {
|
||||
name: string;
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
createdAt: string;
|
||||
pairs: number;
|
||||
updatedAt: Date;
|
||||
params: object[];
|
||||
updatedAt: string;
|
||||
params: any[];
|
||||
}
|
||||
|
||||
interface Workflow {
|
||||
where: {
|
||||
url: string;
|
||||
};
|
||||
what: Array<{
|
||||
action: string;
|
||||
args: any[];
|
||||
}>;
|
||||
}
|
||||
|
||||
interface Robot {
|
||||
workflow: Array<{
|
||||
where: {
|
||||
url: string;
|
||||
};
|
||||
what: Array<{
|
||||
action: string;
|
||||
args: any[];
|
||||
}>;
|
||||
}>;
|
||||
workflow: Workflow[];
|
||||
}
|
||||
|
||||
interface RobotAttributes {
|
||||
id: string;
|
||||
name: string;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
pairs: number;
|
||||
recording_meta: RobotMeta;
|
||||
recording: Robot;
|
||||
}
|
||||
|
||||
interface RobotCreationAttributes extends Optional<RobotAttributes, 'id'> { }
|
||||
interface RobotCreationAttributes extends Optional<RobotAttributes, 'id'> {}
|
||||
|
||||
class Robot extends Model<RobotAttributes, RobotCreationAttributes> implements RobotAttributes {
|
||||
public id!: string;
|
||||
public name!: string;
|
||||
public createdAt!: Date;
|
||||
public updatedAt!: Date;
|
||||
public pairs!: number;
|
||||
public recording_meta!: RobotMeta;
|
||||
public recording!: Robot;
|
||||
}
|
||||
@@ -52,30 +46,10 @@ Robot.init(
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true,
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: false,
|
||||
},
|
||||
createdAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW,
|
||||
},
|
||||
updatedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW,
|
||||
},
|
||||
pairs: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
},
|
||||
// JSONB field for recording_meta (storing as a structured object)
|
||||
recording_meta: {
|
||||
type: DataTypes.JSONB,
|
||||
allowNull: false,
|
||||
},
|
||||
// JSONB field for recording (storing as a structured object)
|
||||
recording: {
|
||||
type: DataTypes.JSONB,
|
||||
allowNull: false,
|
||||
@@ -84,7 +58,7 @@ Robot.init(
|
||||
{
|
||||
sequelize,
|
||||
tableName: 'robot',
|
||||
timestamps: true,
|
||||
timestamps: false, // We'll manage timestamps manually in recording_meta
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user