sef-global / scholarx-backend

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

Implement Get mentors by category endpoint (Admin) #26 #76

Closed sathudeva7 closed 3 months ago

sathudeva7 commented 10 months ago

Purpose

The purpose of this PR is to fix #26

Goals

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

Approach

const mentors: Mentor[] = await mentorRepository .createQueryBuilder('mentor') .innerJoinAndSelect('mentor.category', 'category') .leftJoinAndSelect('mentor.profile', 'profile') .select([ 'mentor.uuid', 'category.category', 'mentor.application', 'profile.contact_email', 'profile.first_name', 'profile.last_name', 'profile.image_url', 'profile.linkedin_url' ]) .where('category.category ILIKE :name', { name: categoryQuery }) .getMany()

Screenshots

Checklist

Related PRs

## Test environment ## Learning
sathudeva7 commented 10 months ago

@anjula-sack please review this

anjula-sack commented 3 months ago

Closing due to inactivity