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

Add the section aggregate endpoints to the professor #242

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

mikehquan19
Copy link
Contributor

This pull request is for task #232. I added the section aggregate endpoints to the professor controllers. I also made the function getProfessorQuery(flag string, c *gin.Context) which gets the query of the professor depending on the flag that can be used for both professorCourse() and professorSection(). That way we can reduce redundancy in the code, though I think there's still lots of redundancy in my code.

Thank you.

@jpahm jpahm self-requested a review November 22, 2024 05:57
@jpahm
Copy link
Contributor

jpahm commented Nov 22, 2024

Awesome, thank you! Should be able to review this one much quicker than the last one :)

@jpahm
Copy link
Contributor

jpahm commented Feb 6, 2025

Holding onto this until the changes discussed in #241 are made.

@mikehquan19
Copy link
Contributor Author

mikehquan19 commented Feb 11, 2025

I've implemented pagination on both things of the endpoints. Now the aggregate endpoints will need 2 query params former_offset & latter_offset.

For example, /course/sections?former_offset=40&latter_offset=60 would mean course is skipped to the 40th and sections is skipped to the 60th, but the number of course & sections would both be limited to 20.

A few notes:

  • offset won't work in these endpoints but only the basic endpoints (/course or /professor).
  • If the user doesn't specify either former_offset or latter_offset, they would be defaulted to 0. It means that /course/sections would return the first 20 sections from the first 20 course.

@jpahm , I have a question. Since I've already got the code working for #243, but since they are really messy just as we discussed, would you rather I wait until you review and approve this PR and then make a new PR, or commit them directly to this PR?

@jpahm
Copy link
Contributor

jpahm commented Feb 11, 2025

Awesome, thank you! I'll review this in detail shortly. Regarding #243, feel free to either wait until I review this or move your commits for #243 to a different branch and make a PR from that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants