Overview
The controllers of professor aggregate endpoints rely on 2 functions:
professorCourse(flag string, c *gin.Context)
professorSection(flag string, c *gin.Context)
However, the business logic of these 2 functions are identical. Now that the function to dynamically produce Mongo pipeline has been written, we can combine both functions into one.
=> More abstraction, reusability
What to do
Add professorAggregate[T any](flag string, c *gin.Context that can handle the logic of both functions above.
Overview
The controllers of professor aggregate endpoints rely on 2 functions:
professorCourse(flag string, c *gin.Context)professorSection(flag string, c *gin.Context)However, the business logic of these 2 functions are identical. Now that the function to dynamically produce Mongo pipeline has been written, we can combine both functions into one.
=>More abstraction, reusabilityWhat to do
Add
professorAggregate[T any](flag string, c *gin.Contextthat can handle the logic of both functions above.