feat: 점검 안내 API 구현 (#92) #93

Merged
seonkyu.kim merged 1 commits from feature/#92-maintenance into develop 2026-02-10 05:36:04 +00:00
4 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,28 @@
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 MaintenanceController : ControllerBase
{
private readonly IAppConfigService _appConfigService;
public MaintenanceController(IAppConfigService appConfigService)
{
_appConfigService = appConfigService;
}
[HttpPost("maintenance")]
[SwaggerOperation(Summary = "점검 안내", Description = "현재 서비스 점검 상태를 조회합니다.")]
public async Task<IActionResult> GetMaintenanceAsync()
{
var result = await _appConfigService.GetMaintenanceAsync();
return Ok(ApiResponse<MaintenanceResponseDto>.Success(result));
}
}

View File

@ -0,0 +1,15 @@
using System.Text.Json.Serialization;
namespace SPMS.Application.DTOs.AppConfig;
public class MaintenanceResponseDto
{
[JsonPropertyName("is_maintenance")]
public bool IsMaintenance { get; set; }
[JsonPropertyName("maintenance_msg")]
public string? MaintenanceMsg { get; set; }
[JsonPropertyName("estimated_end_time")]
public string? EstimatedEndTime { get; set; }
}

View File

@ -8,4 +8,5 @@ public interface IAppConfigService
Task<AppConfigResponseDto> GetPrivacyAsync(); Task<AppConfigResponseDto> GetPrivacyAsync();
Task<AppVersionResponseDto> GetAppVersionAsync(AppVersionRequestDto request); Task<AppVersionResponseDto> GetAppVersionAsync(AppVersionRequestDto request);
Task<AppSettingsResponseDto> GetAppSettingsAsync(); Task<AppSettingsResponseDto> GetAppSettingsAsync();
Task<MaintenanceResponseDto> GetMaintenanceAsync();
} }

View File

@ -57,4 +57,18 @@ public class AppConfigService : IAppConfigService
CsPhone = configDict.GetValueOrDefault("cs_phone") CsPhone = configDict.GetValueOrDefault("cs_phone")
}; };
} }
public async Task<MaintenanceResponseDto> GetMaintenanceAsync()
{
var maintenanceMode = await _appConfigRepository.GetByKeyAsync("maintenance_mode");
var maintenanceMessage = await _appConfigRepository.GetByKeyAsync("maintenance_message");
var maintenanceEndTime = await _appConfigRepository.GetByKeyAsync("maintenance_end_time");
return new MaintenanceResponseDto
{
IsMaintenance = string.Equals(maintenanceMode?.ConfigValue, "true", StringComparison.OrdinalIgnoreCase),
MaintenanceMsg = maintenanceMessage?.ConfigValue,
EstimatedEndTime = maintenanceEndTime?.ConfigValue
};
}
} }