From 283c8a7f4ab88bb6b025641b1939926e25a7a0f3 Mon Sep 17 00:00:00 2001 From: Jaybe Date: Sat, 26 Apr 2025 08:04:04 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AA=A8=EB=8D=B8=20=EC=BD=94=EB=A9=98?= =?UTF-8?q?=ED=8A=B8=20=EC=9E=85=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/models/Club.js | 31 +++++++++----- backend/models/ClubFeature.js | 22 ++++++---- backend/models/ClubSubscription.js | 22 ++++++---- backend/models/Event.js | 49 +++++++++++++++-------- backend/models/EventParticipant.js | 19 ++++++--- backend/models/EventScore.js | 23 +++++++---- backend/models/EventTeam.js | 6 +++ backend/models/EventTeamMember.js | 10 +++-- backend/models/Feature.js | 25 ++++++++---- backend/models/Member.js | 40 ++++++++++++------ backend/models/Menu.js | 39 +++++++++++------- backend/models/Notification.js | 31 +++++++++----- backend/models/Participant.js | 31 +++++++++----- backend/models/SubscriptionPlan.js | 19 ++++++--- backend/models/SubscriptionPlanFeature.js | 13 ++++-- backend/models/User.js | 31 +++++++++----- backend/models/activityLog.js | 16 +++++--- backend/seeders/20250424-init-menus.js | 6 +-- 18 files changed, 293 insertions(+), 140 deletions(-) diff --git a/backend/models/Club.js b/backend/models/Club.js index e8b9ee1..b35bf9a 100644 --- a/backend/models/Club.js +++ b/backend/models/Club.js @@ -5,15 +5,18 @@ const Club = sequelize.define('Club', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '클럽 고유 식별자' }, name: { type: DataTypes.STRING, - allowNull: false + allowNull: false, + comment: '클럽명' }, description: { type: DataTypes.TEXT, - allowNull: true + allowNull: true, + comment: '클럽 설명' }, ownerId: { type: DataTypes.INTEGER.UNSIGNED, @@ -21,36 +24,44 @@ const Club = sequelize.define('Club', { references: { model: 'Users', key: 'id' - } + }, + comment: '클럽장(소유자) 유저 ID' }, location: { type: DataTypes.STRING, - allowNull: true + allowNull: true, + comment: '주 활동 지역' }, contact: { type: DataTypes.STRING, - allowNull: true + allowNull: true, + comment: '연락처' }, status: { type: DataTypes.ENUM('active', 'inactive', 'suspended'), allowNull: false, - defaultValue: 'active' + defaultValue: 'active', + comment: '클럽 상태' }, memberCount: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '회원 수' }, createdAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '생성일' }, updatedAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '수정일' } }, { tableName: 'Clubs', + comment: '볼링 클럽 정보를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/ClubFeature.js b/backend/models/ClubFeature.js index c7f6205..ea4632f 100644 --- a/backend/models/ClubFeature.js +++ b/backend/models/ClubFeature.js @@ -5,7 +5,8 @@ const ClubFeature = sequelize.define('ClubFeature', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '클럽-기능 연결 고유 식별자' }, clubId: { type: DataTypes.INTEGER.UNSIGNED, @@ -13,7 +14,8 @@ const ClubFeature = sequelize.define('ClubFeature', { references: { model: 'Clubs', key: 'id' - } + }, + comment: '클럽 ID' }, featureId: { type: DataTypes.INTEGER.UNSIGNED, @@ -21,27 +23,33 @@ const ClubFeature = sequelize.define('ClubFeature', { references: { model: 'Features', key: 'id' - } + }, + comment: '기능 ID' }, enabled: { type: DataTypes.BOOLEAN, allowNull: false, - defaultValue: true + defaultValue: true, + comment: '기능 활성화 여부' }, expiryDate: { type: DataTypes.DATE, - allowNull: true + allowNull: true, + comment: '기능 만료일' }, createdAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '생성일' }, updatedAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '수정일' } }, { tableName: 'ClubFeatures', + comment: '클럽별 활성화된 기능 정보를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/ClubSubscription.js b/backend/models/ClubSubscription.js index fa831d5..cc4dc96 100644 --- a/backend/models/ClubSubscription.js +++ b/backend/models/ClubSubscription.js @@ -5,7 +5,8 @@ const ClubSubscription = sequelize.define('ClubSubscription', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '클럽-구독 연결 고유 식별자' }, clubId: { type: DataTypes.INTEGER.UNSIGNED, @@ -13,7 +14,8 @@ const ClubSubscription = sequelize.define('ClubSubscription', { references: { model: 'Clubs', key: 'id' - } + }, + comment: '클럽 ID' }, planId: { type: DataTypes.INTEGER.UNSIGNED, @@ -21,28 +23,34 @@ const ClubSubscription = sequelize.define('ClubSubscription', { references: { model: 'SubscriptionPlans', key: 'id' - } + }, + comment: '구독 플랜 ID' }, status: { type: DataTypes.ENUM('active', 'expired', 'suspended'), defaultValue: 'active', - allowNull: false + allowNull: false, + comment: '구독 상태' }, startDate: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '구독 시작일' }, endDate: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '구독 종료일' }, price: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '구독 가격' } }, { tableName: 'ClubSubscriptions', + comment: '클럽별 구독 정보(플랜 등)를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/Event.js b/backend/models/Event.js index 3b807d8..3d9f79e 100644 --- a/backend/models/Event.js +++ b/backend/models/Event.js @@ -5,7 +5,8 @@ const Event = sequelize.define('Event', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '이벤트 고유 식별자' }, clubId: { type: DataTypes.INTEGER.UNSIGNED, @@ -13,72 +14,88 @@ const Event = sequelize.define('Event', { references: { model: 'Clubs', key: 'id' - } + }, + comment: '소속 클럽 ID' }, title: { type: DataTypes.STRING, - allowNull: false + allowNull: false, + comment: '이벤트 제목' }, description: { type: DataTypes.TEXT, - allowNull: true + allowNull: true, + comment: '이벤트 설명' }, eventType: { type: DataTypes.ENUM('정기전', '번개', '연습', '교류전', '이벤트', '기타'), allowNull: false, - defaultValue: '정기전' + defaultValue: '정기전', + comment: '이벤트 유형' }, startDate: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '시작일' }, endDate: { type: DataTypes.DATE, - allowNull: true + allowNull: true, + comment: '종료일' }, location: { type: DataTypes.STRING, - allowNull: true + allowNull: true, + comment: '장소' }, gameCount: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 3 + defaultValue: 3, + comment: '게임 수' }, participantFee: { type: DataTypes.DECIMAL(10, 2), allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '참가비' }, maxParticipants: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '최대 참가 인원' }, registrationDeadline: { type: DataTypes.DATE, - allowNull: true + allowNull: true, + comment: '참가 신청 마감일' }, participantCount: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '참가자 수' }, status: { type: DataTypes.ENUM('준비', '활성', '완료', '취소', '삭제'), allowNull: false, - defaultValue: '활성' + defaultValue: '활성', + comment: '이벤트 상태' }, createdAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '생성일' }, updatedAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '수정일' } }, { tableName: 'Events', + comment: '클럽 내 이벤트(대회, 모임 등) 정보를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/EventParticipant.js b/backend/models/EventParticipant.js index c9fbd2a..5748461 100644 --- a/backend/models/EventParticipant.js +++ b/backend/models/EventParticipant.js @@ -5,7 +5,8 @@ const EventParticipant = sequelize.define('EventParticipant', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '이벤트 참가자 고유 식별자' }, eventId: { type: DataTypes.INTEGER.UNSIGNED, @@ -13,7 +14,8 @@ const EventParticipant = sequelize.define('EventParticipant', { references: { model: 'Events', key: 'id' - } + }, + comment: '이벤트 ID' }, memberId: { type: DataTypes.INTEGER.UNSIGNED, @@ -21,7 +23,8 @@ const EventParticipant = sequelize.define('EventParticipant', { references: { model: 'Members', key: 'id' - } + }, + comment: '회원 ID' }, teamId: { type: DataTypes.INTEGER.UNSIGNED, @@ -29,20 +32,24 @@ const EventParticipant = sequelize.define('EventParticipant', { references: { model: 'EventTeams', key: 'id' - } + }, + comment: '이벤트 팀 ID' }, status: { type: DataTypes.ENUM('참가예정', '참가확정', '취소'), allowNull: false, - defaultValue: '참가예정' + defaultValue: '참가예정', + comment: '참가 상태' }, paymentStatus: { type: DataTypes.ENUM('미납', '납부완료'), allowNull: false, - defaultValue: '미납' + defaultValue: '미납', + comment: '참가비 납부 상태' } }, { tableName: 'EventParticipants', + comment: '이벤트별 참가자 정보를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/EventScore.js b/backend/models/EventScore.js index ed9488f..a71ffd3 100644 --- a/backend/models/EventScore.js +++ b/backend/models/EventScore.js @@ -5,7 +5,8 @@ const EventScore = sequelize.define('EventScore', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '점수 고유 식별자' }, eventId: { type: DataTypes.INTEGER.UNSIGNED, @@ -13,7 +14,8 @@ const EventScore = sequelize.define('EventScore', { references: { model: 'Events', key: 'id' - } + }, + comment: '이벤트 ID' }, participantId: { type: DataTypes.INTEGER.UNSIGNED, @@ -21,31 +23,38 @@ const EventScore = sequelize.define('EventScore', { references: { model: 'EventParticipants', key: 'id' - } + }, + comment: '이벤트 참가자 ID' }, teamNumber: { type: DataTypes.INTEGER.UNSIGNED, allowNull: true, + comment: '팀 번호' }, gameNumber: { type: DataTypes.INTEGER.UNSIGNED, - allowNull: false + allowNull: false, + comment: '게임 번호' }, score: { type: DataTypes.INTEGER, - allowNull: false + allowNull: false, + comment: '점수' }, handicap: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '핸디캡' }, totalScore: { type: DataTypes.INTEGER, - allowNull: false + allowNull: false, + comment: '총점' } }, { tableName: 'EventScores', + comment: '이벤트별 참가자 점수 정보를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/EventTeam.js b/backend/models/EventTeam.js index 85e4b0f..691138e 100644 --- a/backend/models/EventTeam.js +++ b/backend/models/EventTeam.js @@ -6,25 +6,31 @@ const EventTeam = sequelize.define('EventTeam', { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, autoIncrement: true, + comment: '이벤트 팀 고유 식별자', }, eventId: { type: DataTypes.INTEGER.UNSIGNED, allowNull: false, + comment: '이벤트 ID', }, teamNumber: { type: DataTypes.INTEGER.UNSIGNED, allowNull: false, + comment: '팀 번호', }, name: { type: DataTypes.STRING, allowNull: true, + comment: '팀명', }, handicap: { type: DataTypes.INTEGER, allowNull: true, + comment: '팀 핸디캡', }, }, { tableName: 'EventTeams', + comment: '이벤트별 팀 정보를 저장하는 테이블', timestamps: true, }); diff --git a/backend/models/EventTeamMember.js b/backend/models/EventTeamMember.js index b16fded..50ae716 100644 --- a/backend/models/EventTeamMember.js +++ b/backend/models/EventTeamMember.js @@ -5,20 +5,24 @@ const EventTeamMember = sequelize.define('EventTeamMember', { eventTeamId: { type: DataTypes.INTEGER.UNSIGNED, allowNull: false, - primaryKey: true + primaryKey: true, + comment: '이벤트 팀 ID' }, eventParticipantId: { type: DataTypes.INTEGER.UNSIGNED, allowNull: false, - primaryKey: true + primaryKey: true, + comment: '이벤트 참가자 ID' }, order: { type: DataTypes.INTEGER.UNSIGNED, allowNull: false, - defaultValue: 1 + defaultValue: 1, + comment: '팀 내 순번' } }, { tableName: 'EventTeamMembers', + comment: '이벤트 팀별 멤버 정보를 저장하는 테이블', timestamps: false }); diff --git a/backend/models/Feature.js b/backend/models/Feature.js index c636d76..ac2a30f 100644 --- a/backend/models/Feature.js +++ b/backend/models/Feature.js @@ -5,41 +5,50 @@ const Feature = sequelize.define('Feature', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '기능 고유 식별자' }, code: { type: DataTypes.STRING, allowNull: false, - unique: true + unique: true, + comment: '기능 코드' }, name: { type: DataTypes.STRING, - allowNull: false + allowNull: false, + comment: '기능명' }, description: { type: DataTypes.TEXT, - allowNull: true + allowNull: true, + comment: '기능 설명' }, price: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '기능 가격' }, status: { type: DataTypes.ENUM('active', 'inactive', 'suspended'), allowNull: false, - defaultValue: 'active' + defaultValue: 'active', + comment: '기능 상태' }, createdAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '생성일' }, updatedAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '수정일' } }, { tableName: 'Features', + comment: '클럽에서 제공하는 기능 정보를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/Member.js b/backend/models/Member.js index a637a9d..5314604 100644 --- a/backend/models/Member.js +++ b/backend/models/Member.js @@ -7,7 +7,8 @@ const Member = sequelize.define('Member', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '회원 고유 식별자' }, clubId: { type: DataTypes.INTEGER.UNSIGNED, @@ -15,7 +16,8 @@ const Member = sequelize.define('Member', { references: { model: 'Clubs', key: 'id' - } + }, + comment: '소속 클럽 ID' }, userId: { type: DataTypes.INTEGER.UNSIGNED, @@ -23,56 +25,68 @@ const Member = sequelize.define('Member', { references: { model: 'Users', key: 'id' - } + }, + comment: '유저 ID' }, name: { type: DataTypes.STRING, - allowNull: false + allowNull: false, + comment: '회원 이름' }, gender: { type: DataTypes.ENUM('남성', '여성'), - allowNull: false + allowNull: false, + comment: '성별' }, memberType: { type: DataTypes.ENUM('정회원', '준회원', '운영진', '모임장'), allowNull: false, - defaultValue: '준회원' + defaultValue: '준회원', + comment: '회원 유형' }, handicap: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '핸디캡' }, average: { type: DataTypes.FLOAT, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '평균 점수' }, games: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '게임 수' }, phone: { type: DataTypes.STRING, - allowNull: true + allowNull: true, + comment: '전화번호' }, email: { type: DataTypes.STRING, - allowNull: true + allowNull: true, + comment: '이메일' }, joinDate: { type: DataTypes.DATE, allowNull: false, - defaultValue: DataTypes.NOW + defaultValue: DataTypes.NOW, + comment: '가입일' }, status: { type: DataTypes.ENUM('active', 'inactive', 'suspended', 'deleted'), allowNull: false, - defaultValue: 'active' + defaultValue: 'active', + comment: '회원 상태' } }, { tableName: 'Members', + comment: '클럽 회원 정보를 저장하는 테이블', timestamps: true }); Member.associate = (models) => { diff --git a/backend/models/Menu.js b/backend/models/Menu.js index 8b0716a..800204a 100644 --- a/backend/models/Menu.js +++ b/backend/models/Menu.js @@ -5,7 +5,8 @@ const Menu = sequelize.define('Menu', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '메뉴 고유 식별자' }, parentId: { type: DataTypes.INTEGER.UNSIGNED, @@ -13,19 +14,23 @@ const Menu = sequelize.define('Menu', { references: { model: 'Menus', // 실제 테이블명 key: 'id' - } + }, + comment: '상위 메뉴 ID' }, title: { type: DataTypes.STRING, - allowNull: false + allowNull: false, + comment: '메뉴명' }, icon: { type: DataTypes.STRING, - allowNull: true + allowNull: true, + comment: '아이콘' }, to: { type: DataTypes.STRING, - allowNull: false + allowNull: false, + comment: '라우팅 경로' }, featureCode: { type: DataTypes.STRING, @@ -33,37 +38,41 @@ const Menu = sequelize.define('Menu', { references: { model: 'Features', key: 'code' - } - }, - requiredSubscriptionTier: { - type: DataTypes.ENUM('basic', 'standard', 'premium'), - allowNull: true + }, + comment: '연결된 기능 코드' }, + role: { type: DataTypes.STRING, allowNull: false, - defaultValue: 'user' + defaultValue: 'user', + comment: '권한 역할' }, order: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '정렬 순서' }, visible: { type: DataTypes.BOOLEAN, allowNull: false, - defaultValue: true + defaultValue: true, + comment: '표시 여부' }, createdAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '생성일' }, updatedAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '수정일' } }, { tableName: 'Menus', + comment: '서비스 내 메뉴 구조 및 정보를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/Notification.js b/backend/models/Notification.js index 97bc168..115deb2 100644 --- a/backend/models/Notification.js +++ b/backend/models/Notification.js @@ -5,7 +5,8 @@ const Notification = sequelize.define('Notification', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '알림 고유 식별자' }, userId: { type: DataTypes.INTEGER.UNSIGNED, @@ -13,46 +14,56 @@ const Notification = sequelize.define('Notification', { references: { model: 'Users', key: 'id' - } + }, + comment: '유저 ID' }, title: { type: DataTypes.STRING, - allowNull: false + allowNull: false, + comment: '알림 제목' }, message: { type: DataTypes.TEXT, - allowNull: false + allowNull: false, + comment: '알림 내용' }, icon: { type: DataTypes.STRING, - defaultValue: 'pi pi-info-circle' + defaultValue: 'pi pi-info-circle', + comment: '아이콘' }, type: { type: DataTypes.ENUM('info', 'success', 'warning', 'error'), - defaultValue: 'info' + defaultValue: 'info', + comment: '알림 타입' }, read: { type: DataTypes.BOOLEAN, allowNull: false, - defaultValue: false + defaultValue: false, + comment: '읽음 여부' }, link: { type: DataTypes.STRING, allowNull: true, - defaultValue: null + defaultValue: null, + comment: '관련 링크' }, createdAt: { type: DataTypes.DATE, allowNull: false, - defaultValue: DataTypes.NOW + defaultValue: DataTypes.NOW, + comment: '생성일' }, updatedAt: { type: DataTypes.DATE, allowNull: false, - defaultValue: DataTypes.NOW + defaultValue: DataTypes.NOW, + comment: '수정일' } }, { timestamps: true, + comment: '유저 알림 정보를 저장하는 테이블', tableName: 'Notifications' }); diff --git a/backend/models/Participant.js b/backend/models/Participant.js index 6863cac..14ac24a 100644 --- a/backend/models/Participant.js +++ b/backend/models/Participant.js @@ -5,7 +5,8 @@ const Participant = sequelize.define('Participant', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '미팅 참가자 고유 식별자' }, meetingId: { type: DataTypes.INTEGER.UNSIGNED, @@ -13,7 +14,8 @@ const Participant = sequelize.define('Participant', { references: { model: 'Meetings', key: 'id' - } + }, + comment: '미팅 ID' }, memberId: { type: DataTypes.INTEGER.UNSIGNED, @@ -21,42 +23,51 @@ const Participant = sequelize.define('Participant', { references: { model: 'Members', key: 'id' - } + }, + comment: '회원 ID' }, teamNumber: { type: DataTypes.INTEGER.UNSIGNED, allowNull: false, - defaultValue: 1 + defaultValue: 1, + comment: '팀 번호' }, status: { type: DataTypes.ENUM('참가예정', '참가완료', '취소'), allowNull: false, - defaultValue: '참가예정' + defaultValue: '참가예정', + comment: '참가 상태' }, attendance: { type: DataTypes.BOOLEAN, - defaultValue: false + defaultValue: false, + comment: '출석 여부' }, paymentStatus: { type: DataTypes.ENUM('미납', '납부완료'), allowNull: false, - defaultValue: '미납' + defaultValue: '미납', + comment: '참가비 납부 상태' }, paymentAmount: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '납부 금액' }, createdAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '생성일' }, updatedAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '수정일' } }, { tableName: 'EventParticipants', + comment: '미팅 참가자 정보를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/SubscriptionPlan.js b/backend/models/SubscriptionPlan.js index 30093ea..998a5e9 100644 --- a/backend/models/SubscriptionPlan.js +++ b/backend/models/SubscriptionPlan.js @@ -5,31 +5,38 @@ const SubscriptionPlan = sequelize.define('SubscriptionPlan', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '구독 플랜 고유 식별자' }, name: { type: DataTypes.STRING, - allowNull: false + allowNull: false, + comment: '플랜명' }, description: { - type: DataTypes.TEXT + type: DataTypes.TEXT, + comment: '플랜 설명' }, maxMembers: { type: DataTypes.INTEGER, - allowNull: false + allowNull: false, + comment: '최대 허용 회원 수' }, price: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: 0 + defaultValue: 0, + comment: '플랜 가격' }, status: { type: DataTypes.ENUM('active', 'inactive'), defaultValue: 'active', - allowNull: false + allowNull: false, + comment: '플랜 상태' } }, { tableName: 'SubscriptionPlan', + comment: '구독 플랜 정보를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/SubscriptionPlanFeature.js b/backend/models/SubscriptionPlanFeature.js index c9f055a..8e68b1b 100644 --- a/backend/models/SubscriptionPlanFeature.js +++ b/backend/models/SubscriptionPlanFeature.js @@ -5,7 +5,8 @@ const SubscriptionPlanFeature = sequelize.define('SubscriptionPlanFeature', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '구독-기능 연결 고유 식별자' }, planId: { type: DataTypes.INTEGER.UNSIGNED, @@ -13,7 +14,8 @@ const SubscriptionPlanFeature = sequelize.define('SubscriptionPlanFeature', { references: { model: 'SubscriptionPlans', key: 'id' - } + }, + comment: '구독 플랜 ID' }, featureId: { type: DataTypes.INTEGER.UNSIGNED, @@ -21,15 +23,18 @@ const SubscriptionPlanFeature = sequelize.define('SubscriptionPlanFeature', { references: { model: 'Features', key: 'id' - } + }, + comment: '기능 ID' }, status: { type: DataTypes.ENUM('active', 'inactive'), defaultValue: 'active', - allowNull: false + allowNull: false, + comment: '상태' } }, { tableName: 'SubscriptionPlanFeatures', + comment: '구독 플랜별 제공 기능 정보를 저장하는 테이블', timestamps: true }); diff --git a/backend/models/User.js b/backend/models/User.js index be40e7c..e4f04fb 100644 --- a/backend/models/User.js +++ b/backend/models/User.js @@ -6,20 +6,24 @@ const User = sequelize.define('User', { id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '유저 고유 식별자' }, username: { type: DataTypes.STRING, allowNull: false, - unique: true + unique: true, + comment: '로그인 계정명' }, password: { type: DataTypes.STRING, - allowNull: false + allowNull: false, + comment: '비밀번호(해시)' }, name: { type: DataTypes.STRING, - allowNull: false + allowNull: false, + comment: '이름' }, email: { type: DataTypes.STRING, @@ -27,32 +31,39 @@ const User = sequelize.define('User', { unique: true, validate: { isEmail: true - } + }, + comment: '이메일' }, role: { type: DataTypes.ENUM('admin', 'clubadmin', 'user'), allowNull: false, - defaultValue: 'user' + defaultValue: 'user', + comment: '권한 역할' }, status: { type: DataTypes.ENUM('active', 'inactive', 'suspended'), allowNull: false, - defaultValue: 'active' + defaultValue: 'active', + comment: '계정 상태' }, lastLoginAt: { type: DataTypes.DATE, - allowNull: true + allowNull: true, + comment: '마지막 로그인 일시' }, createdAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '생성일' }, updatedAt: { type: DataTypes.DATE, - allowNull: false + allowNull: false, + comment: '수정일' } }, { tableName: 'Users', + comment: '서비스 회원(유저) 정보를 저장하는 테이블', timestamps: true, hooks: { beforeCreate: async (user) => { diff --git a/backend/models/activityLog.js b/backend/models/activityLog.js index f1c485b..7d3c14e 100644 --- a/backend/models/activityLog.js +++ b/backend/models/activityLog.js @@ -7,7 +7,8 @@ ActivityLog.init({ id: { type: DataTypes.INTEGER.UNSIGNED, primaryKey: true, - autoIncrement: true + autoIncrement: true, + comment: '활동 로그 고유 식별자' }, userId: { type: DataTypes.INTEGER.UNSIGNED, @@ -15,22 +16,27 @@ ActivityLog.init({ references: { model: 'Users', key: 'id' - } + }, + comment: '유저 ID' }, type: { type: DataTypes.STRING(50), - allowNull: false + allowNull: false, + comment: '로그 유형' }, description: { type: DataTypes.TEXT, - allowNull: true + allowNull: true, + comment: '상세 설명' }, createdAt: { type: DataTypes.DATE, - defaultValue: DataTypes.NOW + defaultValue: DataTypes.NOW, + comment: '생성일' } }, { sequelize, + comment: '유저 활동 로그를 저장하는 테이블', modelName: 'ActivityLog', tableName: 'ActivityLogs', timestamps: true, diff --git a/backend/seeders/20250424-init-menus.js b/backend/seeders/20250424-init-menus.js index 422b1af..80ed2a2 100644 --- a/backend/seeders/20250424-init-menus.js +++ b/backend/seeders/20250424-init-menus.js @@ -56,7 +56,7 @@ module.exports = { visible: true, parentId: clubMenuId, featureCode: 'event_management', - requiredSubscriptionTier: 'standard', + createdAt: new Date(), updatedAt: new Date() }, @@ -69,7 +69,7 @@ module.exports = { visible: true, parentId: clubMenuId, featureCode: 'event_calendar', - requiredSubscriptionTier: 'standard', + createdAt: new Date(), updatedAt: new Date() }, @@ -82,7 +82,7 @@ module.exports = { visible: true, parentId: clubMenuId, featureCode: 'statistics', - requiredSubscriptionTier: 'premium', + createdAt: new Date(), updatedAt: new Date() }