mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
begin building general blocking solution
This commit is contained in:
@@ -3,6 +3,7 @@ import { authWithHeaders } from '../../middlewares/auth';
|
||||
import { ensurePermission } from '../../middlewares/ensureAccessRight';
|
||||
import { model as User } from '../../models/user';
|
||||
import { model as UserHistory } from '../../models/userHistory';
|
||||
import { model as Blocker } from '../../models/blocker';
|
||||
import {
|
||||
NotFound,
|
||||
} from '../../libs/errors';
|
||||
@@ -116,4 +117,18 @@ api.getUserHistory = {
|
||||
},
|
||||
};
|
||||
|
||||
api.getBlockers = {
|
||||
method: 'GET',
|
||||
url: '/admin/blockers',
|
||||
middlewares: [authWithHeaders(), ensurePermission('userSupport')],
|
||||
async handler (req, res) {
|
||||
const blockers = await Blocker
|
||||
.find()
|
||||
.lean()
|
||||
.exec();
|
||||
|
||||
res.respond(200, blockers);
|
||||
},
|
||||
};
|
||||
|
||||
export default api;
|
||||
|
||||
Reference in New Issue
Block a user