Skip to content

Commit

Permalink
#18 started favorites controller and routes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sxnny-s committed Jan 7, 2025
1 parent 4e84741 commit fee7e58
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions server/controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,22 @@ const userController = {
} catch (error) {
next(error)
}
},
addFavoriteCompany: async (req, res, next) => {
try {

} catch (error) {
next(error)
}
},
getFavoritesCompanies: async (req, res, next) => {
try {
const favorites = await User.find({ clerkId: req.auth.userId }).select('favoriteCompanies')
} catch (error) {
next(error)
}
}

}

export default userController
4 changes: 2 additions & 2 deletions server/routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const userRouter = express.Router()

userRouter.post('/', userController.addUser);
userRouter.get('/', userController.getAllUsers);
userRouter.get('/' )

userRouter.get('/favorites', userController.getFavoritesCompanies)
userRouter.post('/favorites', userController.addFavoriteCompany)

export default userRouter

0 comments on commit fee7e58

Please sign in to comment.