보안설정 수정, 모바일 최적화 변경
This commit is contained in:
@@ -54,6 +54,7 @@ exports.selectClub = async (req, res) => {
|
||||
}
|
||||
|
||||
req.session.clubId = clubId;
|
||||
console.log(`Session clubId: ${clubId}`);
|
||||
res.status(200).json({ message: '클럽을 선택했습니다.' });
|
||||
} catch (error) {
|
||||
console.error('클럽 선택 오류:', error);
|
||||
@@ -136,18 +137,18 @@ exports.getClubById = async (req, res) => {
|
||||
// 새 클럽 생성
|
||||
exports.createClub = async (req, res) => {
|
||||
try {
|
||||
const { name, location, description, ownerEmail, contact, features, sendInvite } = req.body;
|
||||
const { name, location, description, averageCalculationPeriod } = req.body;
|
||||
|
||||
// 필수 필드 검증
|
||||
if (!name || !ownerEmail) {
|
||||
return res.status(400).json({ message: '클럽 이름과 모임장 이메일은 필수 항목입니다.' });
|
||||
if (!name) {
|
||||
return res.status(400).json({ message: '클럽 이름은 필수 항목입니다.' });
|
||||
}
|
||||
|
||||
// 이메일로 사용자 조회
|
||||
const owner = await User.findOne({ where: { email: ownerEmail } });
|
||||
const owner = await User.findOne({ where: { id: req.user.id } });
|
||||
|
||||
if (!owner) {
|
||||
return res.status(404).json({ message: '해당 이메일로 등록된 사용자를 찾을 수 없습니다.' });
|
||||
return res.status(404).json({ message: '해당 사용자를 찾을 수 없습니다.' });
|
||||
}
|
||||
|
||||
// 클럽 생성
|
||||
@@ -155,7 +156,7 @@ exports.createClub = async (req, res) => {
|
||||
name,
|
||||
location,
|
||||
description,
|
||||
contact,
|
||||
averageCalculationPeriod,
|
||||
ownerId: owner.id,
|
||||
memberCount: 1, // 모임장 포함
|
||||
status: 'active'
|
||||
@@ -172,25 +173,6 @@ exports.createClub = async (req, res) => {
|
||||
status: 'active'
|
||||
});
|
||||
|
||||
// 선택된 기능 추가
|
||||
if (features && features.length > 0) {
|
||||
const featurePromises = features.map(featureId =>
|
||||
ClubFeature.create({
|
||||
clubId: newClub.id,
|
||||
featureId,
|
||||
enabled: true
|
||||
})
|
||||
);
|
||||
|
||||
await Promise.all(featurePromises);
|
||||
}
|
||||
|
||||
// 초대 이메일 발송 로직 (sendInvite가 true인 경우)
|
||||
if (sendInvite) {
|
||||
// TODO: 초대 이메일 발송 로직 구현
|
||||
console.log(`${ownerEmail}에게 초대 이메일 발송 예정`);
|
||||
}
|
||||
|
||||
// 베이직 1개월 플랜 자동 추가
|
||||
try {
|
||||
// 베이직 플랜 조회 (ID가 1이라고 가정, 실제 환경에 맞게 조정 필요)
|
||||
|
||||
Reference in New Issue
Block a user