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

Get information about a single friendship

This commit is contained in:
2019-12-31 10:08:04 +01:00
parent cf99c719bb
commit 2152511843
3 changed files with 56 additions and 0 deletions

View File

@ -44,6 +44,22 @@ export class FriendsController {
h.send(friends.map((f) => f.friendID));
}
/**
* Get single friendship information
*
* @param h Request handler
*/
public static async GetSingleFrienshipInfo(h: RequestHandler) {
const friendID = await h.postUserId("friendID");
const info = await FriendsHelper.GetSingleInfo(h.getUserId(), friendID);
if(info == null)
h.error(404, "Requested frienship not found!");
h.send(this.FriendToAPI(info, true));
}
/**
* Turn a friend object into an API entry
*

View File

@ -79,6 +79,8 @@ export const Routes : Route[] = [
{path: "/friends/get_user_list", cb: (h) => FriendsController.GetOtherUserList(h), needLogin: false},
{path: "/friends/get_single_infos", cb: (h) => FriendsController.GetSingleFrienshipInfo(h)},
// Conversations controller
{path: "/conversations/create", cb: (h) => ConversationsController.CreateConversation(h)},