mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2025-08-07 12:19:17 +02:00
fixed schedule and update process
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"htwkalender/service/fetch"
|
||||
"htwkalender/service/ical"
|
||||
"htwkalender/service/room"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
@@ -71,6 +72,7 @@ func AddRoutes(app *pocketbase.PocketBase) {
|
||||
return nil
|
||||
})
|
||||
|
||||
// API Endpoint to get all events for a specific room on a specific day
|
||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||
_, err := e.Router.AddRoute(echo.Route{
|
||||
Method: http.MethodGet,
|
||||
@@ -90,12 +92,19 @@ func AddRoutes(app *pocketbase.PocketBase) {
|
||||
return nil
|
||||
})
|
||||
|
||||
// API Endpoint to create a new iCal feed
|
||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||
_, err := e.Router.AddRoute(echo.Route{
|
||||
Method: http.MethodPost,
|
||||
Path: "/api/createFeed",
|
||||
Handler: func(c echo.Context) error {
|
||||
return ical.CreateIndividualFeed(c, app)
|
||||
requestBody, _ := io.ReadAll(c.Request().Body)
|
||||
result, err := ical.CreateIndividualFeed(requestBody, app)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, err)
|
||||
}
|
||||
return c.JSON(http.StatusOK, result)
|
||||
|
||||
},
|
||||
Middlewares: []echo.MiddlewareFunc{
|
||||
apis.ActivityLogger(app),
|
||||
|
Reference in New Issue
Block a user