handling closing posts
This commit is contained in:
@@ -72,6 +72,18 @@ const ForumPost = sequelize.define('ForumPost', {
|
||||
deletedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true
|
||||
},
|
||||
closedBy: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: true,
|
||||
references: {
|
||||
model: 'Users',
|
||||
key: 'id'
|
||||
}
|
||||
},
|
||||
closedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ Message.belongsTo(Message, {
|
||||
// Forum associations
|
||||
User.hasMany(ForumPost, { as: "forumPosts", foreignKey: "authorId" });
|
||||
ForumPost.belongsTo(User, { as: "author", foreignKey: "authorId" });
|
||||
ForumPost.belongsTo(User, { as: "closer", foreignKey: "closedBy" });
|
||||
|
||||
User.hasMany(ForumComment, { as: "forumComments", foreignKey: "authorId" });
|
||||
ForumComment.belongsTo(User, { as: "author", foreignKey: "authorId" });
|
||||
|
||||
Reference in New Issue
Block a user