Rename class

This commit is contained in:
Jiří Vrabec 2025-08-11 07:46:14 +02:00
parent a246764e44
commit 8058add053
2 changed files with 5 additions and 6 deletions

View file

@ -1,6 +1,6 @@
namespace DrinkRateAPI.ApiModels.UserProfile; namespace DrinkRateAPI.ApiModels.UserProfile;
public class ChangeAdminStatusBody public class UserProfileAdminStatusPut
{ {
public bool ChangeStatusTo { get; set; } public bool ChangeStatusTo { get; set; }
} }

View file

@ -18,19 +18,18 @@ public class UserProfileController : ControllerBase
_logger = logger; _logger = logger;
_userProfileService = userProfileService; _userProfileService = userProfileService;
} }
[HttpPut(Name = "user_profile")] public UserProfileGet PutUserProfile([FromBody] UserProfilePut userProfile)
public UserProfileGet PutUserProfile(UserProfilePut userProfile)
{ {
throw new ApplicationException(); throw new ApplicationException();
var x = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; //HttpContext.User.Identities.First(); var x = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; //HttpContext.User.Identities.First();
return new(); return new();
} }
[HttpPut("{userId}/adminStatus")] [HttpPut("{userId}/adminStatus")]
[Authorize(Policy = "AdminOnly")] [Authorize(Policy = "AdminOnly")]
[Produces("application/json")] [Produces("application/json")]
public async Task<IActionResult> PutUserAdminStatus(string userId, [FromBody] ChangeAdminStatusBody body) public async Task<IActionResult> PutUserAdminStatus(string userId, [FromBody] UserProfileAdminStatusPut body)
{ {
var changedProfile = await _userProfileService.PutUserProfileAdminStatusAsync(userId, body.ChangeStatusTo); var changedProfile = await _userProfileService.PutUserProfileAdminStatusAsync(userId, body.ChangeStatusTo);