1
0

feat(views): add crud handlers and routes for views

This commit is contained in:
kolaente
2024-03-13 23:48:34 +01:00
parent 6bdb33fb46
commit b39c5580c2
5 changed files with 261 additions and 12 deletions

View File

@ -412,6 +412,33 @@ func (err *ErrCannotArchiveDefaultProject) HTTPError() web.HTTPError {
}
}
// ErrProjectViewDoesNotExist represents an error where the default project is being deleted
type ErrProjectViewDoesNotExist struct {
ProjectViewID int64
}
// IsErrProjectViewDoesNotExist checks if an error is a project is archived error.
func IsErrProjectViewDoesNotExist(err error) bool {
_, ok := err.(*ErrProjectViewDoesNotExist)
return ok
}
func (err *ErrProjectViewDoesNotExist) Error() string {
return fmt.Sprintf("Project view does not exist [ProjectViewID: %d]", err.ProjectViewID)
}
// ErrCodeProjectViewDoesNotExist holds the unique world-error code of this error
const ErrCodeProjectViewDoesNotExist = 3014
// HTTPError holds the http error description
func (err *ErrProjectViewDoesNotExist) HTTPError() web.HTTPError {
return web.HTTPError{
HTTPCode: http.StatusNotFound,
Code: ErrCodeProjectViewDoesNotExist,
Message: "This project view does not exist.",
}
}
// ==============
// Task errors
// ==============