feat(supporters): 회복 일정 플래너에 한국관광공사 TourAPI 데이터 합침 + 옛 주소 리다이렉트 + 404 페이지

- src/lib/tour.ts: 사전 수집 JSON(medicalTourismKo/medicalTourism)을 추천 후보로 변환. 관광지·문화시설→관광, 쇼핑, 음식점(일반식 단계에서만), 숙박→숙소. 사우나·스파는 회복기 금지라 제외. 거리로 외출 등급(600m·3km)
- 큐레이션(places.json) 1순위, TourAPI 2순위 가점. 타임라인 추천에 이동 시간 라벨과 '관광공사' 표시
- 체류 기간과 겹치는 행사 섹션(가까운 순 6곳, 자유 외출 단계 도달일 표시), 자유 외출(L3) 날에 행사 1건 추가
- 숙소 그리드에 TourAPI 숙박 가까운 순 6곳 추가(예약 검색은 영문 이름으로)
- scripts/fetch_medical_tourism.py: Productize 브랜치의 수집 스크립트 가져옴(화면 경로 주석 갱신)
- vercel.json: /recovery·/stay·/en/recovery·/en/stay → /plan·/en/plan 영구 리다이렉트. src/pages/404.astro 사이트 스타일 404
- 테스트 14건(어댑터·우선순위·유동식 제외·축제)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Fable 5.1 committed 2026-09-11 11:01:32 +09:00
1 parent f9e91d3305
commit 83b8343262
11 files changed
+6982 -21

No files matched your search

+28
View File
@@ -2,10 +2,12 @@
import { readFileSync } from 'node:fs';
import assert from 'node:assert/strict';
import { buildPlan, addDays, decodeHash, encodeHash, bookingUrl, googleFlightsUrl, buildIcs } from '../../src/lib/plan.ts';
import { tourToPlaces, festivalsDuring, levelByDistance, bookingName } from '../../src/lib/tour.ts';
const here = (p) => new URL(p, import.meta.url);
const P = JSON.parse(readFileSync(here('../../src/data/procedures.json'), 'utf8'));
const PL = JSON.parse(readFileSync(here('../../src/data/places.json'), 'utf8'));
const TKO = JSON.parse(readFileSync(here('../../src/data/medicalTourismKo.json'), 'utf8'));
const byId = (id) => P.procedures.find((x) => x.id === id);
const nat = (code) => P.nationalities.list.find((x) => x.code === code);
@@ -95,4 +97,30 @@ ok('규칙표 정합성: 숫자마다 status, provisional 은 source 없어도
for (const pl of PL.places) { assert.ok(PL.categories[pl.category], `${pl.id} 카테고리`); assert.ok(pl.name.ko && pl.name.en, `${pl.id} 이름`); }
});
ok('TourAPI 어댑터: 카테고리 매핑, 사우나 제외, 음식점은 일반식만, 거리 등급', () => {
const tp = tourToPlaces(TKO, 'ko');
assert.ok(tp.length > 100, `변환 ${tp.length}건`);
assert.ok(tp.every((p) => p.source === 'tourapi'));
assert.ok(!tp.some((p) => p.id.startsWith('tour-wellness-')), '사우나·스파가 후보에 들어감');
assert.ok(tp.filter((p) => p.category === 'food').every((p) => p.dietOk.length === 1 && p.dietOk[0] === 'normal'));
assert.equal(levelByDistance(400), 1); assert.equal(levelByDistance(2500), 2); assert.equal(levelByDistance(9000), 3);
assert.equal(bookingName('K-그랜드 호스텔 강남 1(K-GRAND HOSTEL GANGNAM1)'), 'K-GRAND HOSTEL GANGNAM1');
});
ok('큐레이션이 TourAPI 보다 먼저 나오고 유동식 단계에는 TourAPI 음식점이 없음', () => {
const tp = tourToPlaces(TKO, 'ko');
const all = [...PL.places.map((x) => ({ ...x, source: 'curated' })), ...tp];
const plan = buildPlan({ procedure: byId('contour'), surgeryDate: '2026-11-03', nationality: null, prefs: ['food'] }, all);
for (const d of plan.days.filter((d) => d.diet === 'liquid')) for (const p of d.picks) assert.ok(!(p.source === 'tourapi' && p.category === 'food'), `${d.date} ${p.id}`);
const first = plan.days.find((d) => d.picks.length);
assert.equal(first.picks[0].source, 'curated');
});
ok('축제: 체류 기간과 겹치는 것만, L3 날에만 붙음', () => {
const fest = festivalsDuring(TKO, '2026-11-01', '2026-11-17');
for (const f of fest) assert.ok(f.start <= '2026-11-17' && f.end >= '2026-11-01');
const plan = buildPlan({ procedure: byId('skin'), surgeryDate: '2026-11-03', nationality: null, prefs: [], festivals: fest }, PL.places);
for (const d of plan.days) if (d.festivals.length) assert.ok(d.level >= 3, `${d.date} L${d.level}`);
});
console.log(`plan.test: ${n}건 통과`);