sef-global / scholarx-backend

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

Implement Get all mentors endpoint (Admin) #24 #67

Closed sathudeva7 closed 11 months ago

sathudeva7 commented 11 months ago

Purpose

The purpose of this PR is to fix #24

Goals

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

Approach

```const mentorsList: Mentor[] = await mentorRepository.find({
  where: { state: status },
  select: [
    'application',
    'availability',
    'state',
    'created_at',
    'updated_at'
  ],
  relations: ['profile', 'category']
})

This api endpoint request application json in a different format so created a function with switch case according to json question function return specific key for the application object in the response

### Screenshots
<!---  Include an animated GIF or screenshot if the change affects the UI.  -->
![Screenshot 2023-10-04 at 12 46 32](https://github.com/sef-global/scholarx-backend/assets/67930416/18daa379-b961-418a-8cb9-e7c4316e8956)

##  Checklist
- [x] This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
- [x] I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
- [ ] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation

## Related PRs
<!--- List any other related PRs --> 

## Test environment
<!--- List all versions, operating systems, databases, and browser/versions on which this feature/fix was tested --> 

## Learning
<!--- Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem. -->
sathudeva7 commented 11 months ago

Screenshot 2023-10-04 at 12 46 32