From ffc6b7cd6e454627c95044e88037b37d31dcfce3 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 8 Apr 2021 09:29:49 +0300 Subject: Updated adding and removing friends to work with friend username, instead of friend id (temporary solution?) --- src/Web/DevHive.Web/Controllers/FriendsController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Web/DevHive.Web') diff --git a/src/Web/DevHive.Web/Controllers/FriendsController.cs b/src/Web/DevHive.Web/Controllers/FriendsController.cs index 9f3ec13..318ae64 100644 --- a/src/Web/DevHive.Web/Controllers/FriendsController.cs +++ b/src/Web/DevHive.Web/Controllers/FriendsController.cs @@ -29,24 +29,24 @@ namespace DevHive.Web.Controllers [HttpPost] [Authorize(Roles = "User,Admin")] - public async Task AddFriend(Guid userId, Guid friendId, [FromHeader] string authorization) + public async Task AddFriend(Guid userId, string friendUsername, [FromHeader] string authorization) { if (!this._jwtService.ValidateToken(userId, authorization)) return new UnauthorizedResult(); - return (await this._friendsService.AddFriend(userId, friendId)) ? + return (await this._friendsService.AddFriend(userId, friendUsername)) ? new OkResult() : new BadRequestResult(); } [HttpDelete] [Authorize(Roles = "User,Admin")] - public async Task RemoveFriend(Guid userId, Guid friendId, [FromHeader] string authorization) + public async Task RemoveFriend(Guid userId, string friendUsername, [FromHeader] string authorization) { if (!this._jwtService.ValidateToken(userId, authorization)) return new UnauthorizedResult(); - return (await this._friendsService.RemoveFriend(userId, friendId)) ? + return (await this._friendsService.RemoveFriend(userId, friendUsername)) ? new OkResult() : new BadRequestResult(); } -- cgit v1.2.3