1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-09-19 11:28:46 +00:00

Can get information about a single post

This commit is contained in:
2020-07-06 11:00:59 +02:00
parent f8413850ae
commit d49a4737e4
5 changed files with 47 additions and 1 deletions

View File

@@ -230,6 +230,13 @@ pub fn get_latest(query: &PostsQuery, include_group_posts: bool) -> ResultBoxErr
.exec(db_to_post)
}
/// Get information about a single post
pub fn get_single(post_id: u64) -> ResultBoxError<Post> {
database::QueryInfo::new(POSTS_TABLE)
.cond_u64("ID", post_id)
.query_row(db_to_post)
}
/// Get the access level of a user over a post
pub fn get_access_level(p: &Post, user_id: &Option<UserID>) -> ResultBoxError<PostAccessLevel> {
if user_id == &p.user_id.as_option() {