refactor(domain): move DB string conversions out of domain enums
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
use async_trait::async_trait;
|
||||
use chrono::{DateTime, Utc};
|
||||
use domain::models::thought::Visibility;
|
||||
|
||||
fn visibility_from_str(s: &str) -> domain::models::thought::Visibility {
|
||||
use domain::models::thought::Visibility;
|
||||
match s {
|
||||
"followers" => Visibility::Followers,
|
||||
"unlisted" => Visibility::Unlisted,
|
||||
"direct" => Visibility::Direct,
|
||||
_ => Visibility::Public,
|
||||
}
|
||||
}
|
||||
|
||||
use domain::{
|
||||
errors::DomainError,
|
||||
models::{
|
||||
@@ -95,7 +105,7 @@ fn row_to_entry(r: FeedRow) -> FeedEntry {
|
||||
in_reply_to_id: r.in_reply_to_id.map(ThoughtId::from_uuid),
|
||||
in_reply_to_url: r.in_reply_to_url,
|
||||
ap_id: r.t_ap_id,
|
||||
visibility: Visibility::from_db_str(&r.visibility),
|
||||
visibility: visibility_from_str(&r.visibility),
|
||||
content_warning: r.content_warning,
|
||||
sensitive: r.sensitive,
|
||||
local: r.t_local,
|
||||
|
||||
Reference in New Issue
Block a user