hngprojects / hng_boilerplate_php_laravel_web

Apache License 2.0
148 stars 58 forks source link

[FIX] (PHP) [FIX](PHP)Refactoring Notifications API endpoint to Retrieve User's Notifications (Read or Unread) #578

Open Muhammad235 opened 3 weeks ago

Muhammad235 commented 3 weeks ago

Description

This is for refactoring the notification API endpoint for retrieving user's notification

Route

GET: /api/v1/notifications

Response Body

200 OK

{
  "data": {
    "total_notification_count": 0,
    "total_unread_notification_count": 0,
    "notifications": [
      {
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "is_read": true,
        "message": "string",
        "created_at": "2024-08-24T13:40:04.921Z",
        "updated_at": "2024-08-24T13:40:04.921Z"
      }
    ]
  },
  "message": "string",
  "status_code": 0
}

400 BAD REQUEST

{
  "data": "string",
  "error": "string",
  "message": "string",
  "status_code": 0
}

401 UNAUTHORIZED

{
  "data": "string",
  "error": "string",
  "message": "string",
  "status_code": 0
}