mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-21 00:45:18 +00:00
Can get information about a single conversation
This commit is contained in:
@ -72,6 +72,25 @@ pub fn get_list_user(user_id: UserID) -> ResultBoxError<Vec<Conversation>> {
|
||||
.exec(db_to_conversation_info)
|
||||
}
|
||||
|
||||
/// Get information about a single conversation
|
||||
pub fn get_single(conv_id: u64, user_id: UserID) -> ResultBoxError<Conversation> {
|
||||
// Tables
|
||||
database::QueryInfo::new(CONV_LIST_TABLE)
|
||||
.alias("l")
|
||||
.join(CONV_USERS_TABLE, "u", "l.id = u.conv_id")
|
||||
|
||||
// Fields
|
||||
.add_field("*")
|
||||
.add_field("l.id as id")
|
||||
.add_field("l.user_id as owner_id")
|
||||
|
||||
// Conditions
|
||||
.cond_u64("l.id", conv_id)
|
||||
.cond_user_id("u.user_id", user_id)
|
||||
|
||||
.query_row(db_to_conversation_info)
|
||||
}
|
||||
|
||||
/// Get the list of members of a conversation
|
||||
pub fn get_list_members(conv_id: u64) -> ResultBoxError<Vec<UserID>> {
|
||||
database::QueryInfo::new(CONV_USERS_TABLE)
|
||||
|
Reference in New Issue
Block a user