Add date editing for posts

This commit is contained in:
2025-01-09 18:29:24 -05:00
parent d0a4b0f6a6
commit 5848b7360c
7 changed files with 41 additions and 6 deletions
+13
View File
@@ -75,6 +75,19 @@ impl BlogDb {
.await?;
Ok(())
}
/// Delete post by id
pub async fn set_post_date<S, T>(&self, id: S, date: T) -> anyhow::Result<()>
where
S: AsRef<str>,
T: AsRef<str>,
{
sqlx::query("UPDATE posts SET date=? WHERE id=?")
.bind(date.as_ref())
.bind(id.as_ref())
.execute(&self.db)
.await?;
Ok(())
}
}
#[cfg(test)]