feat:#26 added semester to fetched groups

This commit is contained in:
Elmar Kresse
2024-02-02 00:25:26 +01:00
parent 116a8dc37e
commit 25a7464e41
12 changed files with 5365 additions and 45 deletions

View File

@@ -307,6 +307,25 @@ func AddRoutes(app *pocketbase.PocketBase) {
return nil
})
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
_, err := e.Router.AddRoute(echo.Route{
Method: http.MethodGet,
Path: "/api/courses",
Handler: func(c echo.Context) error {
semester := c.QueryParam("semester")
courses := events.GetAllCoursesForSemester(app, semester)
return c.JSON(200, courses)
},
Middlewares: []echo.MiddlewareFunc{
apis.ActivityLogger(app),
},
})
if err != nil {
return err
}
return nil
})
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
_, err := e.Router.AddRoute(echo.Route{
Method: http.MethodDelete,