Webler-Group / webler-codes

4 stars 0 forks source link

Admin Notification #54

Open Bytenol opened 3 months ago

Bytenol commented 3 months ago

Notify user(s) regarding an activity.

POST /api/notifications (Endpoint)

Content-Type: application/json
Authorization: Bearer <admin_token>

**Body**
```json
{
  "title": "System Maintenance",
  "message": "The system will undergo maintenance on Sunday at 3 AM.",
  "type": "info",
  "recipients": ["all"]
}```
Now type could be [info, warning, alert etc]
recipient could be [all, userId1, user1d30, ...]

**Response**
Status 201 when created
```json
{
  "success": true,
  "data": {
    "id": "12345",
    "title": "System Maintenance",
    "message": "The system will undergo maintenance on Sunday at 3 AM.",
    "type": "info",
    "recipients": ["all"],
    "createdAt": "2024-08-01T12:00:00.000Z",
    "updatedAt": "2024-08-01T12:00:00.000Z"
  }
}

DELETE /api/notification