aboutsummaryrefslogtreecommitdiff
path: root/src/DevHive.Web/Controllers/UserController.cs
diff options
context:
space:
mode:
authortranstrike <transtrike@gmail.com>2021-02-03 12:31:32 +0200
committertranstrike <transtrike@gmail.com>2021-02-03 12:31:32 +0200
commitb417eb391795f157a9db894647730f1daf69a1d3 (patch)
tree8a59e5958172839b17e59f0f7cdeaf95ee0492c9 /src/DevHive.Web/Controllers/UserController.cs
parent8174d2b35c1d3fa90df8b9cb4a75bb3381ea5e39 (diff)
parent5d0e9f2c19b68a73baeebf623980d458e3aab80c (diff)
downloadDevHive-b417eb391795f157a9db894647730f1daf69a1d3.tar
DevHive-b417eb391795f157a9db894647730f1daf69a1d3.tar.gz
DevHive-b417eb391795f157a9db894647730f1daf69a1d3.zip
Merge branch 'dev' of github.com:Team-Kaleidoscope/DevHive into dev
Diffstat (limited to 'src/DevHive.Web/Controllers/UserController.cs')
-rw-r--r--src/DevHive.Web/Controllers/UserController.cs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/DevHive.Web/Controllers/UserController.cs b/src/DevHive.Web/Controllers/UserController.cs
index fdf317c..109bbaa 100644
--- a/src/DevHive.Web/Controllers/UserController.cs
+++ b/src/DevHive.Web/Controllers/UserController.cs
@@ -94,6 +94,23 @@ namespace DevHive.Web.Controllers
return new AcceptedResult("UpdateUser", userWebModel);
}
+
+ [HttpPut]
+ [Route("ProfilePicture")]
+ [Authorize(Roles = "User,Admin")]
+ public async Task<IActionResult> UpdateProfilePicture(Guid userId, [FromForm] UpdateProfilePictureWebModel updateProfilePictureWebModel, [FromHeader] string authorization)
+ {
+ if (!await this._userService.ValidJWT(userId, authorization))
+ return new UnauthorizedResult();
+
+ UpdateProfilePictureServiceModel updateProfilePictureServiceModel = this._userMapper.Map<UpdateProfilePictureServiceModel>(updateProfilePictureWebModel);
+ updateProfilePictureServiceModel.UserId = userId;
+
+ ProfilePictureServiceModel profilePictureServiceModel = await this._userService.UpdateProfilePicture(updateProfilePictureServiceModel);
+ ProfilePictureWebModel profilePictureWebModel = this._userMapper.Map<ProfilePictureWebModel>(profilePictureServiceModel);
+
+ return new AcceptedResult("UpdateProfilePicture", profilePictureWebModel);
+ }
#endregion
#region Delete