SPMS_API/SPMS.API/Controllers/NoticeController.cs

37 lines
1.3 KiB
C#

using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using SPMS.Application.DTOs.Notice;
using SPMS.Application.Interfaces;
using SPMS.Domain.Common;
namespace SPMS.API.Controllers;
[ApiController]
[Route("v1/in/public/notice")]
[ApiExplorerSettings(GroupName = "public")]
public class NoticeController : ControllerBase
{
private readonly INoticeService _noticeService;
public NoticeController(INoticeService noticeService)
{
_noticeService = noticeService;
}
[HttpPost("list")]
[SwaggerOperation(Summary = "공지사항 목록", Description = "활성화된 공지사항 목록을 페이징으로 조회합니다. 상단 고정 우선 정렬.")]
public async Task<IActionResult> GetListAsync([FromBody] NoticeListRequestDto request)
{
var result = await _noticeService.GetListAsync(request);
return Ok(ApiResponse<NoticeListResponseDto>.Success(result));
}
[HttpPost("info")]
[SwaggerOperation(Summary = "공지사항 상세", Description = "공지사항 ID로 상세 정보를 조회합니다.")]
public async Task<IActionResult> GetInfoAsync([FromBody] NoticeInfoRequestDto request)
{
var result = await _noticeService.GetInfoAsync(request);
return Ok(ApiResponse<NoticeInfoResponseDto>.Success(result));
}
}