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 8628acfb77 - Show all commits

View File

@@ -38,11 +38,15 @@ pub async fn register(
.save(&user) .save(&user)
.await .await
.map_err(|e| match e { .map_err(|e| match e {
DomainError::Conflict(c) => match c.as_str() { DomainError::UniqueViolation { field: "username" } => {
"users_username_key" => DomainError::Conflict("username taken".into()), DomainError::Conflict("username taken".into())
"users_email_key" => DomainError::Conflict("email taken".into()), }
_ => DomainError::Conflict("already exists".into()), DomainError::UniqueViolation { field: "email" } => {
}, DomainError::Conflict("email taken".into())
}
DomainError::UniqueViolation { .. } => {
DomainError::Conflict("already exists".into())
}
other => other, other => other,
})?; })?;
events events
@@ -136,7 +140,7 @@ mod tests {
#[async_trait] #[async_trait]
impl UserWriter for ConflictOnSaveStore { impl UserWriter for ConflictOnSaveStore {
async fn save(&self, _user: &User) -> Result<(), DomainError> { async fn save(&self, _user: &User) -> Result<(), DomainError> {
Err(DomainError::Conflict("users_username_key".into())) Err(DomainError::UniqueViolation { field: "username" })
} }
async fn update_profile( async fn update_profile(
&self, &self,
@@ -178,7 +182,7 @@ mod tests {
#[async_trait] #[async_trait]
impl UserWriter for EmailConflictOnSaveStore { impl UserWriter for EmailConflictOnSaveStore {
async fn save(&self, _user: &User) -> Result<(), DomainError> { async fn save(&self, _user: &User) -> Result<(), DomainError> {
Err(DomainError::Conflict("users_email_key".into())) Err(DomainError::UniqueViolation { field: "email" })
} }
async fn update_profile( async fn update_profile(
&self, &self,