sef-global / scholarx-backend

This is the backend of the ScholarX
MIT License
11 stars 38 forks source link

Implement get my mentor applications endpoint #78

Closed Madhawa97 closed 11 months ago

Madhawa97 commented 11 months ago

Purpose

The purpose of this PR is to fix #20

Goals

This issue involves implementing an API to get all my mentor applications. The endpoint should allow clients to make a GET request to {{baseUrl}}/api/me/applications?type=mentor

Approach

Created a controller for the /controllers/profile endpoint in the backend and according to the API documentation, when accessed via localhost:3000/api/me/applications?type=mentor it will return the mentor applications of the particular user.

response:

{
  "mentor applications": [
    {
      "state": "rejected",
      "category": {
        "category": "cs",
        "uuid": "95ba00c0-8173-43c4-9573-6b481b4085e2",
        "created_at": "2023-09-23T01:32:42.532Z",
        "updated_at": "2023-09-23T01:32:42.532Z"
      },
      "application": [
        {
          "question": "What is your country?",
          "answers": "US"
        },
        {
          "question": "What is your expertise?",
          "answers": "CS"
        },
        {
          "question": "What is your mentoring startegy?",
          "answers": "I will provide my thoughts"
        }
      ],
      "availability": true,
      "profile": {
        "primary_email": "madhawa1@gmail.com",
        "contact_email": "",
        "first_name": "",
        "last_name": "",
        "image_url": "",
        "linkedin_url": "",
        "type": "default",
        "uuid": "8267bbdc-87cd-45e2-86c7-fa46e684b05c",
        "created_at": "2023-09-23T01:33:29.559Z",
        "updated_at": "2023-09-23T01:33:29.559Z"
      },
      "uuid": "b510ce89-f479-40ba-b69c-ea9eec2cfd63",
      "created_at": "2023-10-27T19:58:25.140Z",
      "updated_at": "2023-10-27T19:58:25.140Z"
    },
    {
      "state": "pending",
      "category": {
        "category": "cs",
        "uuid": "95ba00c0-8173-43c4-9573-6b481b4085e2",
        "created_at": "2023-09-23T01:32:42.532Z",
        "updated_at": "2023-09-23T01:32:42.532Z"
      },
      "application": [
        {
          "question": "What is your country?",
          "answers": "US"
        },
        {
          "question": "What is your expertise?",
          "answers": "CS"
        },
        {
          "question": "What is your mentoring startegy?",
          "answers": "I will provide my thoughts"
        }
      ],
      "availability": true,
      "profile": {
        "primary_email": "madhawa1@gmail.com",
        "contact_email": "",
        "first_name": "",
        "last_name": "",
        "image_url": "",
        "linkedin_url": "",
        "type": "default",
        "uuid": "8267bbdc-87cd-45e2-86c7-fa46e684b05c",
        "created_at": "2023-09-23T01:33:29.559Z",
        "updated_at": "2023-09-23T01:33:29.559Z"
      },
      "uuid": "c7c806ae-05c3-4a9e-b243-e85c334dc847",
      "created_at": "2023-10-29T12:46:34.860Z",
      "updated_at": "2023-10-29T12:46:34.860Z"
    }
  ],
  "message": "Mentor applications found"
}

Screenshots

Checklist

Related PRs

## Test environment ## Learning
Madhawa97 commented 11 months ago

Will be adding the tests..

Madhawa97 commented 11 months ago

No problem 🙌