aboutsummaryrefslogtreecommitdiff
path: root/src/Web/DevHive.Web
diff options
context:
space:
mode:
authorDanail Dimitrov <danaildimitrov321@gmail.com>2021-04-07 19:30:04 +0300
committerDanail Dimitrov <danaildimitrov321@gmail.com>2021-04-07 19:30:04 +0300
commit43336a1e977f33ad49ad8b4851ca449936f93ce6 (patch)
treec5170bebb63d1e57bef891905e0c2839766b8a08 /src/Web/DevHive.Web
parentb8d1edfc582bee2ef648757bcad1bbadd075bb08 (diff)
downloadDevHive-43336a1e977f33ad49ad8b4851ca449936f93ce6.tar
DevHive-43336a1e977f33ad49ad8b4851ca449936f93ce6.tar.gz
DevHive-43336a1e977f33ad49ad8b4851ca449936f93ce6.zip
adding functionality to add and remove friends
Diffstat (limited to 'src/Web/DevHive.Web')
-rw-r--r--src/Web/DevHive.Web/Controllers/FriendsController.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Web/DevHive.Web/Controllers/FriendsController.cs b/src/Web/DevHive.Web/Controllers/FriendsController.cs
index 00d70a4..9f3ec13 100644
--- a/src/Web/DevHive.Web/Controllers/FriendsController.cs
+++ b/src/Web/DevHive.Web/Controllers/FriendsController.cs
@@ -34,7 +34,9 @@ namespace DevHive.Web.Controllers
if (!this._jwtService.ValidateToken(userId, authorization))
return new UnauthorizedResult();
- return null;
+ return (await this._friendsService.AddFriend(userId, friendId)) ?
+ new OkResult() :
+ new BadRequestResult();
}
[HttpDelete]
@@ -44,7 +46,9 @@ namespace DevHive.Web.Controllers
if (!this._jwtService.ValidateToken(userId, authorization))
return new UnauthorizedResult();
- return null;
+ return (await this._friendsService.RemoveFriend(userId, friendId)) ?
+ new OkResult() :
+ new BadRequestResult();
}
}
}