mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-23 18:23:10 +03:00
20 lines
540 B
JavaScript
20 lines
540 B
JavaScript
|
const asyncWrapper = require('../../middleware/asyncWrapper');
|
||
|
const Bookmark = require('../../models/Bookmark');
|
||
|
const { Sequelize } = require('sequelize');
|
||
|
|
||
|
// @desc Get all bookmarks
|
||
|
// @route GET /api/bookmarks
|
||
|
// @access Public
|
||
|
const getAllBookmarks = asyncWrapper(async (req, res, next) => {
|
||
|
const bookmarks = await Bookmark.findAll({
|
||
|
order: [[Sequelize.fn('lower', Sequelize.col('name')), 'ASC']],
|
||
|
});
|
||
|
|
||
|
res.status(200).json({
|
||
|
success: true,
|
||
|
data: bookmarks,
|
||
|
});
|
||
|
});
|
||
|
|
||
|
module.exports = getAllBookmarks;
|