1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-11-20 12:02:22 +03:00

handlers: extract the PgRepository from the request

Also fix a bunch of clippy errors & doctests
This commit is contained in:
Quentin Gliech
2023-01-18 18:21:45 +01:00
parent 9005931e2a
commit 876bc9fcb3
29 changed files with 79 additions and 142 deletions

View File

@@ -35,7 +35,6 @@ use mas_storage::{
use mas_storage_pg::PgRepository;
use oauth2_types::errors::ClientErrorCode;
use serde::Deserialize;
use sqlx::PgPool;
use thiserror::Error;
use ulid::Ulid;
@@ -124,7 +123,7 @@ pub(crate) async fn get(
mut rng: BoxRng,
clock: BoxClock,
State(http_client_factory): State<HttpClientFactory>,
State(pool): State<PgPool>,
mut repo: PgRepository,
State(url_builder): State<UrlBuilder>,
State(encrypter): State<Encrypter>,
State(keystore): State<Keystore>,
@@ -132,8 +131,6 @@ pub(crate) async fn get(
Path(provider_id): Path<Ulid>,
Query(params): Query<QueryParams>,
) -> Result<impl IntoResponse, RouteError> {
let mut repo = PgRepository::from_pool(&pool).await?;
let provider = repo
.upstream_oauth_provider()
.lookup(provider_id)