first commit
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
|
||||
# Notification API
|
||||
|
||||
## Create New Notification
|
||||
|
||||
**Endpoint**
|
||||
|
||||
```
|
||||
POST: http://localhost:3070/api/notification
|
||||
```
|
||||
|
||||
|
||||
**Request Body**
|
||||
|
||||
```json
|
||||
{
|
||||
"notificationHeadline": "System Maintenance",
|
||||
"notificationDescription": "The system will be unavailable from 10 PM to 12 AM.",
|
||||
"notificationType": "ANNOUNCEMENT"
|
||||
}
|
||||
```
|
||||
|
||||
**Respond**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "Notification created successfully",
|
||||
"notification": {
|
||||
"notification_id": "notif_1782553200000",
|
||||
"notificationHeadline": "System Maintenance",
|
||||
"notificationDescription": "The system will be unavailable from 10 PM to 12 AM.",
|
||||
"notificationType": "ANNOUNCEMENT",
|
||||
"dateCreated": "2026-06-27T05:30:00.000Z",
|
||||
"isActive": true,
|
||||
"updatedAt": "2026-06-27T05:30:00.000Z",
|
||||
"createdAt": "2026-06-27T05:30:00.000Z"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Get Announcements
|
||||
|
||||
**Endpoint**
|
||||
|
||||
```
|
||||
GET: http://localhost:3070/api/notification/announcements
|
||||
```
|
||||
|
||||
**Respond**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"announcements": [
|
||||
{
|
||||
"notification_id": "notif_1782553200000",
|
||||
"notificationHeadline": "System Maintenance",
|
||||
"notificationDescription": "The system will be unavailable from 10 PM to 12 AM.",
|
||||
"notificationType": "ANNOUNCEMENT",
|
||||
"isActive": true,
|
||||
"dateCreated": "2026-06-27T05:30:00.000Z",
|
||||
"createdAt": "2026-06-27T05:30:00.000Z",
|
||||
"updatedAt": "2026-06-27T05:30:00.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Get User Notifications
|
||||
|
||||
**Endpoint**
|
||||
|
||||
```
|
||||
GET: http://localhost:3070/api/notification/user/:userId
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
GET: http://localhost:3070/api/notification/user/usr_12345
|
||||
```
|
||||
|
||||
**Respond**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"notifications": [
|
||||
{
|
||||
"id": "userNotif_001",
|
||||
"user_id": "usr_12345",
|
||||
"notification_id": "notif_1782553200000",
|
||||
"isRead": false,
|
||||
"createdAt": "2026-06-27T05:30:00.000Z",
|
||||
"updatedAt": "2026-06-27T05:30:00.000Z",
|
||||
"notification": {
|
||||
"notification_id": "notif_1782553200000",
|
||||
"notificationHeadline": "System Maintenance",
|
||||
"notificationDescription": "The system will be unavailable from 10 PM to 12 AM.",
|
||||
"notificationType": "ANNOUNCEMENT",
|
||||
"isActive": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Mark Notification As Read
|
||||
|
||||
**Endpoint**
|
||||
|
||||
```
|
||||
PATCH: http://localhost:3070/api/notification/user/:userId/notification/:notificationId/read
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
PATCH: http://localhost:3070/api/notification/user/usr_12345/notification/notif_1782553200000/read
|
||||
```
|
||||
|
||||
**Respond**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"message": "Notification marked as read"
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user