mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 05:19:22 +00:00
Ready to return advanced info
This commit is contained in:
parent
e85bdf8e54
commit
0925b44492
@ -115,6 +115,19 @@ export class GroupsController {
|
||||
h.send(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get advanced information about a group
|
||||
*
|
||||
* @param h Request handler
|
||||
*/
|
||||
public static async GetAdvancedInfo(h: RequestHandler) {
|
||||
const groupID = await h.postGroupIDWithAccess("id", GroupsAccessLevel.VIEW_ACCESS);
|
||||
|
||||
const group = await GroupsHelper.GetInfo(groupID);
|
||||
|
||||
h.send(await this.GroupInfoToAPI(group, h));
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn a GroupInfo object into a valid API object
|
||||
*
|
||||
|
@ -92,4 +92,6 @@ export const Routes : Route[] = [
|
||||
{path: "/groups/get_info", cb: (h) => GroupsController.GetInfoSingle(h)},
|
||||
|
||||
{path: "/groups/get_multiple_info", cb: (h) => GroupsController.GetInfoMultiple(h)},
|
||||
|
||||
{path: "/groups/get_advanced_info", cb: (h) => GroupsController.GetAdvancedInfo(h)},
|
||||
]
|
@ -52,10 +52,16 @@ export interface GroupInfoConstructor {
|
||||
registrationLevel: GroupRegistrationLevel,
|
||||
postsCreationLevel: GroupPostsCreationLevel,
|
||||
logo ?: string,
|
||||
virtualDirectory ?: string
|
||||
virtualDirectory ?: string,
|
||||
timeCreate: number,
|
||||
description ?: string,
|
||||
url ?: string,
|
||||
}
|
||||
|
||||
export class GroupInfo implements GroupInfoConstructor {
|
||||
timeCreate: number;
|
||||
description?: string;
|
||||
url?: string;
|
||||
id: number;
|
||||
name: string;
|
||||
membersCount: number;
|
||||
|
@ -250,7 +250,10 @@ export class GroupsHelper {
|
||||
registrationLevel: row.registration_level,
|
||||
postsCreationLevel: row.posts_level,
|
||||
logo: (row.path_logo != null && row.path_logo && row.path_logo != "null" ? row.path_logo : undefined),
|
||||
virtualDirectory: (row.virtual_directory != null && row.virtual_directory && row.virtual_directory != "null" ? row.virtual_directory : undefined)
|
||||
virtualDirectory: (row.virtual_directory != null && row.virtual_directory && row.virtual_directory != "null" ? row.virtual_directory : undefined),
|
||||
timeCreate: row.time_create,
|
||||
description: (row.description != null && row.description && row.description != "null" ? row.description : undefined),
|
||||
url: (row.url != null && row.url && row.url != "null" ? row.url : undefined)
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user