Files
pp-tcms/backend/models/attachments.js

27 lines
524 B
JavaScript

function defineAttachment(sequelize, DataTypes) {
const Attachment = sequelize.define('Attachment', {
title: {
type: DataTypes.STRING,
allowNull: false,
},
detail: {
type: DataTypes.STRING,
allowNull: true,
},
filename: {
type: DataTypes.STRING,
allowNull: false,
},
});
Attachment.associate = (models) => {
Attachment.belongsToMany(models.Case, {
through: 'caseAttachments',
});
};
return Attachment;
}
export default defineAttachment;