begin building general blocking solution

This commit is contained in:
Phillip Thelen
2025-05-28 16:30:00 +02:00
parent a9f84d3307
commit 93b7770eaa
3 changed files with 28 additions and 1 deletions

View File

@@ -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;