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

Box the repository everywhere

This commit is contained in:
Quentin Gliech
2023-01-20 17:49:16 +01:00
parent f4c64c2171
commit a9facab131
49 changed files with 296 additions and 296 deletions

View File

@@ -25,7 +25,7 @@ use mas_email::Mailer;
use mas_keystore::{Encrypter, Keystore};
use mas_policy::PolicyFactory;
use mas_router::UrlBuilder;
use mas_storage::{BoxClock, BoxRng, SystemClock};
use mas_storage::{BoxClock, BoxRepository, BoxRng, Repository, SystemClock};
use mas_storage_pg::PgRepository;
use mas_templates::Templates;
use rand::SeedableRng;
@@ -156,7 +156,7 @@ impl IntoResponse for RepositoryError {
}
#[async_trait]
impl FromRequestParts<AppState> for PgRepository {
impl FromRequestParts<AppState> for BoxRepository {
type Rejection = RepositoryError;
async fn from_request_parts(
@@ -164,6 +164,8 @@ impl FromRequestParts<AppState> for PgRepository {
state: &AppState,
) -> Result<Self, Self::Rejection> {
let repo = PgRepository::from_pool(&state.pool).await?;
Ok(repo)
Ok(repo
.map_err(mas_storage::RepositoryError::from_error)
.boxed())
}
}