mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 08:41:00 +00:00
Use more precise error codes/message for the task routes
+ Allow star operator in delete/cancel tasks + rename originalQuery to originalFilters + Display error/canceled_by in task view even when they are = null + Rename task filter fields by using their plural forms + Prepare an error code for canceledBy filter + Only return global tasks if the API key action `index.*` is there
This commit is contained in:
@ -147,7 +147,11 @@ pub enum Code {
|
||||
MissingMasterKey,
|
||||
NoSpaceLeftOnDevice,
|
||||
DumpNotFound,
|
||||
InvalidTaskUid,
|
||||
InvalidTaskDate,
|
||||
InvalidTaskStatuses,
|
||||
InvalidTaskTypes,
|
||||
InvalidTaskCanceledBy,
|
||||
InvalidTaskUids,
|
||||
TaskNotFound,
|
||||
TaskDeletionWithEmptyQuery,
|
||||
TaskCancelationWithEmptyQuery,
|
||||
@ -239,7 +243,21 @@ impl Code {
|
||||
MissingMasterKey => {
|
||||
ErrCode::authentication("missing_master_key", StatusCode::UNAUTHORIZED)
|
||||
}
|
||||
InvalidTaskUid => ErrCode::invalid("invalid_task_uid", StatusCode::BAD_REQUEST),
|
||||
InvalidTaskDate => {
|
||||
ErrCode::invalid("invalid_task_date_filter", StatusCode::BAD_REQUEST)
|
||||
}
|
||||
InvalidTaskUids => {
|
||||
ErrCode::invalid("invalid_task_uids_filter", StatusCode::BAD_REQUEST)
|
||||
}
|
||||
InvalidTaskStatuses => {
|
||||
ErrCode::invalid("invalid_task_statuses_filter", StatusCode::BAD_REQUEST)
|
||||
}
|
||||
InvalidTaskTypes => {
|
||||
ErrCode::invalid("invalid_task_types_filter", StatusCode::BAD_REQUEST)
|
||||
}
|
||||
InvalidTaskCanceledBy => {
|
||||
ErrCode::invalid("invalid_task_canceled_by_filter", StatusCode::BAD_REQUEST)
|
||||
}
|
||||
TaskNotFound => ErrCode::invalid("task_not_found", StatusCode::NOT_FOUND),
|
||||
TaskDeletionWithEmptyQuery => {
|
||||
ErrCode::invalid("missing_task_filters", StatusCode::BAD_REQUEST)
|
||||
|
@ -398,7 +398,23 @@ impl Kind {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Kind {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Kind::DocumentAdditionOrUpdate => write!(f, "documentAdditionOrUpdate"),
|
||||
Kind::DocumentDeletion => write!(f, "documentDeletion"),
|
||||
Kind::SettingsUpdate => write!(f, "settingsUpdate"),
|
||||
Kind::IndexCreation => write!(f, "indexCreation"),
|
||||
Kind::IndexDeletion => write!(f, "indexDeletion"),
|
||||
Kind::IndexUpdate => write!(f, "indexUpdate"),
|
||||
Kind::IndexSwap => write!(f, "indexSwap"),
|
||||
Kind::TaskCancelation => write!(f, "taskCancelation"),
|
||||
Kind::TaskDeletion => write!(f, "taskDeletion"),
|
||||
Kind::DumpCreation => write!(f, "dumpCreation"),
|
||||
Kind::SnapshotCreation => write!(f, "snapshotCreation"),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl FromStr for Kind {
|
||||
type Err = ResponseError;
|
||||
|
||||
|
Reference in New Issue
Block a user