As a Sporta User, I want to receive real-time notifications for events such as event cancellations, friend requests, and friend request acceptances so that I can stay informed about important updates in the application.
Story Points: 8
Priority: High
Risk: High
Child of: #1
Task Breakdown:
- Create Notification Entity and Repository:
-
Define the Notification entity with fields: id, userId, message, type, createdAt, isRead.
-
Create NotificationRepository for CRUD operations.
- Implement Notification Service:
-
Add methods to send, fetch, and mark notifications as read.
-
Use SimpMessagingTemplate to send real-time notifications via WebSocket.
- Integrate with Existing Services:
- Add REST Endpoints:
-
Create NotificationController with endpoints:
-
GET /notifications/{userId}: Fetch all notifications for a user.
-
GET /notifications/{userId}/unread: Fetch unread notifications for a user.
PATCH /notifications/{notificationId}/read: Mark a notification as read.
Acceptance Criteria:
- Notifications are sent to users when:
-
An event they are registered for is cancelled.
-
They receive a friend request.
-
Their friend request is accepted.
-
Notifications are stored in the database and can be fetched via REST API.
-
Real-time notifications are delivered to users via WebSocket.
-
Users can mark notifications as read.
Blackbox Testing:
- Verify that notifications are sent when:
-
Verify that notifications are stored in the database and can be fetched via REST API.
-
Verify that real-time notifications are delivered to the frontend via WebSocket.
-
Verify that users can mark notifications as read.
Regression Testing:
-
Ensure that existing functionality (e.g., event management, friend requests) is not broken after integrating the notification service.
-
Test the performance impact of sending real-time notifications.
Precondition:
- To be successfully logged in to your Sporta account with a valid username and password.
Demo Steps:
- Send a Friend Request:
- Log in as User A.
- Send a friend request to User B.
- Verify that User B receives a real-time notification.
- Accept a Friend Request:
- Log in as User B.
- Accept the friend request from User A.
- Verify that User A receives a real-time notification.
- Cancel an Event:
- Log in as an event organizer.
- Cancel an event that User A is registered for.
- Verify that User A receives a real-time notification.
- Mark Notifications as Read:
- Log in as User A.
- View notifications and mark them as read.
- Verify that the notifications are marked as read in the database.
- Fetch Notifications via REST API:
- Use the REST API to fetch all notifications and unread notifications for User A.
- Verify that the correct notifications are returned.
As a Sporta User, I want to receive real-time notifications for events such as event cancellations, friend requests, and friend request acceptances so that I can stay informed about important updates in the application.
Story Points: 8
Priority: High
Risk: High
Child of: #1
Task Breakdown:
Define the Notification entity with fields: id, userId, message, type, createdAt, isRead.
Create NotificationRepository for CRUD operations.
Add methods to send, fetch, and mark notifications as read.
Use SimpMessagingTemplate to send real-time notifications via WebSocket.
Modify UserServiceImpl to send notifications for friend requests and acceptances.
Modify EventServiceImpl to send notifications for event cancellations.
Create NotificationController with endpoints:
GET /notifications/{userId}: Fetch all notifications for a user.
GET /notifications/{userId}/unread: Fetch unread notifications for a user.
PATCH /notifications/{notificationId}/read: Mark a notification as read.
Acceptance Criteria:
An event they are registered for is cancelled.
They receive a friend request.
Their friend request is accepted.
Notifications are stored in the database and can be fetched via REST API.
Real-time notifications are delivered to users via WebSocket.
Users can mark notifications as read.
Blackbox Testing:
An event is cancelled.
A friend request is sent.
A friend request is accepted.
Verify that notifications are stored in the database and can be fetched via REST API.
Verify that real-time notifications are delivered to the frontend via WebSocket.
Verify that users can mark notifications as read.
Regression Testing:
Ensure that existing functionality (e.g., event management, friend requests) is not broken after integrating the notification service.
Test the performance impact of sending real-time notifications.
Precondition:
Demo Steps: