diff --git a/sync/service/postgres.go b/sync/service/postgres.go index f64dbc3..f5eed03 100644 --- a/sync/service/postgres.go +++ b/sync/service/postgres.go @@ -150,6 +150,11 @@ func (p *Postgres) RecursNext(id string, date time.Time) error { return ErrNotARecurrer } + // Verify that the new date is actually a valid recurrence + if !recurrer.On(date) { + return fmt.Errorf("%w: date %v is not a valid recurrence", ErrPostgresFailure, date) + } + _, err = p.db.Exec(` UPDATE items SET recur_next = $1