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 warranty_documents = sequelize.define( 'warranty_documents', { id: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4, primaryKey: true, }, document_name: { type: DataTypes.TEXT, }, document_type: { type: DataTypes.TEXT, }, file_path: { type: DataTypes.TEXT, }, file_size: { type: DataTypes.INTEGER, }, mime_type: { type: DataTypes.TEXT, }, importHash: { type: DataTypes.STRING(255), allowNull: true, unique: true, }, }, { timestamps: true, paranoid: true, freezeTableName: true, }, ); warranty_documents.associate = (db) => { db.warranty_documents.belongsTo(db.users, { as: 'createdBy', }); db.warranty_documents.belongsTo(db.users, { as: 'updatedBy', }); }; return warranty_documents; };