mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 21:39:22 +00:00
Can get information about a single user membership
This commit is contained in:
parent
6fab4bf8e3
commit
675bf79c6e
@ -479,6 +479,23 @@ export class GroupsController {
|
|||||||
h.success("The response to the request has been successfully saved!");
|
h.success("The response to the request has been successfully saved!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get information about a single membership
|
||||||
|
*
|
||||||
|
* @param h Request handler
|
||||||
|
*/
|
||||||
|
public static async GetMembership(h: RequestHandler) {
|
||||||
|
const groupID = await h.postGroupIDWithAccess("groupID", GroupsAccessLevel.MODERATOR_ACCESS);
|
||||||
|
const userID = await h.postUserId("userID");
|
||||||
|
|
||||||
|
const membership = await GroupsHelper.GetMembershipInfo(groupID, userID);
|
||||||
|
|
||||||
|
if(membership == null)
|
||||||
|
h.error(404, "Specified user does not have any membership in this group!");
|
||||||
|
|
||||||
|
h.send(this.GroupMemberToAPI(membership));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn a GroupInfo object into a valid API object
|
* Turn a GroupInfo object into a valid API object
|
||||||
*
|
*
|
||||||
|
@ -120,4 +120,6 @@ export const Routes : Route[] = [
|
|||||||
{path: "/groups/update_membership_level", cb: (h) => GroupsController.UpdateMembership(h)},
|
{path: "/groups/update_membership_level", cb: (h) => GroupsController.UpdateMembership(h)},
|
||||||
|
|
||||||
{path: "/groups/respond_request", cb: (h) => GroupsController.RespondRequest(h)},
|
{path: "/groups/respond_request", cb: (h) => GroupsController.RespondRequest(h)},
|
||||||
|
|
||||||
|
{path: "/groups/get_membership", cb: (h) => GroupsController.GetMembership(h)},
|
||||||
]
|
]
|
Loading…
Reference in New Issue
Block a user