[#10] Move to new endpoint (room schedule for given duration)

This commit is contained in:
Tom Wahl
2023-10-28 13:21:23 +02:00
parent f9ef791d67
commit f09f952ca3
9 changed files with 1171 additions and 263 deletions

View File

@@ -93,11 +93,12 @@ func AddRoutes(app *pocketbase.PocketBase) {
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
_, err := e.Router.AddRoute(echo.Route{
Method: http.MethodGet,
Path: "/api/schedule/week",
Path: "/api/schedule",
Handler: func(c echo.Context) error {
roomParam := c.QueryParam("room")
week := c.QueryParam("week")
return room.GetRoomScheduleForWeek(c, app, roomParam, week)
to := c.QueryParam("to")
from := c.QueryParam("from")
return room.GetRoomSchedule(c, app, roomParam, from, to)
},
Middlewares: []echo.MiddlewareFunc{
apis.ActivityLogger(app),