1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-22 01:15:16 +00:00

Can get information about a single comment

This commit is contained in:
2020-07-10 08:45:53 +02:00
parent 4ed101b0dc
commit 24e094fc4a
4 changed files with 35 additions and 1 deletions

View File

@ -33,6 +33,13 @@ pub fn get(post_id: u64) -> ResultBoxError<Vec<Comment>> {
.exec(db_to_comment)
}
/// Get information about a single comment
pub fn get_single(comment_id: u64) -> ResultBoxError<Comment> {
database::QueryInfo::new(COMMENTS_TABLE)
.cond_u64("ID", comment_id)
.query_row(db_to_comment)
}
/// Turn a database entry into a comment object
fn db_to_comment(row: &database::RowResult) -> ResultBoxError<Comment> {