54 lines
948 B
JavaScript
54 lines
948 B
JavaScript
|
|
import {
|
|
DataTypes
|
|
} from 'sequelize';
|
|
|
|
import {
|
|
DBLogger,
|
|
LabelDB
|
|
} from './db_conn.mjs'
|
|
|
|
import {
|
|
Template
|
|
} from "./template.model.mjs";
|
|
|
|
|
|
export const Medium = LabelDB.define('medium', {
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true
|
|
},
|
|
name: {
|
|
type: DataTypes.STRING,
|
|
allowNull: false
|
|
},
|
|
columns: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false
|
|
},
|
|
spacing: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false
|
|
},
|
|
width: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false
|
|
}
|
|
}, {
|
|
timestamps: false
|
|
});
|
|
|
|
Medium.belongsToMany(Template, {
|
|
through: 'media_templates',
|
|
onDelete: 'CASCADE',
|
|
onUpdate: 'CASCADE',
|
|
timestamps: false
|
|
});
|
|
|
|
Template.belongsToMany(Medium, {
|
|
through: 'media_templates',
|
|
onDelete: 'CASCADE',
|
|
onUpdate: 'CASCADE',
|
|
timestamps: false
|
|
});
|