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/app")] [ApiExplorerSettings(GroupName = "public")] public class AppVersionController : ControllerBase { private readonly IAppConfigService _appConfigService; public AppVersionController(IAppConfigService appConfigService) { _appConfigService = appConfigService; } [HttpPost("version")] [SwaggerOperation(Summary = "앱 버전 체크", Description = "현재 앱 버전 정보를 확인하고 업데이트 필요 여부를 반환합니다.")] public async Task CheckVersionAsync([FromBody] AppVersionRequestDto 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 _appConfigService.GetAppVersionAsync(serviceCode, request); return Ok(ApiResponse.Success(result)); } }