fmt
Some checks failed
lint / lint (push) Failing after 5m3s
test / integration (push) Has been cancelled
test / unit (push) Has been cancelled

This commit is contained in:
2026-05-17 12:04:51 +02:00
parent 31e0f2958c
commit 4ec0725ff8
46 changed files with 1003 additions and 810 deletions

View File

@@ -34,21 +34,16 @@ pub async fn register(
}
let hash = hasher.hash(&input.password).await?;
let user = User::new_local(UserId::new(), username, email, hash);
users
.save(&user)
.await
.map_err(|e| match e {
DomainError::UniqueViolation { field: "username" } => {
DomainError::Conflict("username taken".into())
}
DomainError::UniqueViolation { field: "email" } => {
DomainError::Conflict("email taken".into())
}
DomainError::UniqueViolation { .. } => {
DomainError::Conflict("already exists".into())
}
other => other,
})?;
users.save(&user).await.map_err(|e| match e {
DomainError::UniqueViolation { field: "username" } => {
DomainError::Conflict("username taken".into())
}
DomainError::UniqueViolation { field: "email" } => {
DomainError::Conflict("email taken".into())
}
DomainError::UniqueViolation { .. } => DomainError::Conflict("already exists".into()),
other => other,
})?;
events
.publish(&DomainEvent::UserRegistered {
user_id: user.id.clone(),