fix: 부적합 제출 버그 수정 및 UI 개선

- 부적합 API 호출 형식 수정 (카테고리/아이템 추가 시)
- 부적합 저장 시 내부 플래그 제거 후 백엔드 전송
- 기본 부적합 객체 구조 수정 (category_id, item_id 추가)
- 날씨 API 시간대 수정 (UTC → KST 변환)
- 신고 카테고리 관리 페이지 추가 (/pages/admin/issue-categories.html)
- 부적합 입력 UI 개선 (대분류→소분류 캐스케이딩 선택)
- 저장된 부적합 분리 표시 및 수정/삭제 기능
- 디버깅 로그 추가

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-02-03 09:31:26 +09:00
parent 4b158de1eb
commit c42c9f4fa3
29 changed files with 7042 additions and 809 deletions

View File

@@ -58,10 +58,8 @@ async function getCurrentWeather(nx = WEATHER_API.defaultLocation.nx, ny = WEATH
}
try {
// 현재 시간 기준으로 base_date, base_time 계산
const now = new Date();
const baseDate = formatDate(now);
const baseTime = getBaseTime(now);
// 한국 시간 기준으로 base_date, base_time 계산
const { baseDate, baseTime } = getBaseDateTime();
logger.info('날씨 API 호출', { baseDate, baseTime, nx, ny });
@@ -322,7 +320,45 @@ function getDefaultWeatherData() {
}
/**
* 날짜 포맷 (YYYYMMDD)
* 기상청 API용 기준 날짜/시간 계산
* 한국 시간(KST, UTC+9) 기준으로 계산
* 매시간 정각에 생성되고 10분 후에 제공됨
* @returns {{ baseDate: string, baseTime: string }}
*/
function getBaseDateTime() {
// 한국 시간으로 변환 (UTC + 9시간)
const now = new Date();
const kstOffset = 9 * 60 * 60 * 1000; // 9시간을 밀리초로
const kstDate = new Date(now.getTime() + kstOffset);
let year = kstDate.getUTCFullYear();
let month = kstDate.getUTCMonth() + 1;
let day = kstDate.getUTCDate();
let hours = kstDate.getUTCHours();
let minutes = kstDate.getUTCMinutes();
// 10분 이전이면 이전 시간 데이터 사용
if (minutes < 10) {
hours = hours - 1;
if (hours < 0) {
hours = 23;
// 전날로 변경
const prevDay = new Date(kstDate.getTime() - 24 * 60 * 60 * 1000);
year = prevDay.getUTCFullYear();
month = prevDay.getUTCMonth() + 1;
day = prevDay.getUTCDate();
}
}
const baseDate = `${year}${String(month).padStart(2, '0')}${String(day).padStart(2, '0')}`;
const baseTime = String(hours).padStart(2, '0') + '00';
return { baseDate, baseTime };
}
/**
* 날짜 포맷 (YYYYMMDD) - 호환성 유지용
* @deprecated getBaseDateTime() 사용 권장
*/
function formatDate(date) {
const year = date.getFullYear();
@@ -332,14 +368,12 @@ function formatDate(date) {
}
/**
* 초단기실황 API용 기준시간 계산
* 매시간 정각에 생성되고 10분 후에 제공됨
* @deprecated getBaseDateTime() 사용 권장
*/
function getBaseTime(date) {
let hours = date.getHours();
let minutes = date.getMinutes();
// 10분 이전이면 이전 시간 데이터 사용
if (minutes < 10) {
hours = hours - 1;
if (hours < 0) hours = 23;