fix(analyticsApi): startdate is now query param
Build and Push Docker image / build-and-push (push) Successful in 2m9s
Details
Build and Push Docker image / build-and-push (push) Successful in 2m9s
Details
This commit is contained in:
parent
333443f271
commit
13d20a99e9
|
@ -23,23 +23,15 @@ import (
|
||||||
// "startDate": "start date in ISO 8601 format",
|
// "startDate": "start date in ISO 8601 format",
|
||||||
// }
|
// }
|
||||||
func initSessionCount(app *pocketbase.PocketBase, e *core.ServeEvent) {
|
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
|
// Check if user is in admin group
|
||||||
if err := ldapApi.UserIsInAdminGroup(app, c); err != nil {
|
if err := ldapApi.UserIsInAdminGroup(app, c); err != nil {
|
||||||
return err
|
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
|
// Parse the start date
|
||||||
startDate, err := time.Parse(time.RFC3339, data.StartDate)
|
startDate, err := time.Parse(time.RFC3339, c.QueryParam("startDate"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return apis.NewBadRequestError("Invalid start date format, expected ISO 8601", err)
|
return apis.NewBadRequestError("Invalid start date format, expected ISO 8601", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue