using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.Threading.Tasks; using System; using UserManagement.Api.Helpers; using UserManagement.Data.Dto; using UserManagement.MediatR.Commands; using UserManagement.MediatR.Queries; namespace UserManagement.API.Controllers { [Route("api/[controller]")] [ApiController] [Authorize] public class CompanyProfileController(IMediator _mediator) : BaseController { /// /// Gets the company profile. /// /// [HttpGet(Name = "GetCompanyProfile")] [Produces("application/json", "application/xml", Type = typeof(List))] [AllowAnonymous] public async Task GetCompanyProfile() { var query = new GetCompanyProfileQuery { }; var result = await _mediator.Send(query); return Ok(result.Data); } /// /// Updates the company profile. /// /// The identifier. /// The update company profile command. /// [HttpPost("{id}")] [Produces("application/json", "application/xml", Type = typeof(CompanyProfileDto))] [ClaimCheck("company_profile_edit")] public async Task UpdateCompanyProfile(Guid id, UpdateCompanyProfileCommand updateCompanyProfileCommand) { var result = await _mediator.Send(updateCompanyProfileCommand); return Ok(result); } } }