refactor(domain): move DB string conversions out of domain enums

This commit is contained in:
2026-05-15 01:54:32 +02:00
parent a123c0b8cc
commit 344bcf34af
11 changed files with 124 additions and 74 deletions

View File

@@ -57,11 +57,12 @@ pub async fn create_thought(
input: CreateThoughtInput,
) -> Result<CreateThoughtOutput, DomainError> {
let content = Content::new_local(input.content)?;
let visibility = input
.visibility
.as_deref()
.map(Visibility::from_db_str)
.unwrap_or(Visibility::Public);
let visibility = match input.visibility.as_deref() {
Some("followers") => Visibility::Followers,
Some("unlisted") => Visibility::Unlisted,
Some("direct") => Visibility::Direct,
_ => Visibility::Public,
};
let thought = Thought::new_local(
ThoughtId::new(),
input.user_id,