Skip to content

Implement Get all mentees by status endpoint (Admin)  #31

Open
@janithlahirukariyawasam

Description

Description:
This issue involves implementing an API to get all mentees by status. The endpoint should allow Admin to make a GET request to {{baseUrl}}/api/admin/mentees?status=ONGOING.

Example get all approved mentees

{
  "mentees": [
    {
      "mentee_id": 1,
      "created_at": "2023-06-30T08:00:00Z",
      "updated_at": "2023-06-30T12:30:00Z",
      "state": "APPROVED",
      "answers": {
        "question1": "answer1",
        "question2": "answer2"
      },
      "profile": {
        "created_at": "2023-06-29T09:45:00Z",
        "updated_at": "2023-06-30T14:15:00Z",
        "primary_email": "[email protected]",
        "contact_email": "[email protected]",
        "first_name": "Sarah",
        "last_name": "Johnson",
        "image_url": "https://example.com/mentee_profile_image.jpg",
        "linkedin_url": "https://www.linkedin.com/in/sarahjohnson",
        "type": "DEFAULT",
        "uuid": "98765432-2345-6789-2345-678923456789"
      },
      "mentor": {
        "mentor_id": 1,
        "created_at": "2023-06-30T10:00:00Z",
        "updated_at": "2023-06-30T14:30:00Z",
        "state": "APPROVED",
        "category": "Technology",
        "application": {
          "field1": "value1",
          "field2": "value2"
        },
        "availability": true
      },
      "certificate_id": 123,
      "blogs": {
        "blog1": "https://example.com/blog1",
        "blog2": "https://example.com/blog2"
      }
    }
  ]
}

Example get all rejected mentees

{
  "mentees": [
    {
      "mentee_id": 2,
      "created_at": "2023-06-25T12:00:00Z",
      "updated_at": "2023-06-29T10:30:00Z",
      "state": "REJECTED",
      "answers": {
        "question1": "answer3",
        "question2": "answer4"
      },
      "profile": {
        "created_at": "2023-06-24T09:15:00Z",
        "updated_at": "2023-06-29T13:45:00Z",
        "primary_email": "[email protected]",
        "contact_email": "[email protected]",
        "first_name": "Michael",
        "last_name": "Smith",
        "image_url": "https://example.com/mentee2_profile_image.jpg",
        "linkedin_url": "https://www.linkedin.com/in/michaelsmith",
        "type": "DEFAULT",
        "uuid": "67891234-3456-7890-3456-789034567890"
      },
      "mentor": null,
      "certificate_id": null,
      "blogs": ""
    }
  ]
}

Example get all pending mentees

{
  "mentees": [
    {
      "mentee_id": 2,
      "created_at": "2023-06-25T12:00:00Z",
      "updated_at": "2023-06-29T10:30:00Z",
      "state": "PENDING",
      "answers": {
        "question1": "answer3",
        "question2": "answer4"
      },
      "profile": {
        "created_at": "2023-06-24T09:15:00Z",
        "updated_at": "2023-06-29T13:45:00Z",
        "primary_email": "[email protected]",
        "contact_email": "[email protected]",
        "first_name": "Michael",
        "last_name": "Smith",
        "image_url": "https://example.com/mentee2_profile_image.jpg",
        "linkedin_url": "https://www.linkedin.com/in/michaelsmith",
        "type": "DEFAULT",
        "uuid": "67891234-3456-7890-3456-789034567890"
      },
      "mentor": null,
      "certificate_id": null,
      "blogs": {}
    }
  ]
}

Tasks:

  1. Create a controller for the /controllers/mentee endpoint in the backend (create the route mentee if not created).
  2. Parse and validate the request body to ensure it matches the expected format.
  3. Implement appropriate error handling and response status codes for different scenarios (e.g., validation errors, database errors).
  4. Write unit tests to validate the functionality and correctness of the endpoint.

API documentation: https://documenter.getpostman.com/view/27421496/2s93m1a4ac#8744a3ee-970f-489a-853d-8b23fdee8de3

ER diagram: https://drive.google.com/file/d/11KMgdNu2mSAm0Ner8UsSPQpZJS8QNqYc/view

Acceptance Criteria:

  • The profile API endpoint /controllers/mentee is implemented via a GET request.
  • The request body is properly parsed and validated for the required format.
  • Appropriate error handling is implemented, providing meaningful error messages and correct response status codes.
  • Unit tests are written to validate the functionality and correctness of the endpoint.

Additional Information:
No

Related Dependencies or References:
No

Metadata

Metadata

Assignees

No one assigned

    Labels

    adminAdmin related taskbackendA backend task

    Type

    No type

    Projects

    Status

    Groomed

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions