Notifications System APIs and Schemas
Notifications System APIs and Microservice
Notifications System APIs
POST /users: This method creates a new user profile and is typically used during user registration.
GET /users/{id}: This method retrieves a specific user profile based on the provided user ID.
PUT /users/{id}: This method updates an existing user profile based on the provided user ID.
DELETE /users/{id}: This method deletes a specific user profile based on the provided user ID.
POST /notifications: This method creates a new notification and is typically used by other services to send notifications to users.
GET /notifications/{id}: This method retrieves a specific notification based on the provided notification ID.
PUT /notifications/{id}: This method updates an existing notification based on the provided notification ID.
DELETE /notifications/{id}: This method deletes a specific notification based on the provided notification ID.
GET /users/{id}/notifications: This method retrieves a list of notifications for a specific user based on the provided user ID.
PUT /users/{id}/notifications/{id}: This method updates the status of a notification for a specific user based on the provided user ID and notification ID.
Notifications System Database Schemas
Diagram examples
Users Table:
Column Name | Data Type | Constraints |
---|---|---|
id | INTEGER | PRIMARY KEY, AUTO INCREMENT |
name | VARCHAR(255) | NOT NULL |
VARCHAR(255) | NOT NULL, UNIQUE | |
created_at | TIMESTAMP | NOT NULL, DEFAULT CURRENT_TIMESTAMP |
Notifications Table:
Column Name | Data Type | Constraints |
---|---|---|
id | INTEGER | PRIMARY KEY, AUTO INCREMENT |
sender_id | INTEGER | NOT NULL, FOREIGN KEY REFERENCES Users(id) |
recipient_id | INTEGER | NOT NULL, FOREIGN KEY REFERENCES Users(id) |
message | TEXT | NOT NULL |
status | ENUM | NOT NULL |
created_at | TIMESTAMP | NOT NULL, DEFAULT CURRENT_TIMESTAMP |
User_Notifications Table:
Column Name | Data Type | Constraints |
---|---|---|
id | INTEGER | PRIMARY KEY, AUTO INCREMENT |
user_id | INTEGER | NOT NULL, FOREIGN KEY REFERENCES Users(id) |
notification_id | INTEGER | NOT NULL, FOREIGN KEY REFERENCES Notifications(id) |
status | ENUM | NOT NULL |
Devices Table:
Column Name | Data Type | Constraints |
---|---|---|
id | INTEGER | PRIMARY KEY, AUTO INCREMENT |
user_id | INTEGER | NOT NULL, FOREIGN KEY REFERENCES Users(id) |
device_type | VARCHAR(255) | NOT NULL |
operating_system | VARCHAR(255) | NOT NULL |
created_at | TIMESTAMP | NOT NULL, DEFAULT CURRENT_TIMESTAMP |
Settings Table:
Column Name | Data Type | Constraints |
---|---|---|
id | INTEGER | PRIMARY KEY, AUTO INCREMENT |
user_id | INTEGER | NOT NULL, FOREIGN KEY REFERENCES Users(id) |
frequency | ENUM | NOT NULL |
channels | VARCHAR(255) | NOT NULL |
updated_at | TIMESTAMP | NOT NULL, DEFAULT CURRENT_TIMESTAMP |