feat: Chat request implementation #14
2 changed files with 3 additions and 3 deletions
|
@ -53,7 +53,7 @@ impl UserTableExt for DatabaseConnection {
|
|||
.await
|
||||
{
|
||||
if let Some(SqlErr::UniqueConstraintViolation(_)) = err.sql_err() {
|
||||
return Err(ApiError::DuplicatedUser);
|
||||
return Err(ApiError::AlreadyRegistered);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ pub enum ApiError {
|
|||
RegistrationClosed,
|
||||
/// The entered public key is already registered (400 Bad Request)
|
||||
#[error("The entered public key is already registered")]
|
||||
DuplicatedUser,
|
||||
AlreadyRegistered,
|
||||
/// The user entered two different public keys
|
||||
/// one in the header and other in the request body
|
||||
/// (400 Bad Request)
|
||||
|
@ -62,7 +62,7 @@ impl ApiError {
|
|||
match self {
|
||||
Self::SeaOrm(_) => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
Self::RegistrationClosed => StatusCode::FORBIDDEN,
|
||||
Self::DuplicatedUser | Self::TwoDifferentKeys => StatusCode::BAD_REQUEST,
|
||||
Self::AlreadyRegistered | Self::TwoDifferentKeys => StatusCode::BAD_REQUEST,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue