mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-22 21:09:36 +02:00
Split apps controllers into separate files
This commit is contained in:
parent
b7de1e3d27
commit
34279c8b8c
16 changed files with 444 additions and 398 deletions
23
controllers/apps/reorderApps.js
Normal file
23
controllers/apps/reorderApps.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const asyncWrapper = require('../../middleware/asyncWrapper');
|
||||
const App = require('../../models/App');
|
||||
|
||||
// @desc Reorder apps
|
||||
// @route PUT /api/apps/0/reorder
|
||||
// @access Public
|
||||
const reorderApps = asyncWrapper(async (req, res, next) => {
|
||||
req.body.apps.forEach(async ({ id, orderId }) => {
|
||||
await App.update(
|
||||
{ orderId },
|
||||
{
|
||||
where: { id },
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
res.status(200).json({
|
||||
success: true,
|
||||
data: {},
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = reorderApps;
|
Loading…
Add table
Add a link
Reference in a new issue