style: rustfmt
This commit is contained in:
@@ -3,8 +3,8 @@ use domain::{
|
||||
DomainError, Song, SongRepositoryPort, SongSummary, SortField, SortOrder, StoredSong,
|
||||
song_preview_chords,
|
||||
};
|
||||
use std::str::FromStr;
|
||||
use sqlx::SqlitePool;
|
||||
use std::str::FromStr;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::row::{SongRow, row_to_summary, sort_clause};
|
||||
@@ -16,8 +16,8 @@ pub struct SqliteSongRepository {
|
||||
|
||||
impl SqliteSongRepository {
|
||||
pub async fn new(database_url: &str) -> Result<Self, sqlx::Error> {
|
||||
let opts = sqlx::sqlite::SqliteConnectOptions::from_str(database_url)?
|
||||
.create_if_missing(true);
|
||||
let opts =
|
||||
sqlx::sqlite::SqliteConnectOptions::from_str(database_url)?.create_if_missing(true);
|
||||
let pool = SqlitePool::connect_with(opts).await?;
|
||||
sqlx::migrate!("./migrations").run(&pool).await?;
|
||||
Ok(Self { pool })
|
||||
|
||||
@@ -17,11 +17,7 @@ pub struct LoginResult {
|
||||
pub async fn execute(deps: &LoginDeps, cmd: LoginCommand) -> Result<LoginResult, DomainError> {
|
||||
let email = Email::new(&cmd.email)?;
|
||||
|
||||
let user = deps
|
||||
.user_repo
|
||||
.find_by_email(&email)
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
let user = deps.user_repo.find_by_email(&email).await?.ok_or_else(|| {
|
||||
tracing::warn!(email = cmd.email, "login attempt with unknown email");
|
||||
DomainError::Unauthorized("invalid credentials".into())
|
||||
})?;
|
||||
|
||||
@@ -8,9 +8,7 @@ use super::deps::RegisterDeps;
|
||||
pub async fn execute(deps: &RegisterDeps, cmd: RegisterCommand) -> Result<(), DomainError> {
|
||||
if !deps.allow_registration {
|
||||
tracing::warn!("registration attempt while disabled");
|
||||
return Err(DomainError::Unauthorized(
|
||||
"registration is disabled".into(),
|
||||
));
|
||||
return Err(DomainError::Unauthorized("registration is disabled".into()));
|
||||
}
|
||||
|
||||
let password = Password::new(&cmd.password)?;
|
||||
|
||||
Reference in New Issue
Block a user