The favorites system allows authenticated users to save their commonly traveled routes for quick access, eliminating the need to repeatedly enter origin and destination details.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ihfaz297/MND/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Favorites are saved routes with:- Custom labels (e.g., “Home to Campus”, “Morning Commute”)
- Origin and destination nodes
- Optional default departure time
- Per-user storage with a limit of 10 favorites
Authentication is required to use the favorites feature. See the Authentication guide for details on obtaining an auth token.
Getting Your Favorites
Retrieve all saved favorites for the authenticated user:Response Example
Response Example
Creating a Favorite
Save a new favorite route:Provide route details
Send a POST request with the route information:
The
defaultTime field is optional. If omitted, it defaults to “08:00”.Required Fields
| Field | Type | Description |
|---|---|---|
label | string | Display name for the favorite (e.g., “Home to Campus”) |
from | string | Origin node ID (must be a valid node in the network) |
to | string | Destination node ID (must be a valid node) |
defaultTime | string | Optional default departure time in HH:MM format |
Updating a Favorite
Modify the label or default time of an existing favorite:Response Example
Response Example
Deleting a Favorite
Remove a favorite route:Using Favorites for Quick Route Planning
Once you have favorites saved, you can use them to quickly plan routes:Error Handling
Duplicate Favorites
If you try to save a route that’s already in your favorites:Limit Reached
Each user can save a maximum of 10 favorites:Invalid Node IDs
If thefrom or to node doesn’t exist:
Unauthorized Access
Attempting to access favorites without authentication:Favorite Not Found
Trying to update or delete a favorite that doesn’t exist or doesn’t belong to you:Best Practices
Naming Conventions
Naming Conventions
Use descriptive labels that make sense at a glance:Good labels:
- “Home to Campus (Morning)”
- “Campus to Library”
- “Weekend Market Trip”
- “Route 1”
- “TILAGOR to CAMPUS”
- “A”
Setting Default Times
Setting Default Times
Choose default times based on your regular schedule:
- Morning commute: Set to your typical departure time (e.g., “08:00”)
- Return trips: Use your usual class end time (e.g., “17:00”)
- Flexible routes: Use “08:00” as a neutral default
Managing the 10-favorite limit
Managing the 10-favorite limit
- Delete seasonal favorites (e.g., routes used only during exam week)
- Combine similar routes with generic labels
- Keep only your most frequent trips
- Regularly review and remove unused favorites
Favorites Data Storage
Favorites are stored in thefavorites.json file on the server:
Each favorite is linked to a
userId ensuring users can only see and modify their own favorites.Implementation Reference
The favorites feature is implemented insrc/api/favoritesController.ts:
- GET /api/favorites - Returns all favorites for the authenticated user (line 58)
- POST /api/favorites - Creates a new favorite with validation and deduplication (line 97)
- PUT /api/favorites/:id - Updates label or defaultTime for a favorite (line 250)
- DELETE /api/favorites/:id - Removes a favorite from the user’s list (line 189)
Related Documentation
- Authentication - Required for saving favorites
- Planning Routes - Use saved favorites to quickly plan routes
- Viewing Schedules - Check bus times for your favorite routes