mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 08:35:17 +00:00
Can update following status of a frienship
This commit is contained in:
@ -158,7 +158,7 @@ export class FriendsController {
|
||||
* @param h Request handler
|
||||
*/
|
||||
public static async RemoveFriend(h: RequestHandler) {
|
||||
const friendID = await h.postUserId("friendID");
|
||||
const friendID = await h.postFriendId("friendID");
|
||||
|
||||
await FriendsHelper.RemoveFriendship(h.getUserId(), friendID);
|
||||
|
||||
@ -167,6 +167,20 @@ export class FriendsController {
|
||||
h.success("The friend was removed from the list!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Update following status of a friendship
|
||||
*
|
||||
* @param h Request handler
|
||||
*/
|
||||
public static async SetFollowing(h: RequestHandler) {
|
||||
const friendID = await h.postFriendId("friendID");
|
||||
const follow = h.postBool("follow");
|
||||
|
||||
await FriendsHelper.SetFollowing(h.getUserId(), friendID, follow);
|
||||
|
||||
h.success("Following status upated!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn a friend object into an API entry
|
||||
*
|
||||
|
@ -91,6 +91,8 @@ export const Routes : Route[] = [
|
||||
|
||||
{path: "/friends/remove", cb: (h) => FriendsController.RemoveFriend(h)},
|
||||
|
||||
{path: "/friends/setFollowing", cb: (h) => FriendsController.SetFollowing(h)},
|
||||
|
||||
|
||||
// Conversations controller
|
||||
{path: "/conversations/create", cb: (h) => ConversationsController.CreateConversation(h)},
|
||||
|
Reference in New Issue
Block a user