Skip to content
Snippets Groups Projects
Commit d5a83d2e authored by 조대희's avatar 조대희
Browse files

refactor: friend 모델 컬럼 수정 (#7)

parent f8501f60
No related branches found
No related tags found
2 merge requests!31Develop,!8[#7] Friend 서비스 로직 개발
This commit is part of merge request !8. Comments created here will be created in the context of that merge request.
......@@ -5,10 +5,11 @@ const sequelize = require('../config/sequelize');
const User = require('./User');
const Friend = sequelize.define('Friend', {
type: {
type: DataTypes.ENUM('NORMAL', 'SPECIAL'),
status: {
type: DataTypes.ENUM('PENDING', 'ACCEPTED'),
allowNull: false,
},
defaultValue: 'PENDING'
}
}, {
tableName: 'Friends',
timestamps: true,
......@@ -18,6 +19,6 @@ Friend.belongsTo(User, { foreignKey: 'user_id', as: 'user' });
Friend.belongsTo(User, { foreignKey: 'friend_id', as: 'friend' });
User.hasMany(Friend, { foreignKey: 'user_id', as: 'friends' });
User.hasMany(Friend, { foreignKey: 'friend_id', as: 'friendOf' });
User.hasMany(Friend, { foreignKey: 'friend_id', as: 'friendRequests' });
module.exports = Friend;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment