Skip to content

Commit

Permalink
refactor: [torrust#39] userId extractor - update torrent info handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-nt committed Jan 29, 2024
1 parent acb8610 commit da04c2a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/web/api/v1/contexts/torrent/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,14 @@ async fn redirect_to_details_url_using_canonical_info_hash_if_needed(
#[allow(clippy::unused_async)]
pub async fn update_torrent_info_handler(
State(app_data): State<Arc<AppData>>,
Extract(maybe_bearer_token): Extract,
ExtractLoggedInUser(user_id): ExtractLoggedInUser,
Path(info_hash): Path<InfoHashParam>,
extract::Json(update_torrent_info_form): extract::Json<UpdateTorrentInfoForm>,
) -> Response {
let Ok(info_hash) = InfoHash::from_str(&info_hash.lowercase()) else {
return errors::Request::InvalidInfoHashParam.into_response();
};

let user_id = match app_data.auth.get_user_id_from_bearer_token(&maybe_bearer_token).await {
Ok(user_id) => user_id,
Err(error) => return error.into_response(),
};

match app_data
.torrent_service
.update_torrent_info(
Expand Down

0 comments on commit da04c2a

Please sign in to comment.