Skip to content

Latest commit

 

History

History
132 lines (105 loc) · 2.61 KB

README.md

File metadata and controls

132 lines (105 loc) · 2.61 KB

🔔 Notifications Microsservice


NestJS TypeScript Prisma

📄 Description

  This service was born out of the fact that many applications need notifications functionality nowadays, so it is extremely feasible to separate this functionality into a single microservice that can be implemented by anyone who wants to.

  This microservice specializes in notifications, where other applications can communicate with it to send notifications. This service will only be responsible for notifications.

🖥️ Run Application

Clone this Repository

$ git clone https://github.com/gabrielvsc/notifications-microservice.git

Go to the directory

$ cd notifications-microsservice

Install dependencies

$ npm install

Run with

$ npm run start

This starts in http://localhost:3000

🧪 Run Tests

Run Tests with

$ npm run test
$ npm run test:watch

You can run with Prisma Studio

 $ npx prisma studio

📕 API Documentation

📌 Create Notification

  POST /notifications

Create a Notification if you give a body with.. recipientId must be a UUID.

JSON Example: { "recipientId": "6d6eec98-1b86-4bda-891c-d0b595697273", "content": "New Test Notification", "category": "Test" }


📌 Count from Recipient

  GET /notifications/count/from/{recipientId}

Returns a count of {recipientId} notifications

JSON Example: { "count": 1 }


📌 Get from Recipient

  GET /notifications/from/{recipientId}

Returns a Array of {recipientId} notifications JSON Example: { "notifications": [ { "id": "1e5d8ae6-847e-41d3-9151-ff76444b8fac", "content": "New Test Notification", "category": "Test", "recipientId": "6d6eec98-1b86-4bda-891c-d0b595697273" } ] }


📌 Cancel Notification

  POST /notifications/{id}/cancel

Cancels a {id} notification, does not remove


📌 Read Notification

  POST /notifications/{id}/read

Read a {id} notification.


📌 Unread Notification

  POST /notifications/{id}/unread

Unread a {id} notification.