mirror of
https://github.com/pawelmalak/flame.git
synced 2026-03-09 14:03:11 +08:00
Added auth middleware. Added access control to apps
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
const asyncWrapper = require('../../middleware/asyncWrapper');
|
||||
const App = require('../../models/App');
|
||||
const ErrorResponse = require('../../utils/ErrorResponse');
|
||||
|
||||
// @desc Reorder apps
|
||||
// @route PUT /api/apps/0/reorder
|
||||
// @access Public
|
||||
const reorderApps = asyncWrapper(async (req, res, next) => {
|
||||
if (!req.isAuthenticated) {
|
||||
return next(new ErrorResponse('Unauthorized', 401));
|
||||
}
|
||||
|
||||
req.body.apps.forEach(async ({ id, orderId }) => {
|
||||
await App.update(
|
||||
{ orderId },
|
||||
|
||||
Reference in New Issue
Block a user