Comentarios para el blog
This commit is contained in:
parent
dd8c6a38ff
commit
72946c6c01
@ -57,6 +57,15 @@ module.exports = function (sequelize, DataTypes) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Comment.addScope('onlyPosts', () => {
|
||||||
|
return {
|
||||||
|
where: {
|
||||||
|
entityName: 'post'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
Comment.associate = function (models) {
|
Comment.associate = function (models) {
|
||||||
Comment.User = Comment.belongsTo(models.User, { foreignKey: 'userId', constraints: false, as: 'user' });
|
Comment.User = Comment.belongsTo(models.User, { foreignKey: 'userId', constraints: false, as: 'user' });
|
||||||
};
|
};
|
||||||
|
|||||||
@ -75,6 +75,23 @@ routes.get('/admin/comments/events/:entityId',
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
routes.get('/admin/comments/posts/:entityId',
|
||||||
|
isAdministratorUser,
|
||||||
|
// PaginateMiddleware.middleware(),
|
||||||
|
SortMiddleware.middleware({ default: "createdAt" }),
|
||||||
|
commentController.find({
|
||||||
|
scopes: ['defaultScope', 'onlyPosts'],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
routes.get('/admin/comments/speakers/:entityId',
|
||||||
|
isAdministratorUser,
|
||||||
|
// PaginateMiddleware.middleware(),
|
||||||
|
SortMiddleware.middleware({ default: "createdAt" }),
|
||||||
|
commentController.find({
|
||||||
|
scopes: ['defaultScope', 'onlySpeakers'],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
// Borrado
|
// Borrado
|
||||||
routes.delete('/admin/comments/:id',
|
routes.delete('/admin/comments/:id',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user