1
0
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:
2020-01-01 14:58:31 +01:00
parent f46d87def5
commit 4cfb85d1ad
4 changed files with 52 additions and 1 deletions

View File

@ -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
*

View File

@ -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)},