feat: v2 rewrite — hexagonal arch, ActivityPub federation, NATS, deployment-ready #1

Merged
GKaszewski merged 334 commits from v2 into master 2026-05-16 09:42:43 +00:00
Showing only changes of commit 1ab3766ce8 - Show all commits

View File

@@ -166,7 +166,18 @@ impl UserWriter for PgUserRepository {
.bind(user.updated_at) .bind(user.updated_at)
.execute(&self.pool) .execute(&self.pool)
.await .await
.into_domain() .map_err(|e| {
if let sqlx::Error::Database(ref db) = e {
if db.code().as_deref() == Some("23505") {
return match db.constraint().unwrap_or("") {
"users_username_key" => DomainError::UniqueViolation { field: "username" },
"users_email_key" => DomainError::UniqueViolation { field: "email" },
_ => DomainError::UniqueViolation { field: "unknown" },
};
}
}
DomainError::Internal(e.to_string())
})
.map(|_| ()) .map(|_| ())
} }