code4moldova/voluntar-backend

VB 19 : add endpoint to get the list of requests for a cluster using a cluster id

Closed this issue · 0 comments

The volunteer must be able to see the list of request for a cluster without login, but using cluster_id.

GET /api/requests/filters/1/15?cluster_id=5f9c803dff70da4c8a766ae1
Media type: Application/json

Description:
Method should filter returned records by query parameters.

Query parameters:

  • cluster_id

Responses:
200: An array of request objects
Example value:

{
  "count": 4, 
  "list": [
    {
      "_id": "5f9c803dff70da4c8a766ae6", 
      "beneficiary": {
        "_id": "5f9c803dff70da4c8a766ae0", 
        "first_name": "Nicolae", 
        "last_name": "Popa", 
        "latitude": 47.03426007926646, 
        "longitude": 28.845011996559723, 
        "zone": "botanica"
      }, 
      "comments": "By leg still nor hit blue page. Foot nor wonder whether. Try follow reveal.", 
      "created_at": "Sat, 02 May 2020 00:00:00 GMT", 
      "has_symptoms": false, 
      "number": 3509, 
      "status": "archived", 
      "type": "medicine", 
      "urgent": false, 
      "volunteer": {
        "_id": "5f9c803dff70da4c8a766ad2", 
        "cluster_id": "5f9c803dff70da4c8a766ae1", 
        "first_name": "Valerii", 
        "last_name": "Rever"
      }
    }, 
....
]}

400: Bad request
Example value:

{
  "code": "string",
  "message": "string"
}

401: Unauthorized Access
Example value:
Unauthorized Access