65 lines
1.1 KiB
JavaScript
65 lines
1.1 KiB
JavaScript
const config = require('../../config');
|
|
const providers = config.providers;
|
|
const crypto = require('crypto');
|
|
const bcrypt = require('bcrypt');
|
|
const moment = require('moment');
|
|
|
|
module.exports = function(sequelize, DataTypes) {
|
|
const inspection_intervals = sequelize.define(
|
|
'inspection_intervals',
|
|
{
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true,
|
|
},
|
|
|
|
type: {
|
|
type: DataTypes.ENUM,
|
|
|
|
values: [
|
|
|
|
"value"
|
|
|
|
],
|
|
|
|
},
|
|
|
|
interval_hours: {
|
|
type: DataTypes.INTEGER,
|
|
|
|
},
|
|
|
|
interval_months: {
|
|
type: DataTypes.INTEGER,
|
|
|
|
},
|
|
|
|
importHash: {
|
|
type: DataTypes.STRING(255),
|
|
allowNull: true,
|
|
unique: true,
|
|
},
|
|
},
|
|
{
|
|
timestamps: true,
|
|
paranoid: true,
|
|
freezeTableName: true,
|
|
},
|
|
);
|
|
|
|
inspection_intervals.associate = (db) => {
|
|
|
|
db.inspection_intervals.belongsTo(db.users, {
|
|
as: 'createdBy',
|
|
});
|
|
|
|
db.inspection_intervals.belongsTo(db.users, {
|
|
as: 'updatedBy',
|
|
});
|
|
};
|
|
|
|
return inspection_intervals;
|
|
};
|
|
|