Skip to content
Snippets Groups Projects

Cherry-pick admin capabilities from SLS

Merged Ghost User requested to merge admin-cherry into main
12 files
+ 465
86
Compare changes
  • Side-by-side
  • Inline
Files
12
@@ -231,6 +231,27 @@ exports.findAllApproved = (req, res) => {
};
exports.findAll = async (req, res) => {
Topic.findAll({attributes:["topic_id","name", "approved", "information"]}).then(data =>
res.send(data)
).catch(err => {
res.status(responseStatusCodes.InternalServerError).send({
message: err.message || "Error retrieving Topics with all approved Stati"
});
});
};
exports.updateTopicApproved = async (req, res) => {
Topic.update({ approved: req.body.approved }, { where: { topic_id: req.body.topic_id} }).then(data => {
if (data[0] === 1) {
logger.log(`Topic was ${req.body.approved?"activated":"deactivated"} with id: ${req.body.topic_id}`);
res.send(true);
}
}).catch(err => {
logger.error("Error approving topic", err);
});
};
exports.pinTopic = async (req, res) => {
const user_id = parseInt(req.user.user_id);
const topic_id = parseInt(req.params.topic_id);
Loading