SPMS_API/SPMS.API/Controllers/AppConfigController.cs

33 lines
1.1 KiB
C#

using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using SPMS.Application.DTOs.AppConfig;
using SPMS.Application.Interfaces;
using SPMS.Domain.Common;
namespace SPMS.API.Controllers;
[ApiController]
[Route("v1/in/public")]
[ApiExplorerSettings(GroupName = "public")]
public class AppConfigController : ControllerBase
{
private readonly IAppConfigService _appConfigService;
public AppConfigController(IAppConfigService appConfigService)
{
_appConfigService = appConfigService;
}
[HttpPost("config")]
[SwaggerOperation(Summary = "앱 기본 설정", Description = "앱 기본 설정 정보를 조회합니다.")]
public async Task<IActionResult> GetAppSettingsAsync()
{
var serviceCode = Request.Headers["X-Service-Code"].FirstOrDefault();
if (string.IsNullOrWhiteSpace(serviceCode))
return BadRequest(ApiResponse.Fail(ErrorCodes.BadRequest, "X-Service-Code 헤더가 필요합니다."));
var result = await _appConfigService.GetAppSettingsAsync(serviceCode);
return Ok(ApiResponse<AppSettingsResponseDto>.Success(result));
}
}