mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-04 11:34:04 +00:00 
			
		
		
		
	Can get the list of members of a group
This commit is contained in:
		@@ -292,6 +292,21 @@ export class GroupsHelper {
 | 
			
		||||
		return currID < 1 || currID == groupID;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get the entire list of members of a group
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param groupID Target Group ID
 | 
			
		||||
	 */
 | 
			
		||||
	public static async GetListMembers(groupID: number) : Promise<Array<GroupMember>> {
 | 
			
		||||
		const members = await DatabaseHelper.Query({
 | 
			
		||||
			table: GROUPS_MEMBERS_TABLE,
 | 
			
		||||
			where: {
 | 
			
		||||
				groups_id: groupID
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		return members.map((row) => this.DbToGroupMember(row));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Count the number of members of a group
 | 
			
		||||
@@ -337,12 +352,12 @@ export class GroupsHelper {
 | 
			
		||||
	 * @param row Database entry
 | 
			
		||||
	 * @returns Generated object
 | 
			
		||||
	 */
 | 
			
		||||
	private static async DbToGroupMember(row: any) : Promise<GroupMember> {
 | 
			
		||||
	private static DbToGroupMember(row: any) : GroupMember {
 | 
			
		||||
		return new GroupMember({
 | 
			
		||||
			id: row.id,
 | 
			
		||||
			groupID: row.groups_id,
 | 
			
		||||
			userID: row.user_id,
 | 
			
		||||
			timeCreate: row.time_create,
 | 
			
		||||
			userID: Number(row.user_id),
 | 
			
		||||
			timeCreate: Number(row.time_create),
 | 
			
		||||
			level: row.level,
 | 
			
		||||
			following: row.following == 1
 | 
			
		||||
		});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user