Add Favorite POI
Add a POI to the user’s favorites list.Authentication
Requires JWT authentication. Users can manage their own favorites, or admins can manage any user’s favorites.Path Parameters
The user’s unique identifier (MongoDB ObjectId)
Query Parameters
The POI identifier to add to favorites
Response
Success confirmation message
Code Examples
Error Responses
Forbidden - User attempting to modify another user’s favorites
Bad Request - Failed to add favorite
Remove Favorite POI
Remove a POI from the user’s favorites list.Authentication
Requires JWT authentication. Users can manage their own favorites, or admins can manage any user’s favorites.Path Parameters
The user’s unique identifier (MongoDB ObjectId)
The POI identifier to remove from favorites
Response
Success confirmation message
Code Examples
Error Responses
Forbidden - User attempting to modify another user’s favorites
Bad Request - Failed to remove favorite
Authorization Rules
- Self-manage: Users can add/remove favorites from their own account
- Admin-manage: Admins can manage any user’s favorites
- Restricted: Users cannot modify other users’ favorites unless they are admins
Implementation Details
Add Favorite Source:src/infrastructure/api/routers/usuario_router.py:116-135
Remove Favorite Source: src/infrastructure/api/routers/usuario_router.py:137-156
These endpoints use MongoDB’s $addToSet and $pull operators to manage the favorites array:
$addToSetensures no duplicate POIs are added$pullremoves the specified POI from the array