Skip to content

Commit

Permalink
refactor: The borrowed expression implements the required traits
Browse files Browse the repository at this point in the history
  • Loading branch information
bush1D3v committed Jul 28, 2024
1 parent e0fedae commit 7308938
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/modules/user/user_controllers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ async fn login_user_response_constructor(
string_user: &str,
email: &str,
) -> HttpResponse<BoxBody> {
let _ = Redis::set(&redis_pool, &service_resp.user.id, &string_user).await;
let _ = Redis::set(&redis_pool, email, string_user).await;
let _ = Redis::set(redis_pool, &service_resp.user.id, string_user).await;
let _ = Redis::set(redis_pool, email, string_user).await;
HttpResponse::Ok().json(LoginUserControllerResponse {
access_token: service_resp.access_token,
access_expires_in: service_resp.access_expires_in,
Expand Down
6 changes: 3 additions & 3 deletions src/modules/user/user_queues.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ async fn put_user_queue(pool: Pool, queue: Arc<PutUserAppQueue>) -> Result<(), H
let mut sql_builder = sql_builder::SqlBuilder::update_table("users");

sql_builder.set("password", &quote(&user.new_password));
sql_builder.set("email", &quote(user.new_email.clone()));
sql_builder.set("updated_at", &quote(updated_at));
sql_builder.or_where_eq("id", &quote(&user_id));
sql_builder.set("email", &quote(&user.new_email));
sql_builder.set("updated_at", &quote(&updated_at));
sql_builder.or_where_eq("id", &quote(user_id));

let mut this_sql = match sql_builder.sql() {
Ok(x) => x,
Expand Down
13 changes: 6 additions & 7 deletions src/modules/user/user_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,17 @@ pub async fn delete_user_service(
user_id: String,
string_user: Option<String>,
) -> Result<String, HttpResponse> {
let db_user: UserDTO;
if string_user == None {
db_user = match detail_user_repository(pg_pool.clone(), user_id.clone()).await {
let db_user: UserDTO = if string_user.is_none() {
match detail_user_repository(pg_pool.clone(), user_id.clone()).await {
Ok(user_dto) => user_dto,
Err(e) => return Err(e),
};
}
} else {
db_user = match UserSerdes::serde_string_to_json(&string_user.unwrap()) {
match UserSerdes::serde_string_to_json(&string_user.unwrap()) {
Ok(user_dto) => user_dto,
Err(e) => return Err(e),
};
}
}
};

match password_verifier(
pg_pool,
Expand Down

0 comments on commit 7308938

Please sign in to comment.