Skip to main content

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 NameData TypeConstraints
idINTEGERPRIMARY KEY, AUTO INCREMENT
nameVARCHAR(255)NOT NULL
emailVARCHAR(255)NOT NULL, UNIQUE
created_atTIMESTAMPNOT NULL, DEFAULT CURRENT_TIMESTAMP

Notifications Table:

Column NameData TypeConstraints
idINTEGERPRIMARY KEY, AUTO INCREMENT
sender_idINTEGERNOT NULL, FOREIGN KEY REFERENCES Users(id)
recipient_idINTEGERNOT NULL, FOREIGN KEY REFERENCES Users(id)
messageTEXTNOT NULL
statusENUMNOT NULL
created_atTIMESTAMPNOT NULL, DEFAULT CURRENT_TIMESTAMP

User_Notifications Table:

Column NameData TypeConstraints
idINTEGERPRIMARY KEY, AUTO INCREMENT
user_idINTEGERNOT NULL, FOREIGN KEY REFERENCES Users(id)
notification_idINTEGERNOT NULL, FOREIGN KEY REFERENCES Notifications(id)
statusENUMNOT NULL

Devices Table:

Column NameData TypeConstraints
idINTEGERPRIMARY KEY, AUTO INCREMENT
user_idINTEGERNOT NULL, FOREIGN KEY REFERENCES Users(id)
device_typeVARCHAR(255)NOT NULL
operating_systemVARCHAR(255)NOT NULL
created_atTIMESTAMPNOT NULL, DEFAULT CURRENT_TIMESTAMP

Settings Table:

Column NameData TypeConstraints
idINTEGERPRIMARY KEY, AUTO INCREMENT
user_idINTEGERNOT NULL, FOREIGN KEY REFERENCES Users(id)
frequencyENUMNOT NULL
channelsVARCHAR(255)NOT NULL
updated_atTIMESTAMPNOT NULL, DEFAULT CURRENT_TIMESTAMP