diff --git a/backend/controllers/eventController.js b/backend/controllers/eventController.js index 4c0c9e3..eb8a605 100644 --- a/backend/controllers/eventController.js +++ b/backend/controllers/eventController.js @@ -252,7 +252,7 @@ exports.getEventByPublicHash = async (req, res) => { }] }); if (!event) return res.status(404).json({ message: '이벤트를 찾을 수 없습니다.' }); - if (event.status === '취소') return res.status(403).json({ message: '취소된 이벤트입니다.' }); + if (event.status === 'canceled') return res.status(403).json({ message: '취소된 이벤트입니다.' }); // 2. 비밀번호 필요 여부 및 인증 if (event.accessPassword) { @@ -287,6 +287,7 @@ exports.getEventByPublicHash = async (req, res) => { } }) ); + console.log('allMembersWithAverage', allMembersWithAverage); // 4. 참가자 명단 추출 (참가자 테이블 + Member 조인) const participants = await EventParticipant.findAll({ @@ -571,6 +572,7 @@ exports.updateEvent = async (req, res) => { gameCount, laneCount, status, + registrationDeadline, publicHash, accessPassword } = req.body; @@ -607,6 +609,7 @@ exports.updateEvent = async (req, res) => { gameCount: gameCount || event.gameCount, laneCount: laneCount || event.laneCount, status: status || event.status, + registrationDeadline: registrationDeadline || event.registrationDeadline, publicHash: publicHash || event.publicHash, accessPassword: accessPassword || null }; diff --git a/backend/controllers/publicController.js b/backend/controllers/publicController.js index f25af7c..c71e651 100644 --- a/backend/controllers/publicController.js +++ b/backend/controllers/publicController.js @@ -19,7 +19,7 @@ exports.publicEventEntry = async (req, res) => { if (!event) { return res.status(404).json({ message: '이벤트를 찾을 수 없습니다.' }); } - if (event.status === '취소') { + if (event.status === 'canceled') { return res.status(403).json({ message: '취소된 이벤트입니다.' }); } @@ -88,7 +88,7 @@ exports.getEventByPublicHash = async (event, token = null) => { attributes: [[sequelize.col('id'), 'memberId'], 'name', 'memberType', 'gender', 'handicap'] }); const participants = await EventParticipant.findAll({ - where: { eventId: event.id, status: { [Op.ne]: '취소' } }, + where: { eventId: event.id, status: { [Op.ne]: 'canceled' } }, include: [ { model: Member, attributes: [[sequelize.col('id'), 'memberId'], 'name', 'memberType', 'gender', 'handicap'] } ] }); // 모든 회원에 대한 에버리지 계산 @@ -117,11 +117,11 @@ exports.getEventByPublicHash = async (event, token = null) => { } } const participantMemberIds = [ - ...new Set(participants.filter(p => p.dataValues.status !== '취소').map(p => parseInt(p.dataValues.memberId))) + ...new Set(participants.filter(p => p.dataValues.status !== 'canceled').map(p => parseInt(p.dataValues.memberId))) ]; // 상태별로 미참가자/게스트 추가 제한 let availableMembers = []; - if (event.status === '준비') { + if (event.status === 'ready') { availableMembers = allMemberObjs.filter(m => !participantMemberIds.includes(parseInt(m.memberId))); } // 준비 아닐 땐 빈 배열(신청/게스트 추가 불가) // 팀 정보 @@ -132,7 +132,7 @@ exports.getEventByPublicHash = async (event, token = null) => { model: EventTeamMember, include: [{ model: EventParticipant, - where: { status: { [Op.ne]: '취소' } }, + where: { status: { [Op.ne]: 'canceled' } }, include: [{ model: Member, attributes: [[sequelize.col('id'), 'memberId'], 'name', 'memberType', 'gender', 'handicap'] }] }] }]