클럽 설정 기능

This commit is contained in:
2025-05-14 05:10:41 +09:00
parent 8e9b941a28
commit a2b5ce88a6
8 changed files with 731 additions and 40 deletions
+12 -1
View File
@@ -265,6 +265,10 @@ exports.addPublicGuest = async (req, res) => {
// 클럽의 회원 수와 구독 플랜의 최대 회원 수 확인
const memberCount = await Member.count({ where: { clubId: event.clubId } });
// 클럽 정보 가져오기 (여성 기본 핸디캡 확인을 위해)
const club = await Club.findByPk(event.clubId);
if (!club) return res.status(404).json({ message: '클럽 정보를 찾을 수 없습니다.' });
// 클럽의 구독 정보 가져오기 - 가장 최근 구독 정보
const clubSubscription = await sequelize.models.ClubSubscription.findOne({
where: { clubId: event.clubId },
@@ -288,6 +292,12 @@ exports.addPublicGuest = async (req, res) => {
}
}
// 여성 핸디캡 적용
let handicap = null;
if (gender === '여성' && club.femaleHandicap) {
handicap = club.femaleHandicap;
}
// publicAuth 미들웨어로 인증됨
const member = await Member.create({
name,
@@ -295,7 +305,8 @@ exports.addPublicGuest = async (req, res) => {
gender,
clubId: event.clubId,
memberType: '게스트',
average: average || 0
average: average || 0,
handicap: handicap // 여성 핸디캡 적용
});
const participant = await EventParticipant.create({ eventId: event.id, memberId: member.id });
res.json({