SPMS_API/SPMS.API/Controllers/FaqController.cs
2026-02-10 13:57:17 +09:00

33 lines
1.1 KiB
C#

using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using SPMS.Application.DTOs.Faq;
using SPMS.Application.Interfaces;
using SPMS.Domain.Common;
namespace SPMS.API.Controllers;
[ApiController]
[Route("v1/in/public/faq")]
[ApiExplorerSettings(GroupName = "public")]
public class FaqController : ControllerBase
{
private readonly IFaqService _faqService;
public FaqController(IFaqService faqService)
{
_faqService = faqService;
}
[HttpPost("list")]
[SwaggerOperation(Summary = "FAQ 목록", Description = "활성화된 FAQ 목록을 조회합니다. category로 필터링 가능.")]
public async Task<IActionResult> GetListAsync([FromBody] FaqListRequestDto request)
{
var serviceCode = Request.Headers["X-Service-Code"].FirstOrDefault();
if (string.IsNullOrWhiteSpace(serviceCode))
return BadRequest(ApiResponse.Fail(ErrorCodes.BadRequest, "X-Service-Code 헤더가 필요합니다."));
var result = await _faqService.GetListAsync(serviceCode, request);
return Ok(ApiResponse<FaqListResponseDto>.Success(result));
}
}