feat: Add relative Reminders (#1427)
Partially resolves #1416 Co-authored-by: ce72 <christoph.ernst72@googlemail.com> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/1427 Reviewed-by: konrad <k@knt.li> Co-authored-by: cernst <ce72@noreply.kolaente.de> Co-committed-by: cernst <ce72@noreply.kolaente.de>
This commit is contained in:
@ -875,6 +875,33 @@ func (err ErrUserAlreadyAssigned) HTTPError() web.HTTPError {
|
||||
}
|
||||
}
|
||||
|
||||
// ErrReminderRelativeToMissing represents an error where a task has a relative reminder without reference date
|
||||
type ErrReminderRelativeToMissing struct {
|
||||
TaskID int64
|
||||
}
|
||||
|
||||
// IsErrReminderRelativeToMissing checks if an error is ErrReminderRelativeToMissing.
|
||||
func IsErrReminderRelativeToMissing(err error) bool {
|
||||
_, ok := err.(ErrReminderRelativeToMissing)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrReminderRelativeToMissing) Error() string {
|
||||
return fmt.Sprintf("Task [TaskID: %v] has a relative reminder without relative_to", err.TaskID)
|
||||
}
|
||||
|
||||
// ErrCodeRelationDoesNotExist holds the unique world-error code of this error
|
||||
const ErrCodeReminderRelativeToMissing = 4022
|
||||
|
||||
// HTTPError holds the http error description
|
||||
func (err ErrReminderRelativeToMissing) HTTPError() web.HTTPError {
|
||||
return web.HTTPError{
|
||||
HTTPCode: http.StatusBadRequest,
|
||||
Code: ErrCodeReminderRelativeToMissing,
|
||||
Message: "Please provide what the reminder date is relative to",
|
||||
}
|
||||
}
|
||||
|
||||
// =================
|
||||
// Namespace errors
|
||||
// =================
|
||||
|
Reference in New Issue
Block a user