40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using TaxBaik.Application.Services;
|
|
|
|
namespace TaxBaik.Web.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/[controller]")]
|
|
[Authorize]
|
|
public class CommonCodeController(CommonCodeService commonCodeService) : ControllerBase
|
|
{
|
|
[HttpGet]
|
|
public async Task<IActionResult> GetAllActive()
|
|
{
|
|
try
|
|
{
|
|
var codes = await commonCodeService.GetAllActiveAsync();
|
|
return Ok(codes);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "공통코드 조회 실패", message = ex.Message });
|
|
}
|
|
}
|
|
|
|
[HttpGet("group/{group}")]
|
|
public async Task<IActionResult> GetByGroup(string group)
|
|
{
|
|
try
|
|
{
|
|
var codes = await commonCodeService.GetByGroupAsync(group);
|
|
return Ok(codes);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return StatusCode(500, new { error = "그룹별 공통코드 조회 실패", message = ex.Message });
|
|
}
|
|
}
|
|
}
|