Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search Courses Endpoint with Pagination and Fuzzy Search #269

Open
ashayp22 opened this issue Nov 5, 2022 · 0 comments
Open

Search Courses Endpoint with Pagination and Fuzzy Search #269

ashayp22 opened this issue Nov 5, 2022 · 0 comments
Assignees
Labels

Comments

@ashayp22
Copy link
Contributor

ashayp22 commented Nov 5, 2022

Goals

We want to build an endpoint that allows a user to join a course as a learner. This endpoint can be GET learner/search, with search, page, and size query parameters. The course data can be sorted in ascending alphabetical order based on the course name.

Steps

  1. Build an endpoint that returns all courses that a user can join based on a search value, page number, and page size. The endpoint should return all of the information about a course that is found in MongoDB, except the admin_id and approved fields.
  2. The endpoint should implement pagination and fuzzy search. You may have to build a MongoDB Aggregation Pipeline.

Don't forget to:

  • Make sure to add the appropriate middleware for checking if the client requesting this endpoint can access the courses.
  • Write Jest Unit Tests!!! I would test a couple of the scenarios listed in the Example API Calls with our Mock Database.

Example API Calls

Let's suppose that the courses are:

  1. English
  2. Spanish
  3. French
  4. German
  5. Hindi

GET learner/search?search='' returns English, French, German, Hindi, Spanish
GET learner/search?page=1&size=2 returns English, French
GET learner/search?search=''&page=2&size=3 returns German, Hindi
GET learner/search?search='E' returns English

Notice how the page is 1-based and size courses aren't always returned.

Resources

@21xiaofanli 21xiaofanli self-assigned this Nov 14, 2022
@ashayp22 ashayp22 changed the title Search Courses Endpoint Search Courses Endpoint with Pagination and Fuzzy Search Nov 16, 2022
@ashayp22 ashayp22 added P2 and removed P0 labels Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants