fix(domain): from_db_str returns Result — unknown DB values are errors not silent defaults

This commit is contained in:
2026-05-15 13:57:38 +02:00
parent 5a64dd361c
commit f697267828
7 changed files with 75 additions and 39 deletions

View File

@@ -76,13 +76,18 @@ impl FollowRepository for PgFollowRepository {
.fetch_optional(&self.pool)
.await
.into_domain()
.map(|o| o.map(|r| Follow {
follower_id: UserId::from_uuid(r.follower_id),
following_id: UserId::from_uuid(r.following_id),
state: FollowState::from_db_str(&r.state),
ap_id: r.ap_id,
created_at: r.created_at,
}))
.and_then(|o| {
o.map(|r| {
Ok(Follow {
follower_id: UserId::from_uuid(r.follower_id),
following_id: UserId::from_uuid(r.following_id),
state: FollowState::from_db_str(&r.state)?,
ap_id: r.ap_id,
created_at: r.created_at,
})
})
.transpose()
})
}
async fn update_state(