feat:#97 added post response and remove notification if event start in past

This commit is contained in:
masterElmar
2023-12-05 11:11:34 +01:00
parent fbaff30f09
commit b25c7a770d
2 changed files with 21 additions and 1 deletions

View File

@@ -194,6 +194,24 @@ func AddRoutes(app *pocketbase.PocketBase) {
return nil
})
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
_, err := e.Router.AddRoute(echo.Route{
Method: http.MethodPut,
Path: "/api/feed",
Handler: func(c echo.Context) error {
token := c.QueryParam("token")
return c.JSON(http.StatusOK, "token: "+token)
},
Middlewares: []echo.MiddlewareFunc{
apis.ActivityLogger(app),
},
})
if err != nil {
return err
}
return nil
})
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
_, err := e.Router.AddRoute(echo.Route{
Method: http.MethodGet,

View File

@@ -99,7 +99,9 @@ func (icalModel IcalModel) daylight(tz *goics.Component) {
// if reminder is specified in the configuration for this event, an alarm will be added to the event
func addAlarmIfSpecified(s *goics.Component, event model.Event, mapping model.FeedCollection) {
if mapping.Reminder {
// if event.Start > now
// then add alarm
if event.Start.Time().Local().After(time.Now().Local()) && mapping.Reminder {
a := goics.NewComponent()
a.SetType("VALARM")
a.AddProperty("TRIGGER", "-P0DT0H15M0S")