remove deprecated path field and add ipfs field on meme struct

This commit is contained in:
LordMZTE 2021-12-25 20:51:07 +01:00
parent d4a8b33dd0
commit fb10405a3b

View file

@ -35,16 +35,16 @@ pub struct Category {
pub struct Meme {
pub id: String,
pub link: String,
pub path: String,
pub category: String,
pub user: String,
#[serde(deserialize_with = "deserialize_timestamp")]
pub timestamp: i64,
pub ipfs: Option<String>,
}
impl Meme {
pub fn file_name(&self) -> Result<&str> {
self.path
self.link
.split('/')
.last()
.ok_or_else(|| anyhow!("failed to get file name. server response invalid"))