using Microsoft.AspNetCore.Mvc; using Server.Services; using SharedModels.Requests; namespace Server.Controllers; [Route("api/account")] [ApiController] public class AccountController : ControllerBase { private readonly IAccountManagementService _accountManagementService; public AccountController(IAccountManagementService accountManagementService) { _accountManagementService = accountManagementService; } [HttpPost("changeInformation")] public async Task ChangeInformation([FromBody] ChangeInformationRequest request) { var result = await _accountManagementService.ChangeInformation(request); if (!result.isSucceed) { return result.actionResult; } return Ok(); } [HttpPost("changeEmail")] public async Task ChangeEmail([FromBody] ChangeEmailRequest request) { var result = await _accountManagementService.ChangeEmail(request); if (!result.isSucceed) { return result.actionResult; } return Ok(); } [HttpPost("confirmationEmailCallback")] public async Task ConfirmChangeEmail([FromBody] ConfirmChangeEmailRequest request) { var result = await _accountManagementService.ConfirmChangeEmail(request); if (!result.isSucceed) { return result.actionResult; } return Ok(); } [HttpPost("changePhoneNumber")] public async Task ChangePhoneNumber([FromBody] ChangePhoneNumberRequest request) { var result = await _accountManagementService.ChangePhoneNumber(request); if (!result.isSucceed) { return result.actionResult; } return Ok(); } [HttpPost("confirmPhoneNumber")] public async Task ConfirmPhoneNumber([FromBody] ConfirmChangePhoneNumberRequest request) { var result = await _accountManagementService.ConfirmPhoneNumberChange(request); if (!result.isSucceed) { return result.actionResult; } return Ok(); } [HttpPost("changePassword")] public async Task ChangePassword([FromBody] ChangePasswordRequest request) { var result = await _accountManagementService.ChangePassword(request); if (!result.isSucceed) { return result.actionResult; } return Ok(); } }