atlp-rwanda / knights-ecomm-be

Knights ecommerce backend APIs
https://knights-ecomm-be-lcdh.onrender.com
0 stars 0 forks source link

System Notification Management #101

Closed Calebgisa72 closed 6 months ago

Calebgisa72 commented 6 months ago

Description As a platform user (vendor or buyer), I want to be notified of every significant event or action related to the products on the e-commerce platform in real-time. This includes notifications for actions such as product addition, expiration, purchase, discounting, etc. This feature will ensure that users stay informed and engaged with the platform's activities.

Acceptance Criteria

Definition of Done

faid-terence commented 6 months ago

Nice Work @Calebgisa72 Now Also attach the implementation plan !

Calebgisa72 commented 6 months ago

The Implementation Plan:

  1. Create a New Branch Task: Create a new branch for this feature. The branch will be called "feat-notifications"

  2. Creating entities needed to work on this task Task: Creating a Notification database Steps: Creating a notification entity that collects all the information of a user notification. Creating notification item entity which will collect all the notifications in the system.

  3. Set Up Notification Infrastructure Task: Set up Socket.IO for real-time notifications. Steps: Install and configure Socket.IO in the backend. Set up a Socket.IO server to handle real-time communication.

  4. Notification Service Task: Create a service for managing notifications. Steps: Implement functions to create, store, and get notifications. Ensuring notifications are targeted to the correct users (vendor/buyer).

  5. Implement API Endpoint Task: Develop an API endpoint for sending notifications. Steps: Create a POST endpoint /send notification. Validate user's authentication and authorization. Use the notification service to send notifications. Implement appropriate error handling and responses.

  6. Update Notification Icon Task: Update the number of new and unread notifications. Steps: Modify the field in the database that contains the number of unread notification. Update the field in real-time as new notifications are received.

  7. Handle Edge Cases Task: Implement error handling for various scenarios. Steps: Handle unauthorized access. Ensure proper handling of notification delivery failures.

  8. Write Unit Tests Task: Create unit tests for the notification service and API endpoint. Steps: Test the notification creation and sending logic. Test the API endpoint with different scenarios (valid actions, invalid actions, unauthorized access). Test the real-time functionality using Socket.IO.

  9. Code Review and Testing Task: Conduct a code review and run tests. Steps: Submit a pull request for review. Address any feedback from the code review. Ensure all tests pass successfully.

  10. Write Documentation Task: Document the API and the notification system. Steps: Write API documentation for the notification endpoint.