Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controllers/krate/search: Derive Deref for FilterParams #10225

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/controllers/krate/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use axum::extract::FromRequestParts;
use axum_extra::extract::Query;
use axum_extra::json;
use axum_extra::response::ErasedJson;
use derive_more::Deref;
use diesel::dsl::{exists, sql, InnerJoinQuerySource, LeftJoinQuerySource};
use diesel::prelude::*;
use diesel::sql_types::{Bool, Text};
use diesel_async::{AsyncPgConnection, RunQueryDsl};
use diesel_full_text_search::*;
use http::request::Parts;
use std::ops::Deref;
use tracing::Instrument;
use utoipa::IntoParams;

Expand Down Expand Up @@ -317,19 +317,13 @@ impl ListQueryParams {
}
}

#[derive(Deref)]
struct FilterParams {
#[deref]
search_params: ListQueryParams,
auth_user_id: Option<i32>,
}

impl Deref for FilterParams {
type Target = ListQueryParams;

fn deref(&self) -> &Self::Target {
&self.search_params
}
}

impl FilterParams {
async fn from(
search_params: ListQueryParams,
Expand Down