User profile service #2
2 changed files with 5 additions and 6 deletions
|
@ -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; }
|
||||||
}
|
}
|
|
@ -19,8 +19,7 @@ public class UserProfileController : ControllerBase
|
||||||
_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();
|
||||||
|
@ -30,7 +29,7 @@ public class UserProfileController : ControllerBase
|
||||||
[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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue