Fix the /swap-indexes route API

1. payload
2. error messages
3. auth errors
This commit is contained in:
Loïc Lecrenier 2022-10-24 14:49:39 +02:00 committed by Tamo
parent b74e009084
commit 2b8b9e0418
6 changed files with 140 additions and 73 deletions

View file

@ -120,6 +120,8 @@ pub enum Code {
InvalidIndexUid,
InvalidMinWordLengthForTypo,
DuplicateIndexFound,
// invalid state error
InvalidState,
MissingPrimaryKey,
@ -294,6 +296,9 @@ impl Code {
InvalidMinWordLengthForTypo => {
ErrCode::invalid("invalid_min_word_length_for_typo", StatusCode::BAD_REQUEST)
}
DuplicateIndexFound => {
ErrCode::invalid("duplicate_index_found", StatusCode::BAD_REQUEST)
}
}
}

View file

@ -270,6 +270,7 @@ impl Action {
INDEXES_GET => Some(Self::IndexesGet),
INDEXES_UPDATE => Some(Self::IndexesUpdate),
INDEXES_DELETE => Some(Self::IndexesDelete),
INDEXES_SWAP => Some(Self::IndexesSwap),
TASKS_ALL => Some(Self::TasksAll),
TASKS_CANCEL => Some(Self::TasksCancel),
TASKS_DELETE => Some(Self::TasksDelete),