diff --git a/analyticsApi/main.go b/analyticsApi/main.go index 012bb62..8b077fc 100644 --- a/analyticsApi/main.go +++ b/analyticsApi/main.go @@ -23,23 +23,15 @@ import ( // "startDate": "start date in ISO 8601 format", // } func initSessionCount(app *pocketbase.PocketBase, e *core.ServeEvent) { - e.Router.GET("/api/analytics/sessionCounts", func(c echo.Context) error { + e.Router.GET("/api/analytics/count", func(c echo.Context) error { // Check if user is in admin group if err := ldapApi.UserIsInAdminGroup(app, c); err != nil { return err } - // Get data from request - data := struct { - StartDate string `json:"startDate"` - }{} - if err := c.Bind(&data); err != nil { - return apis.NewBadRequestError("Failed to read request data", err) - } - // Parse the start date - startDate, err := time.Parse(time.RFC3339, data.StartDate) + startDate, err := time.Parse(time.RFC3339, c.QueryParam("startDate")) if err != nil { return apis.NewBadRequestError("Invalid start date format, expected ISO 8601", err) }