diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-04-08 09:29:49 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-04-08 09:29:49 +0300 |
| commit | ffc6b7cd6e454627c95044e88037b37d31dcfce3 (patch) | |
| tree | b2d1b5d1882f022d5420f8227010d025ba8ee5fd /src/Web/DevHive.Web/Controllers/FriendsController.cs | |
| parent | 0a58b0c36f113b41984629aff45a9162305300a4 (diff) | |
| download | DevHive-ffc6b7cd6e454627c95044e88037b37d31dcfce3.tar DevHive-ffc6b7cd6e454627c95044e88037b37d31dcfce3.tar.gz DevHive-ffc6b7cd6e454627c95044e88037b37d31dcfce3.zip | |
Updated adding and removing friends to work with friend username, instead of friend id (temporary solution?)
Diffstat (limited to 'src/Web/DevHive.Web/Controllers/FriendsController.cs')
| -rw-r--r-- | src/Web/DevHive.Web/Controllers/FriendsController.cs | 8 |
1 files changed, 4 insertions, 4 deletions
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<IActionResult> AddFriend(Guid userId, Guid friendId, [FromHeader] string authorization) + public async Task<IActionResult> 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<IActionResult> RemoveFriend(Guid userId, Guid friendId, [FromHeader] string authorization) + public async Task<IActionResult> 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(); } |
