spee.ch/models/request.js

37 lines
665 B
JavaScript

module.exports = (sequelize, { STRING, BOOLEAN, TEXT }) => {
const Request = sequelize.define(
'Request',
{
action: {
type : STRING,
allowNull: false,
},
url: {
type : STRING,
allowNull: false,
},
ipAddress: {
type : STRING,
allowNull: true,
},
result: {
type : TEXT('long'),
allowNull: true,
default : null,
},
},
{
freezeTableName: true,
}
);
Request.associate = db => {
Request.belongsTo(db.File, {
foreignKey: {
allowNull: true,
},
});
};
return Request;
};