This issue provides a set of API endpoints needed to manage Notifications. These are CRUD endpoints to manage the creation, retrieval and delete operations on Notifications records in the database.
Acceptance Criteria
Notifications can be created
Records of Notifications can be retrieved
Specific Notifications can be updated or deleted by filtering with their Ids
Purpose
Implement a Notification API endpoint to manage user notifications. This endpoint will handle creating, retrieving, and deleting notifications, ensuring users receive timely and relevant updates within the application.
Requirements
[ ] Endpoint creation
Create a new endpoint /api/v1/notifications.
Implement methods for CRUD operations: GET, POST, DELETE.
[ ] Notification Model
Define a Notification model with the following properties:
id (string, unique, required)
user_id (string, required)
title (string, required)
message (string, required)
type (string, e.g., 'info', 'warning', 'error', required)
isRead (boolean, default: false)
createdAt (timestamp, default: current time)
updatedAt (timestamp, default: current time)
[ ] Endpoints
GET/api/v1/notifications: Retrieve all notifications for the authenticated user.
GET/api/v1/notifications/:id: Retrieve a single notification by its ID.
POST/api/v1/notifications: Create a new notification.
DELETE/api/v1/notifications/:id: Delete a notification by its ID.
[ ] Validation
Ensure all required fields are validated
Return appropriate error messages for validation failures with HTTP status code 422.
[ ] Authentication and Authorization
Ensure all endpoints are protected and only accessible to authenticated users.
Implement checks to ensure users can only access their own notifications.
Expected Outcome
A fully functional Notification API endpoint that allows users to create, retrieve, and delete their notifications.
A proper validation to ensure data integrity.
Secure endpoints that are only accessible to authenticated users.
Description
This issue provides a set of API endpoints needed to manage Notifications. These are CRUD endpoints to manage the creation, retrieval and delete operations on Notifications records in the database.
Acceptance Criteria
Purpose
Implement a Notification API endpoint to manage user notifications. This endpoint will handle creating, retrieving, and deleting notifications, ensuring users receive timely and relevant updates within the application.
Requirements
[ ] Endpoint creation
/api/v1/notifications
.[ ] Notification Model
Notification
model with the following properties:id
(string, unique, required)user_id
(string, required)title
(string, required)message
(string, required)type
(string, e.g., 'info', 'warning', 'error', required)isRead
(boolean, default: false)createdAt
(timestamp, default: current time)updatedAt
(timestamp, default: current time)[ ] Endpoints
/api/v1/notifications
: Retrieve all notifications for the authenticated user./api/v1/notifications/:id
: Retrieve a single notification by its ID./api/v1/notifications
: Create a new notification./api/v1/notifications/:id
: Delete a notification by its ID.[ ] Validation
[ ] Authentication and Authorization
Expected Outcome
Database Schema
Table name: notifications_table
Database Diagram
An image of the database model