using DrinkRateAPI.ApiModels.UserProfile; using DrinkRateAPI.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; namespace DrinkRateAPI.Controllers; [ApiController] [Route("userProfile")] public class UserProfileController : ControllerBase { private readonly UserProfileService _userProfileService; public UserProfileController(UserProfileService userProfileService) { _userProfileService = userProfileService; } [HttpPut] [Produces("application/json")] public async Task PutUserProfileSelf([FromBody] UserProfileSelfPut userProfile) { return await _userProfileService.PutUserProfileSelfAsync(User, userProfile); } [HttpGet] [Produces("application/json")] public async Task GetUserProfileSelf() { return await _userProfileService.GetUserProfileSelfAsync(User); } [HttpPut("{userId}")] [Authorize(Policy = "AdminOnly")] [Produces("application/json")] public async Task PutUserProfile(string userId, [FromBody] UserProfilePut userProfile) { return await _userProfileService.PutUserProfileAsync(User, userProfile, userId); } [HttpGet("{userId}")] [Authorize(Policy = "AdminOnly")] [Produces("application/json")] public async Task GetUserProfile(string userId) { return await _userProfileService.GetUserProfileAsync(User, userId); } }