2025-06-25 03:04:34 +00:00

69 lines
1.0 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 tools = sequelize.define(
'tools',
{
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true,
},
quantity: {
type: DataTypes.INTEGER,
},
condition: {
type: DataTypes.TEXT,
},
status: {
type: DataTypes.ENUM,
values: [
"Working",
"UnderRepair",
"Scrap"
],
},
importHash: {
type: DataTypes.STRING(255),
allowNull: true,
unique: true,
},
},
{
timestamps: true,
paranoid: true,
freezeTableName: true,
},
);
tools.associate = (db) => {
db.tools.belongsTo(db.users, {
as: 'createdBy',
});
db.tools.belongsTo(db.users, {
as: 'updatedBy',
});
};
return tools;
};