Add support for archiving lists and namespaces (#152)
Add query param to get all lists including archived ones Add query param to get all namespaces including archived ones Fix getting lists by namespace only not archived lists Fix misspell Fix lint Merge branch 'master' into feature/archive-lists-namespaces Add docs for error codes Fix archive error codes Don't let archived lists show up in general lists Fix updating description Fix updating lists with link shares More comments Fix un-archiving lists Move check for archiving a list to canWrite Check Add more tests Add more checks Add checks for namespaces and lists Add namespace edit Add tests Add migrations and filter Add basic tests Add is archived property to lists and namespaces Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/152
This commit is contained in:
@ -231,6 +231,29 @@ func (err ErrListIdentifierIsNotUnique) HTTPError() web.HTTPError {
|
||||
}
|
||||
}
|
||||
|
||||
// ErrListIsArchived represents an error, where a list is archived
|
||||
type ErrListIsArchived struct {
|
||||
ListID int64
|
||||
}
|
||||
|
||||
// IsErrListIsArchived checks if an error is a .
|
||||
func IsErrListIsArchived(err error) bool {
|
||||
_, ok := err.(ErrListIsArchived)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrListIsArchived) Error() string {
|
||||
return fmt.Sprintf("List is archived [ListID: %d]", err.ListID)
|
||||
}
|
||||
|
||||
// ErrCodeListIsArchived holds the unique world-error code of this error
|
||||
const ErrCodeListIsArchived = 3008
|
||||
|
||||
// HTTPError holds the http error description
|
||||
func (err ErrListIsArchived) HTTPError() web.HTTPError {
|
||||
return web.HTTPError{HTTPCode: http.StatusPreconditionFailed, Code: ErrCodeListIsArchived, Message: "This lists is archived. Editing or creating new tasks is not possible."}
|
||||
}
|
||||
|
||||
// ================
|
||||
// List task errors
|
||||
// ================
|
||||
@ -777,6 +800,29 @@ func (err ErrUserAlreadyHasNamespaceAccess) HTTPError() web.HTTPError {
|
||||
return web.HTTPError{HTTPCode: http.StatusConflict, Code: ErrCodeUserAlreadyHasNamespaceAccess, Message: "This user already has access to this namespace."}
|
||||
}
|
||||
|
||||
// ErrNamespaceIsArchived represents an error where a namespace is archived
|
||||
type ErrNamespaceIsArchived struct {
|
||||
NamespaceID int64
|
||||
}
|
||||
|
||||
// IsErrNamespaceIsArchived checks if an error is a .
|
||||
func IsErrNamespaceIsArchived(err error) bool {
|
||||
_, ok := err.(ErrNamespaceIsArchived)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrNamespaceIsArchived) Error() string {
|
||||
return fmt.Sprintf("Namespace is archived [NamespaceID: %d]", err.NamespaceID)
|
||||
}
|
||||
|
||||
// ErrCodeNamespaceIsArchived holds the unique world-error code of this error
|
||||
const ErrCodeNamespaceIsArchived = 5012
|
||||
|
||||
// HTTPError holds the http error description
|
||||
func (err ErrNamespaceIsArchived) HTTPError() web.HTTPError {
|
||||
return web.HTTPError{HTTPCode: http.StatusPreconditionFailed, Code: ErrCodeNamespaceIsArchived, Message: "This namespaces is archived. Editing or creating new lists is not possible."}
|
||||
}
|
||||
|
||||
// ============
|
||||
// Team errors
|
||||
// ============
|
||||
|
Reference in New Issue
Block a user