diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-02-03 10:22:37 +0200 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-02-03 10:22:37 +0200 |
| commit | 01ad75fa5a871a0c9f8cd0c5291312286ae4d52d (patch) | |
| tree | 4f6b2eaef0424ffbfdd405939fbaa9325cc9d2c8 /src/DevHive.Web/Controllers | |
| parent | 81b3fc43a900857443c3c763f52e0a54719c2fae (diff) | |
| download | DevHive-01ad75fa5a871a0c9f8cd0c5291312286ae4d52d.tar DevHive-01ad75fa5a871a0c9f8cd0c5291312286ae4d52d.tar.gz DevHive-01ad75fa5a871a0c9f8cd0c5291312286ae4d52d.zip | |
Implemented profile picture table functionality; added models and interfaces for profile picture; added ability for user layers to update the profile picture; added migrations; updated mappings
Diffstat (limited to 'src/DevHive.Web/Controllers')
| -rw-r--r-- | src/DevHive.Web/Controllers/UserController.cs | 17 |
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 |
