mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-24 05:39:35 +02:00
Backend: auth for bookmarks and categories
This commit is contained in:
parent
22471d64c7
commit
0d36c5cf94
6 changed files with 39 additions and 12 deletions
|
@ -6,8 +6,12 @@ const { Sequelize } = require('sequelize');
|
|||
// @route GET /api/bookmarks
|
||||
// @access Public
|
||||
const getAllBookmarks = asyncWrapper(async (req, res, next) => {
|
||||
// bookmarks visibility
|
||||
const where = req.isAuthenticated ? {} : { isPublic: true };
|
||||
|
||||
const bookmarks = await Bookmark.findAll({
|
||||
order: [[Sequelize.fn('lower', Sequelize.col('name')), 'ASC']],
|
||||
where,
|
||||
});
|
||||
|
||||
res.status(200).json({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue