diff --git a/models/Friend.js b/models/Friend.js index d9c41e2be2ea225a11caebc7cd5fed37f1391f56..d3d71311660d8478bd78c4d8f6357ba93257df27 100644 --- a/models/Friend.js +++ b/models/Friend.js @@ -5,19 +5,20 @@ const sequelize = require('../config/sequelize'); const User = require('./User'); const Friend = sequelize.define('Friend', { - type: { - type: DataTypes.ENUM('NORMAL', 'SPECIAL'), - allowNull: false, - }, + status: { + type: DataTypes.ENUM('PENDING', 'ACCEPTED'), + allowNull: false, + defaultValue: 'PENDING' + } }, { - tableName: 'Friends', - timestamps: true, + tableName: 'Friends', + timestamps: true, }); 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; +module.exports = Friend; \ No newline at end of file