참가비 필드 수정
This commit is contained in:
@@ -159,7 +159,9 @@ exports.createEvent = async (req, res) => {
|
||||
location,
|
||||
maxParticipants,
|
||||
eventType,
|
||||
participantFee,
|
||||
entryFee,
|
||||
fee,
|
||||
gameCount,
|
||||
laneCount,
|
||||
status
|
||||
@@ -196,6 +198,14 @@ exports.createEvent = async (req, res) => {
|
||||
const publicHash = await generateRandomHash();
|
||||
const accessPassword = req.body.accessPassword || null;
|
||||
|
||||
// 금액 통합: 문자열("20000.00") 또는 숫자를 허용, 0은 유효값(무료), 빈값은 null 처리
|
||||
let feeRaw = fee ?? entryFee ?? participantFee;
|
||||
let feeParsed = null;
|
||||
if (feeRaw !== undefined && feeRaw !== null && `${feeRaw}`.trim() !== '') {
|
||||
const num = parseFloat(`${feeRaw}`);
|
||||
feeParsed = Number.isFinite(num) ? num : null;
|
||||
}
|
||||
|
||||
const event = await Event.create({
|
||||
clubId,
|
||||
title,
|
||||
@@ -204,11 +214,11 @@ exports.createEvent = async (req, res) => {
|
||||
endDate: endDateVal,
|
||||
location,
|
||||
maxParticipants: maxParticipants || 0,
|
||||
eventType: eventType || '일반',
|
||||
entryFee: entryFee || 0,
|
||||
eventType: eventType || 'regular',
|
||||
participantFee: feeParsed ?? 0,
|
||||
gameCount: gameCount || 3,
|
||||
laneCount: laneCount || 1,
|
||||
status: status || '활성',
|
||||
status: status || 'active',
|
||||
publicHash,
|
||||
accessPassword
|
||||
});
|
||||
@@ -568,7 +578,9 @@ exports.updateEvent = async (req, res) => {
|
||||
location,
|
||||
maxParticipants,
|
||||
eventType,
|
||||
participantFee,
|
||||
entryFee,
|
||||
fee,
|
||||
gameCount,
|
||||
laneCount,
|
||||
status,
|
||||
@@ -597,6 +609,14 @@ exports.updateEvent = async (req, res) => {
|
||||
if(endDate == 'Invalid Date') {
|
||||
endDate = null;
|
||||
}
|
||||
// 금액 통합: 문자열("20000.00") 또는 숫자를 허용, 0은 유효값(무료)
|
||||
let feeRaw = fee ?? entryFee ?? participantFee;
|
||||
let feeParsed = null;
|
||||
if (feeRaw !== undefined && feeRaw !== null && `${feeRaw}`.trim() !== '') {
|
||||
const num = parseFloat(`${feeRaw}`);
|
||||
feeParsed = Number.isFinite(num) ? num : null;
|
||||
}
|
||||
|
||||
const updateData = {
|
||||
title,
|
||||
description,
|
||||
@@ -604,11 +624,11 @@ exports.updateEvent = async (req, res) => {
|
||||
endDate: endDate || null,
|
||||
location,
|
||||
maxParticipants: maxParticipants || event.maxParticipants,
|
||||
eventType: eventType || event.eventType,
|
||||
entryFee: entryFee !== undefined ? entryFee : event.entryFee,
|
||||
eventType: eventType || event.eventType || 'regular',
|
||||
participantFee: feeParsed !== null ? feeParsed : event.participantFee,
|
||||
gameCount: gameCount || event.gameCount,
|
||||
laneCount: laneCount || event.laneCount,
|
||||
status: status || event.status,
|
||||
status: status || event.status || 'active',
|
||||
registrationDeadline: registrationDeadline || event.registrationDeadline,
|
||||
publicHash: publicHash || event.publicHash,
|
||||
accessPassword: accessPassword || null
|
||||
|
||||
Reference in New Issue
Block a user