모델 코멘트 입력

This commit is contained in:
2025-04-26 08:04:04 +09:00
parent d1b22d4272
commit 283c8a7f4a
18 changed files with 293 additions and 140 deletions
+21 -10
View File
@@ -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) => {