Skip to content

Commit 927c907

Browse files
committed
feat(deploy): migrate proxy and types to data.go.kr API v2 (#63)
The public-data-portal endpoint moved to v2 with a renamed base path and per-resource _v2 suffixes. Update the proxy and the consumers in the same PR so the Route Handler delivered in the previous commit keeps working end-to-end. Route Handler upstream URL: - http://apis.data.go.kr/1543061/abandonmentPublicSrvc + https://apis.data.go.kr/1543061/abandonmentPublicService_v2 (now also HTTPS, matching the v2 spec at data.go.kr/data/15098931) new-api path constants (all five callers): - /abandonmentPublic → /abandonmentPublic_v2 - /sido → /sido_v2 - /sigungu → /sigungu_v2 - /kind → /kind_v2 - /shelter → /shelter_v2 shared-types AnimalInfo: - popfile (single Image URL) → popfile1 (required) plus optional popfile2..popfile8. The v2 schema returns up to 8 image URLs per rescue notice; we only render the first today, but the optional fields are typed for the gallery work in #18 e2e / future ports. apps/web AnimalCard.tsx: - item.popfile → item.popfile1 - nx affected -t lint test build --exclude web-e2e green Refs #63
1 parent 828920a commit 927c907

8 files changed

Lines changed: 15 additions & 8 deletions

File tree

apps/web/app/api/data-go-kr/[...path]/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextRequest, NextResponse } from 'next/server';
22

33
const UPSTREAM_BASE =
4-
'http://apis.data.go.kr/1543061/abandonmentPublicSrvc';
4+
'https://apis.data.go.kr/1543061/abandonmentPublicService_v2';
55

66
export async function GET(
77
request: NextRequest,

apps/web/src/new-api/animalInfo/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import { AnimalInfoRequestType } from "@animal-project/shared-types";
22
import { getAPI } from "../service";
33
import { AnimalInfo } from "@animal-project/shared-types";
44

5-
export const getAnimalInfo = (props : AnimalInfoRequestType) => getAPI<AnimalInfoRequestType, AnimalInfo>(props, '/abandonmentPublic')
5+
export const getAnimalInfo = (props : AnimalInfoRequestType) => getAPI<AnimalInfoRequestType, AnimalInfo>(props, '/abandonmentPublic_v2')

apps/web/src/new-api/kind/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import { KindRequestType } from "@animal-project/shared-types";
22
import { getAPI } from "../service";
33
import { Kind } from "@animal-project/shared-types";
44

5-
export const getKind = (props : KindRequestType) => getAPI<KindRequestType, Kind>(props, '/kind')
5+
export const getKind = (props : KindRequestType) => getAPI<KindRequestType, Kind>(props, '/kind_v2')

apps/web/src/new-api/shelter/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import { ShelterRequestType } from "@animal-project/shared-types";
22
import { getAPI } from "../service";
33
import { Shelter } from "@animal-project/shared-types";
44

5-
export const getShelter = (props : ShelterRequestType) => getAPI<ShelterRequestType, Shelter>(props, '/shelter')
5+
export const getShelter = (props : ShelterRequestType) => getAPI<ShelterRequestType, Shelter>(props, '/shelter_v2')

apps/web/src/new-api/sido/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import { SidoRequestType } from "@animal-project/shared-types";
22
import { getAPI } from "../service";
33
import { Sido } from "@animal-project/shared-types";
44

5-
export const getSido = (props : SidoRequestType) => getAPI<SidoRequestType, Sido>(props, '/sido')
5+
export const getSido = (props : SidoRequestType) => getAPI<SidoRequestType, Sido>(props, '/sido_v2')
66

apps/web/src/new-api/sigungu/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import { SigunguRequestType } from "@animal-project/shared-types";
22
import { getAPI } from "../service";
33
import { Sigungu } from "@animal-project/shared-types";
44

5-
export const getSigungu = (props : SigunguRequestType) => getAPI<SigunguRequestType, Sigungu>(props, '/sigungu')
5+
export const getSigungu = (props : SigunguRequestType) => getAPI<SigunguRequestType, Sigungu>(props, '/sigungu_v2')

apps/web/src/new-site/search/card/AnimalCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const AnimalCard = (props: Props) => {
2323
</motion.div>
2424
</div>
2525
<figure className="px-10 pt-10">
26-
<img src={item.popfile} alt="pet" className="rounded-xl h-32" />
26+
<img src={item.popfile1} alt="pet" className="rounded-xl h-32" />
2727
</figure>
2828
<CardContent className="flex flex-col items-center text-center">
2929
<table className="text-sm">

libs/shared-types/src/lib/responseAPI.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ export interface APIResponse<T> {
5555
noticeNo: string; // 공고번호
5656
noticeSdt: string; // 공고시작일 (YYYYMMDD)
5757
noticeEdt: string; // 공고종료일 (YYYYMMDD)
58-
popfile: string; // Image URL
58+
popfile1: string; // Image URL (v2 API: up to 8 images popfile1..popfile8)
59+
popfile2?: string;
60+
popfile3?: string;
61+
popfile4?: string;
62+
popfile5?: string;
63+
popfile6?: string;
64+
popfile7?: string;
65+
popfile8?: string;
5966
processState: string; // 상태 (예: 보호중)
6067
sexCd: string; // 성별 (M: 수컷, F: 암컷, Q: 미상)
6168
neuterYn: string; // 중성화 여부 (Y: 예, N: 아니오, U: 미상)

0 commit comments

Comments
 (0)