Skip to content

Commit

Permalink
fix: migration stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
CutestNekoAqua committed Jul 21, 2024
1 parent 4429aa3 commit 451cf89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
14 changes: 9 additions & 5 deletions src/lysand/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ pub async fn lysand_user_from_db(
let mut emojis = Vec::new();
for tag in tags {
let mut content_format = ContentFormat::default();
let content_entry = ContentEntry::from_string(tag.id.to_string());
if tag.id.is_none() {
continue;
}
let content_entry = ContentEntry::from_string(tag.id.unwrap().to_string());
content_format.x.insert(tag.type_, content_entry);
emojis.push(super::objects::CustomEmoji {
name: tag.name,
Expand Down Expand Up @@ -314,15 +317,16 @@ pub async fn db_user_from_url(url: Url) -> anyhow::Result<entities::user::Model>
for emoji in custom_emojis.emojis {
let touple = emoji.url.select_rich_img_touple().await?;
tags.push(TagType {
id: Url::parse(&touple.1).unwrap(),
id: Some(Url::parse(&touple.1).unwrap()),
name: emoji.name,
type_: "Emoji".to_string(),
updated: Utc::now(),
icon: IconType {
updated: Some(Utc::now()),
href: None,
icon: Some(IconType {
type_: "Image".to_string(),
media_type: touple.0,
url: Url::parse(&touple.1).unwrap(),
},
}),
});
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/objects/person.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ pub struct Person {
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct TagType {
pub id: Url,
pub id: Option<Url>,
pub href: Option<Url>,
pub name: String,
#[serde(rename = "type")]
pub type_: String,
pub updated: DateTime<Utc>,
pub icon: IconType,
pub updated: Option<DateTime<Utc>>,
pub icon: Option<IconType>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
Expand Down

0 comments on commit 451cf89

Please sign in to comment.