mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 08:35:17 +00:00
Can get information about a single conversation
This commit is contained in:
@ -50,6 +50,36 @@ export class ConversationsHelper {
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get information about a single conversation
|
||||
*
|
||||
* @param convID The ID of the conversation to get
|
||||
*/
|
||||
public static async GetSingle(convID : number) : Promise<Conversation | null> {
|
||||
const result = await DatabaseHelper.QueryRow({
|
||||
fields: [
|
||||
"*",
|
||||
"l.id as id",
|
||||
"l.user_id as owner_id",
|
||||
],
|
||||
table: LIST_TABLE + " l",
|
||||
joins: [
|
||||
// Joins with conversation members table
|
||||
{
|
||||
table: USERS_TABLE + " u",
|
||||
condition: "l.id = u.conv_id"
|
||||
}
|
||||
],
|
||||
where: {
|
||||
"l.id": convID,
|
||||
}
|
||||
});
|
||||
|
||||
if(!result)
|
||||
return null;
|
||||
|
||||
return await this.DBToConversationInfo(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check out whether a user is the member of a conversation or not
|
||||
@ -97,7 +127,7 @@ export class ConversationsHelper {
|
||||
lastActive: row.last_active,
|
||||
timeCreate: row.time_add,
|
||||
following: row.following,
|
||||
sawLastMessage: row.saw_last_message,
|
||||
sawLastMessage: row.saw_last_message == 1,
|
||||
members: await this.GetConversationMembers(row.id)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user