style: cargo fmt --all
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
pub mod db;
|
||||
pub mod user_repository;
|
||||
|
||||
pub use db::{connect, run_migrations, PgPool};
|
||||
pub use db::{PgPool, connect, run_migrations};
|
||||
pub use user_repository::PostgresUserRepository;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use crate::db::PgPool;
|
||||
use async_trait::async_trait;
|
||||
use domain::{
|
||||
entities::User,
|
||||
@@ -5,14 +6,15 @@ use domain::{
|
||||
ports::UserRepository,
|
||||
value_objects::{Email, PasswordHash, SystemId},
|
||||
};
|
||||
use crate::db::PgPool;
|
||||
|
||||
pub struct PostgresUserRepository {
|
||||
pool: PgPool,
|
||||
}
|
||||
|
||||
impl PostgresUserRepository {
|
||||
pub fn new(pool: PgPool) -> Self { Self { pool } }
|
||||
pub fn new(pool: PgPool) -> Self {
|
||||
Self { pool }
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@@ -26,12 +28,14 @@ impl UserRepository for PostgresUserRepository {
|
||||
.await
|
||||
.map_err(|e| DomainError::Internal(e.to_string()))?;
|
||||
|
||||
row.map(|r| Ok(User {
|
||||
id: SystemId::from_uuid(r.id),
|
||||
email: Email::new(r.email)?,
|
||||
password_hash: PasswordHash::from_hash(r.password_hash),
|
||||
created_at: r.created_at,
|
||||
}))
|
||||
row.map(|r| {
|
||||
Ok(User {
|
||||
id: SystemId::from_uuid(r.id),
|
||||
email: Email::new(r.email)?,
|
||||
password_hash: PasswordHash::from_hash(r.password_hash),
|
||||
created_at: r.created_at,
|
||||
})
|
||||
})
|
||||
.transpose()
|
||||
}
|
||||
|
||||
@@ -44,12 +48,14 @@ impl UserRepository for PostgresUserRepository {
|
||||
.await
|
||||
.map_err(|e| DomainError::Internal(e.to_string()))?;
|
||||
|
||||
row.map(|r| Ok(User {
|
||||
id: SystemId::from_uuid(r.id),
|
||||
email: Email::new(r.email)?,
|
||||
password_hash: PasswordHash::from_hash(r.password_hash),
|
||||
created_at: r.created_at,
|
||||
}))
|
||||
row.map(|r| {
|
||||
Ok(User {
|
||||
id: SystemId::from_uuid(r.id),
|
||||
email: Email::new(r.email)?,
|
||||
password_hash: PasswordHash::from_hash(r.password_hash),
|
||||
created_at: r.created_at,
|
||||
})
|
||||
})
|
||||
.transpose()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user