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:
@ -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
|
||||
*
|
||||
|
@ -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)},
|
||||
|
Reference in New Issue
Block a user