aboutsummaryrefslogtreecommitdiff
path: root/src/Web/DevHive.Web/Controllers/ProfilePictureController.cs
blob: 2eec99e7b88c5eca917bafb58ee1a981e73f70b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Threading.Tasks;
using DevHive.Web.Models.User;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace DevHive.Web.Controllers
{
	/// <summary>
	/// All endpoints for interacting with the profile picture layer
	/// </summary>
	[ApiController]
	[Route("api/[controller]")]
	public class ProfilePictureController
	{
		// private readonly ProfilePictureService _profilePictureService;

		// public ProfilePictureController(ProfilePictureService profilePictureService)
		// {
		// 	this._profilePictureService = profilePictureService;
		// }

		/// <summary>
		/// Alter the profile picture of a user
		/// </summary>
		/// <param name="userId">The user's Id</param>
		/// <param name="updateProfilePictureWebModel">The new profile picture</param>
		/// <param name="authorization">JWT Bearer Token</param>
		/// <returns>???</returns>
		[HttpPut]
		[Route("ProfilePicture")]
		[Authorize(Roles = "User,Admin")]
		public async Task<IActionResult> UpdateProfilePicture(Guid userId, [FromForm] UpdateProfilePictureWebModel updateProfilePictureWebModel, [FromHeader] string authorization)
		{
			throw new NotImplementedException();
			// 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);
		}
	}
}