refactor(domain): move DB string conversions out of domain enums
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user