mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
Merge #3334
3334: Add specific error codes `immutable_...` r=irevoire a=loiclec Add the following error codes: When an immutable field of API key is sent to the `PATCH /keys` route: - `ImmutableApiKeyUid` - `ImmutableApiKeyKey` - `ImmutableApiKeyActions` - `ImmutableApiKeyIndexes` - `ImmutableApiKeyExpiresAt` - `ImmutableApiKeyCreatedAt` - `ImmutableApiKeyUpdatedAt` When an immutable field of Index is sent to the `PATCH /indexes/{uid}` route: - `ImmutableIndexUid` - `ImmutableIndexCreatedAt` - `ImmutableIndexUpdatedAt` Co-authored-by: Loïc Lecrenier <loic.lecrenier@me.com> Co-authored-by: Tamo <tamo@meilisearch.com>
This commit is contained in:
commit
a5c4fbbcea
5 changed files with 51 additions and 18 deletions
|
@ -181,7 +181,19 @@ DumpAlreadyProcessing , invalid , CONFLICT;
|
|||
DumpNotFound , invalid , NOT_FOUND;
|
||||
DumpProcessFailed , internal , INTERNAL_SERVER_ERROR;
|
||||
DuplicateIndexFound , invalid , BAD_REQUEST;
|
||||
ImmutableField , invalid , BAD_REQUEST;
|
||||
|
||||
ImmutableApiKeyUid , invalid , BAD_REQUEST;
|
||||
ImmutableApiKeyKey , invalid , BAD_REQUEST;
|
||||
ImmutableApiKeyActions , invalid , BAD_REQUEST;
|
||||
ImmutableApiKeyIndexes , invalid , BAD_REQUEST;
|
||||
ImmutableApiKeyExpiresAt , invalid , BAD_REQUEST;
|
||||
ImmutableApiKeyCreatedAt , invalid , BAD_REQUEST;
|
||||
ImmutableApiKeyUpdatedAt , invalid , BAD_REQUEST;
|
||||
|
||||
ImmutableIndexUid , invalid , BAD_REQUEST;
|
||||
ImmutableIndexCreatedAt , invalid , BAD_REQUEST;
|
||||
ImmutableIndexUpdatedAt , invalid , BAD_REQUEST;
|
||||
|
||||
IndexAlreadyExists , invalid , CONFLICT ;
|
||||
IndexCreationFailed , internal , INTERNAL_SERVER_ERROR;
|
||||
IndexNotFound , invalid , NOT_FOUND;
|
||||
|
|
|
@ -80,12 +80,12 @@ fn deny_immutable_fields_api_key(
|
|||
));
|
||||
|
||||
error.code = match field {
|
||||
"uid" => Code::ImmutableField,
|
||||
"actions" => Code::ImmutableField,
|
||||
"indexes" => Code::ImmutableField,
|
||||
"expiresAt" => Code::ImmutableField,
|
||||
"createdAt" => Code::ImmutableField,
|
||||
"updatedAt" => Code::ImmutableField,
|
||||
"uid" => Code::ImmutableApiKeyUid,
|
||||
"actions" => Code::ImmutableApiKeyActions,
|
||||
"indexes" => Code::ImmutableApiKeyIndexes,
|
||||
"expiresAt" => Code::ImmutableApiKeyExpiresAt,
|
||||
"createdAt" => Code::ImmutableApiKeyCreatedAt,
|
||||
"updatedAt" => Code::ImmutableApiKeyUpdatedAt,
|
||||
_ => Code::BadRequest,
|
||||
};
|
||||
error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue