This commit is contained in:
2025-04-17 23:32:39 +09:00
commit 5b719b6766
105 changed files with 25653 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/database');
const EventParticipant = sequelize.define('EventParticipant', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
eventId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'Events',
key: 'id'
}
},
memberId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'Members',
key: 'id'
}
},
status: {
type: DataTypes.ENUM('참가예정', '참가확정', '취소'),
allowNull: false,
defaultValue: '참가예정'
},
paymentStatus: {
type: DataTypes.ENUM('미납', '납부완료'),
allowNull: false,
defaultValue: '미납'
}
}, {
tableName: 'EventParticipants',
timestamps: true
});
// 관계 설정
EventParticipant.associate = (models) => {
EventParticipant.belongsTo(models.Event, {
foreignKey: 'eventId',
as: 'event'
});
EventParticipant.belongsTo(models.Member, {
foreignKey: 'memberId',
as: 'member'
});
EventParticipant.hasMany(models.EventScore, {
foreignKey: 'participantId',
as: 'scores'
});
};
module.exports = EventParticipant;