From eaffea6ff66cb07e6e6c3c9359fa706825986323 Mon Sep 17 00:00:00 2001 From: Jaybe Date: Wed, 22 Oct 2025 20:04:37 +0900 Subject: [PATCH] =?UTF-8?q?clubId=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/controllers/fileUploadController.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/backend/controllers/fileUploadController.js b/backend/controllers/fileUploadController.js index 0c41dce..dd57e2e 100644 --- a/backend/controllers/fileUploadController.js +++ b/backend/controllers/fileUploadController.js @@ -522,6 +522,11 @@ exports.saveEventFileData = async (req, res) => { if (!eventData || !participants || !clubId) { return res.status(400).json({ message: '이벤트 정보, 참가자 정보, 클럽 ID가 필요합니다.' }); } + // clubId 타입 보정 (문자열로 들어온 경우 Number로 변환) + const cid = Number(clubId); + if (!cid || Number.isNaN(cid)) { + return res.status(400).json({ message: '유효한 클럽 ID가 필요합니다.' }); + } try { // 트랜잭션 시작 @@ -553,7 +558,7 @@ exports.saveEventFileData = async (req, res) => { if (eventData.id) { // 기존 이벤트 업데이트 event = await Event.findOne({ - where: { id: eventData.id, clubId }, + where: { id: eventData.id, clubId: cid }, transaction: t }); @@ -575,7 +580,7 @@ exports.saveEventFileData = async (req, res) => { } else { // 새 이벤트 생성 event = await Event.create({ - clubId, + clubId: cid, title: eventData.title, description: eventData.description || '', eventType: normalizeEventType(eventData.eventType), @@ -666,7 +671,7 @@ exports.saveEventFileData = async (req, res) => { } else { // 새 회원 생성 및 참가자 등록 const newMember = await Member.create({ - clubId, // required by Member model + clubId: cid, // required by Member model name: participant.name, // normalize enum values to match Member model gender: (participant.gender === 'female' || participant.gender === '여성') ? 'female' : 'male', @@ -676,7 +681,7 @@ exports.saveEventFileData = async (req, res) => { // 클럽 회원으로 등록 await ClubMember.create({ - clubId, + clubId: cid, memberId: newMember.id, joinDate: new Date(), status: 'active'