Task Comments (#138)
Add swagger docs Add integration tests Add tests Add task comment test fixtures Add config option to enable/disable task comments Add custom error if a task comment does not exist Fix lint Add getting author when getting a single comment Fix getting comments/comments author Add rights check to ReadAll + actually get the comment author Add migration and table definitions Add routes Add ReadOne method Add basic crud rights Signed-off-by: kolaente <k@knt.li> Implement basic crudable functions for task comments Signed-off-by: kolaente <k@knt.li> Start adding task comments Signed-off-by: kolaente <k@knt.li> Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/138
This commit is contained in:
@ -276,7 +276,7 @@ const ErrCodeTaskDoesNotExist = 4002
|
||||
|
||||
// HTTPError holds the http error description
|
||||
func (err ErrTaskDoesNotExist) HTTPError() web.HTTPError {
|
||||
return web.HTTPError{HTTPCode: http.StatusNotFound, Code: ErrCodeTaskDoesNotExist, Message: "This list task does not exist"}
|
||||
return web.HTTPError{HTTPCode: http.StatusNotFound, Code: ErrCodeTaskDoesNotExist, Message: "This task does not exist"}
|
||||
}
|
||||
|
||||
// ErrBulkTasksMustBeInSameList represents a "ErrBulkTasksMustBeInSameList" kind of error.
|
||||
@ -602,6 +602,34 @@ func (err ErrInvalidSortOrder) HTTPError() web.HTTPError {
|
||||
}
|
||||
}
|
||||
|
||||
// ErrTaskCommentDoesNotExist represents an error where a task comment does not exist
|
||||
type ErrTaskCommentDoesNotExist struct {
|
||||
ID int64
|
||||
TaskID int64
|
||||
}
|
||||
|
||||
// IsErrTaskCommentDoesNotExist checks if an error is ErrTaskCommentDoesNotExist.
|
||||
func IsErrTaskCommentDoesNotExist(err error) bool {
|
||||
_, ok := err.(ErrTaskCommentDoesNotExist)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrTaskCommentDoesNotExist) Error() string {
|
||||
return fmt.Sprintf("Task comment does not exist [ID: %d, TaskID: %d]", err.ID, err.TaskID)
|
||||
}
|
||||
|
||||
// ErrCodeTaskCommentDoesNotExist holds the unique world-error code of this error
|
||||
const ErrCodeTaskCommentDoesNotExist = 4015
|
||||
|
||||
// HTTPError holds the http error description
|
||||
func (err ErrTaskCommentDoesNotExist) HTTPError() web.HTTPError {
|
||||
return web.HTTPError{
|
||||
HTTPCode: http.StatusNotFound,
|
||||
Code: ErrCodeTaskCommentDoesNotExist,
|
||||
Message: "This task comment does not exist",
|
||||
}
|
||||
}
|
||||
|
||||
// =================
|
||||
// Namespace errors
|
||||
// =================
|
||||
|
Reference in New Issue
Block a user