mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-29 21:42:23 +03:00
24 lines
538 B
JavaScript
24 lines
538 B
JavaScript
const asyncWrapper = require('../../middleware/asyncWrapper');
|
|
const Bookmark = require('../../models/Bookmark');
|
|
|
|
// @desc Reorder bookmarks
|
|
// @route PUT /api/bookmarks/0/reorder
|
|
// @access Public
|
|
const reorderBookmarks = asyncWrapper(async (req, res, next) => {
|
|
req.body.bookmarks.forEach(async ({ id, orderId }) => {
|
|
await Bookmark.update(
|
|
{ orderId },
|
|
{
|
|
where: { id },
|
|
}
|
|
);
|
|
});
|
|
|
|
res.status(200).json({
|
|
success: true,
|
|
data: {},
|
|
});
|
|
});
|
|
|
|
module.exports = reorderBookmarks;
|