initial upload
This commit is contained in:
parent
ac114da487
commit
7c1cfdff51
63 changed files with 6883 additions and 0 deletions
85
sequelize/job.model.mjs
Normal file
85
sequelize/job.model.mjs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
|
||||
import {
|
||||
DataTypes
|
||||
} from 'sequelize';
|
||||
|
||||
import {
|
||||
LabelDB as Database
|
||||
} from './db_conn.mjs'
|
||||
|
||||
import {
|
||||
Queue
|
||||
} from "./queue.model.mjs";
|
||||
|
||||
import {
|
||||
Template,
|
||||
Variable
|
||||
} from "./template.model.mjs";
|
||||
|
||||
|
||||
export const Job = Database.define('job', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
autoIncrement: true,
|
||||
primaryKey: true
|
||||
}
|
||||
}, {
|
||||
timestamps: false
|
||||
});
|
||||
|
||||
|
||||
export const JobValue = Database.define('jobValue', {
|
||||
id: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true
|
||||
},
|
||||
key: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
value: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
}
|
||||
}, {
|
||||
tableName: 'job_values',
|
||||
timestamps: false
|
||||
});
|
||||
|
||||
|
||||
JobValue.belongsTo(Job, {
|
||||
onDelete: 'CASCADE',
|
||||
foreignKey: {
|
||||
allowNull: false
|
||||
}
|
||||
});
|
||||
Job.hasMany(JobValue, {
|
||||
onDelete: 'CASCADE',
|
||||
foreignKey: {
|
||||
allowNull: false
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Job.belongsTo(Queue, {
|
||||
onDelete: 'CASCADE',
|
||||
foreignKey: {
|
||||
allowNull: false
|
||||
}
|
||||
});
|
||||
Queue.hasMany(Job, {
|
||||
onDelete: 'CASCADE',
|
||||
foreignKey: {
|
||||
allowNull: false
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Job.belongsTo(Template);
|
||||
Template.hasMany(Job, {
|
||||
onDelete: 'CASCADE',
|
||||
foreignKey: {
|
||||
allowNull: false
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue