1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Can update the content of the posts

This commit is contained in:
2020-07-09 09:27:47 +02:00
parent cb47b67dc6
commit 697a01b6df
4 changed files with 38 additions and 1 deletions

View File

@ -391,6 +391,14 @@ pub fn set_level(post_id: u64, level: PostVisibilityLevel) -> ResultBoxError {
.exec()
}
/// Set a new content to the post
pub fn set_content(post_id: u64, new_content: &str) -> ResultBoxError {
database::UpdateInfo::new(POSTS_TABLE)
.cond_u64("ID", post_id)
.set_str("texte", new_content)
.exec()
}
/// Turn a post into a database entry
fn db_to_post(res: &database::RowResult) -> ResultBoxError<Post> {
let user_id = if res.get_u64("ID_amis")? == 0 {