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);