mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
Return an error when calling DELETE /tasks with an empty query
This commit is contained in:
parent
9067148270
commit
dabc30d3d6
4 changed files with 28 additions and 1 deletions
|
@ -56,6 +56,21 @@ impl Default for Query {
|
|||
}
|
||||
|
||||
impl Query {
|
||||
/// Return `true` iff every field of the query is set to `None`, such that the query
|
||||
/// would match all tasks.
|
||||
pub fn is_empty(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
Query {
|
||||
limit: None,
|
||||
from: None,
|
||||
status: None,
|
||||
kind: None,
|
||||
index_uid: None,
|
||||
uid: None
|
||||
}
|
||||
)
|
||||
}
|
||||
pub fn with_status(self, status: Status) -> Self {
|
||||
let mut status_vec = self.status.unwrap_or_default();
|
||||
status_vec.push(status);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue