fix(prediction): 분석 상세 조회 500 에러 수정

ACDNT_WEATHER 테이블의 실제 컬럼명에 맞게 weather 쿼리 수정
(WEATHER_DTM→OBS_DTM, WIND_SPD→WIND 등 존재하지 않는 컬럼 참조 제거)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
htlee 2026-03-01 01:30:10 +09:00
부모 ff085252b0
커밋 bf16762dab
2개의 변경된 파일37개의 추가작업 그리고 29개의 파일을 삭제

파일 보기

@ -54,13 +54,15 @@ interface PredictionDetail {
insuranceData: unknown; insuranceData: unknown;
}>; }>;
weather: Array<{ weather: Array<{
weatherDtm: string; obsDtm: string;
windSpd: number | null; locNm: string;
windDir: string | null; temp: string;
waveHgt: number | null; weatherDc: string;
currentSpd: number | null; wind: string;
currentDir: string | null; wave: string;
temp: number | null; humid: string;
vis: string;
sst: string;
}>; }>;
} }
@ -244,16 +246,18 @@ export async function getAnalysisDetail(acdntSn: number): Promise<PredictionDeta
const weatherSql = ` const weatherSql = `
SELECT SELECT
WEATHER_DTM, OBS_DTM,
WIND_SPD, LOC_NM,
WIND_DIR, TEMP,
WAVE_HGT, WEATHER_DC,
CURRENT_SPD, WIND,
CURRENT_DIR, WAVE,
TEMP HUMID,
VIS,
SST
FROM ACDNT_WEATHER FROM ACDNT_WEATHER
WHERE ACDNT_SN = $1 WHERE ACDNT_SN = $1
ORDER BY WEATHER_DTM ASC ORDER BY OBS_DTM ASC
`; `;
const { rows: weatherRows } = await wingPool.query(weatherSql, [acdntSn]); const { rows: weatherRows } = await wingPool.query(weatherSql, [acdntSn]);
@ -288,13 +292,15 @@ export async function getAnalysisDetail(acdntSn: number): Promise<PredictionDeta
})); }));
const weather = weatherRows.map((w: Record<string, unknown>) => ({ const weather = weatherRows.map((w: Record<string, unknown>) => ({
weatherDtm: String(w['weather_dtm'] ?? ''), obsDtm: w['obs_dtm'] ? String(w['obs_dtm']) : '',
windSpd: w['wind_spd'] != null ? parseFloat(String(w['wind_spd'])) : null, locNm: String(w['loc_nm'] ?? ''),
windDir: w['wind_dir'] != null ? String(w['wind_dir']) : null, temp: String(w['temp'] ?? ''),
waveHgt: w['wave_hgt'] != null ? parseFloat(String(w['wave_hgt'])) : null, weatherDc: String(w['weather_dc'] ?? ''),
currentSpd: w['current_spd'] != null ? parseFloat(String(w['current_spd'])) : null, wind: String(w['wind'] ?? ''),
currentDir: w['current_dir'] != null ? String(w['current_dir']) : null, wave: String(w['wave'] ?? ''),
temp: w['temp'] != null ? parseFloat(String(w['temp'])) : null, humid: String(w['humid'] ?? ''),
vis: String(w['vis'] ?? ''),
sst: String(w['sst'] ?? ''),
})); }));
return { return {

파일 보기

@ -54,13 +54,15 @@ export interface PredictionDetail {
insuranceData: unknown; insuranceData: unknown;
}>; }>;
weather: Array<{ weather: Array<{
weatherDtm: string; obsDtm: string;
windSpd: number | null; locNm: string;
windDir: string | null; temp: string;
waveHgt: number | null; weatherDc: string;
currentSpd: number | null; wind: string;
currentDir: string | null; wave: string;
temp: number | null; humid: string;
vis: string;
sst: string;
}>; }>;
} }