1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-06-20 00:25:17 +00:00

Export groups memberships

This commit is contained in:
2020-03-26 13:59:30 +01:00
parent 89b5b3c4e1
commit 21a5e0df2e
4 changed files with 12 additions and 2 deletions

View File

@ -13,6 +13,8 @@ import { SurveyController } from "./SurveyController";
import { MoviesController } from "./MoviesController";
import { ConversationsController } from "./ConversationsController";
import { FriendsController } from "./FriendsController";
import { GroupsHelper } from "../helpers/GroupsHelper";
import { GroupsController } from "./GroupsController";
/**
* Account controller
@ -264,6 +266,10 @@ export class AccountController {
// Friends list
friends_list: data.friendsList.map(f => FriendsController.FriendToAPI(f, false)),
// Groups membership
groups: await Promise.all((await Promise.all(data.groups.map(id => GroupsHelper.GetInfo(id))))
.map(info => GroupsController.GroupInfoToAPI(info, h, false))),
// Related users info
users_info: new Map<number, any>(),
};

View File

@ -583,7 +583,7 @@ export class GroupsController {
* in the request or not
* @returns Generated object
*/
private static async GroupInfoToAPI(info: GroupInfo, h: RequestHandler, advanced: boolean = false) : Promise<any> {
public static async GroupInfoToAPI(info: GroupInfo, h: RequestHandler, advanced: boolean = false) : Promise<any> {
const membership = await GroupsHelper.GetMembershipInfo(info.id, h.optionnalUserID)