From 8058add053b4b900a6c252580f7311ce801a4bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Vrabec?= Date: Mon, 11 Aug 2025 07:46:14 +0200 Subject: [PATCH] Rename class --- ...geAdminStatusBody.cs => UserProfileAdminStatusPut.cs} | 2 +- DrinkRateAPI/Controllers/UserProfileController.cs | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) rename DrinkRateAPI/ApiModels/UserProfile/{ChangeAdminStatusBody.cs => UserProfileAdminStatusPut.cs} (70%) diff --git a/DrinkRateAPI/ApiModels/UserProfile/ChangeAdminStatusBody.cs b/DrinkRateAPI/ApiModels/UserProfile/UserProfileAdminStatusPut.cs similarity index 70% rename from DrinkRateAPI/ApiModels/UserProfile/ChangeAdminStatusBody.cs rename to DrinkRateAPI/ApiModels/UserProfile/UserProfileAdminStatusPut.cs index 238546f..b7dc8c7 100644 --- a/DrinkRateAPI/ApiModels/UserProfile/ChangeAdminStatusBody.cs +++ b/DrinkRateAPI/ApiModels/UserProfile/UserProfileAdminStatusPut.cs @@ -1,6 +1,6 @@ namespace DrinkRateAPI.ApiModels.UserProfile; -public class ChangeAdminStatusBody +public class UserProfileAdminStatusPut { public bool ChangeStatusTo { get; set; } } \ No newline at end of file diff --git a/DrinkRateAPI/Controllers/UserProfileController.cs b/DrinkRateAPI/Controllers/UserProfileController.cs index afc1bcf..a81aaf8 100644 --- a/DrinkRateAPI/Controllers/UserProfileController.cs +++ b/DrinkRateAPI/Controllers/UserProfileController.cs @@ -18,19 +18,18 @@ public class UserProfileController : ControllerBase _logger = logger; _userProfileService = userProfileService; } - - [HttpPut(Name = "user_profile")] - public UserProfileGet PutUserProfile(UserProfilePut userProfile) + + public UserProfileGet PutUserProfile([FromBody] UserProfilePut userProfile) { throw new ApplicationException(); var x = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; //HttpContext.User.Identities.First(); return new(); } - + [HttpPut("{userId}/adminStatus")] [Authorize(Policy = "AdminOnly")] [Produces("application/json")] - public async Task PutUserAdminStatus(string userId, [FromBody] ChangeAdminStatusBody body) + public async Task PutUserAdminStatus(string userId, [FromBody] UserProfileAdminStatusPut body) { var changedProfile = await _userProfileService.PutUserProfileAdminStatusAsync(userId, body.ChangeStatusTo);