-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add courses aggregate endpoint to professor endpoint #234
base: develop
Are you sure you want to change the base?
Conversation
I also completed task #227 and added the section aggregate endpoint to the course endpoint in this pull request. Thank you. |
I will review this shortly, thanks much! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the wait on this review, overall this looks very good!
My only concern is that we should probably have pagination for the query-based endpoints (like the standard query endpoints) using the same limit and offset system. As of right now, there's nothing stopping the user from running a raw query like /course/section
and essentially just pulling all of the sections in the database.
Also, as a small change, it would be nice it we could change the routes to use the words sections
and courses
instead of section
and course
to make it abundantly clear to the user that these endpoints return a collection of sections and courses, respectively.
Thank you!
Got it! I will fix it ASAP. |
Hi @jpahm, I have 2 questions regarding the limit and offset system. I played around with the API a little bit, and here's what I learned. For example, if I call For aggregate endpoints, i.e |
You are correct! Also, as far as pagination is concerned, I think it would be best to paginate the professors before you pull their courses so as to allow for getting all of a professor's courses at a time without needing to pull all professors at once. We will need to make sure this functionality is clearly documented so as to not cause confusion for our users, though. Also, after doing some further testing, there is unfortunately a problem with the current implementation: |
That's great. Let me rephrase to make sure I understand it. We paginate the professors so that when we call the endpoint we will only get all the courses of 20 professors at the time, and then we can call the endpoint again with As for the problem in aggregation, I caught it too. Fortunately, the solution is easy as I just need to set |
You understand correctly! Glad to hear the problem was easy to fix. |
I've fixed the pagination and renamed the endpoints. Luckily enough, mongo pipeline has Thank you! |
Hi!
I've added the course endpoints in the professor's routes that return the array of courses taught by the queried professors (or single professor). I basically just filter the professors first and then, through several stages of the aggregation pipelines, sort of efficiently obtain the list of distinct courses by those professors.
Let me know ASAP if there's anything I need to fix.
Thank you.