Merge pull request 'fix: history/detail API 500 오류 — candidate_count 컬럼 부재 시 안전 처리' (#224) from hotfix/history-candidate-count into main
All checks were successful
Deploy KCG / deploy (push) Successful in 1m53s

This commit is contained in:
htlee 2026-04-04 11:05:14 +09:00
커밋 d37653c1be

파일 보기

@ -1409,7 +1409,7 @@ public class GroupPolygonService {
.members(members) .members(members)
.color(rs.getString("color")) .color(rs.getString("color"))
.resolution(rs.getString("resolution")) .resolution(rs.getString("resolution"))
.candidateCount(nullableInt(rs, "candidate_count")) .candidateCount(optionalInt(rs, "candidate_count"))
.parentInference(mapParentInferenceSummary(rs)) .parentInference(mapParentInferenceSummary(rs))
.build(); .build();
} }
@ -1566,6 +1566,15 @@ public class GroupPolygonService {
return ((Number) value).intValue(); return ((Number) value).intValue();
} }
/** 컬럼이 ResultSet에 존재하지 않으면 null 반환 (history/detail SQL 호환) */
private Integer optionalInt(ResultSet rs, String column) throws SQLException {
try {
return nullableInt(rs, column);
} catch (SQLException e) {
return null;
}
}
private Map<String, Object> parseJsonObject(String json) { private Map<String, Object> parseJsonObject(String json) {
return parseJsonValue(json, new TypeReference<Map<String, Object>>() {}, Map.of()); return parseJsonValue(json, new TypeReference<Map<String, Object>>() {}, Map.of());
} }