sef-global / scholarx-backend

This is the backend of the ScholarX
MIT License
10 stars 33 forks source link

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

Open janithlahirukariyawasam opened 1 year ago

janithlahirukariyawasam commented 1 year ago

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": "mentee@example.com",
        "contact_email": "mentee_contact@example.com",
        "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": "mentee2@example.com",
        "contact_email": "mentee2_contact@example.com",
        "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": "mentee2@example.com",
        "contact_email": "mentee2_contact@example.com",
        "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:

Additional Information: No

Related Dependencies or References: No

loshithan commented 9 months ago

Hi @anjula-sack i would like to work on this issue

anjula-sack commented 9 months ago

Hi @anjula-sack i would like to work on this issue

Go ahead @loshithan

dsmabulage commented 1 month ago

@anjula-sack Shall I work on this issue please ?

dsmabulage commented 1 month ago

@anjula-sack can you review this