Get dashboard notifications
GET/company/dashboard
Returns a summary of unread notifications and the latest notifications for the authenticated user.
Use Cases:
- Display an unread notification counter in the UI
- List recent notifications in the user panel
- Synchronize notification status between devices
- Update notification status in real-time
- Integration with enterprise monitoring systems
Typical Flow:
- The client calls this endpoint when loading the dashboard or when it detects changes
- The server validates the JWT token and obtains the company ID
- Queries for unread notifications and the last 10 notifications
- Returns the count of unread notifications and the list of notifications
- The client updates the UI showing the counter and the list
Considerations:
- Notifications are sorted by creation date in descending order
- The maximum limit of notifications returned is 10
- Only notifications from the user's company are included
- The endpoint is cacheable for 60 seconds for optimization
Implementation Example:
// Example frontend call
async function fetchDashboardNotifications() {
const response = await fetch('/company/notifications/dashboard', {
headers: {
'Authorization': `Bearer ${userToken}`
}
});
const data = await response.json();
updateNotificationBadge(data.unreadCount);
renderNotificationsList(data.lastNotifications);
}
Responses
- 200
- 401
- 404
Successful operation
Unauthorized - Invalid or missing JWT token
User or company not found - The token does not correspond to a valid user