fix:#16 added delete option and fixed uuid generation

This commit is contained in:
Elmar Kresse
2023-10-25 19:51:25 +02:00
parent 403e73cace
commit caa9415422
5 changed files with 107 additions and 4 deletions

View File

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