- (visitor) route group, visitor lib, tickets wallet - CongestionPill + LiveNoticeFeed components - login/tickets screens, i18n 4 locales, wordmark assets, splash Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
/*
|
|
* 관람객(B2C) API 배선 — 공개 혼잡/주차/공지 + 인증 주차권.
|
|
* 계약: _workspace/parking_congestion_contract.md · src/backend/_workspace/cms_backlog_contract.md.
|
|
* 봉투 언랩·인증 헤더는 lib/api.ts가 처리. 공개 조회는 anonymous(토큰 미첨부).
|
|
* 주차권 구매/조회는 인증(JWT). PII(차량번호)는 서버가 마스킹해 반환 — 원문 미저장.
|
|
*/
|
|
import { api } from './api';
|
|
import type {
|
|
CongestionOverviewDto,
|
|
LiveNoticeDto,
|
|
MyPassesDto,
|
|
ParkingLotStatusDto,
|
|
ParkingPassDto,
|
|
PurchasePassRequest,
|
|
} from './types';
|
|
|
|
/** 주차 현황 — 공개(비로그인). eventId는 선택. */
|
|
export function getParkingLots(eventId?: string): Promise<ParkingLotStatusDto[]> {
|
|
const q = eventId ? `?eventId=${encodeURIComponent(eventId)}` : '';
|
|
return api.get<ParkingLotStatusDto[]>(`/api/public/parking/lots${q}`, { anonymous: true });
|
|
}
|
|
|
|
/** 혼잡 요약 — 공개. eventId 필수. */
|
|
export function getCongestion(eventId: string): Promise<CongestionOverviewDto> {
|
|
return api.get<CongestionOverviewDto>(
|
|
`/api/public/congestion?eventId=${encodeURIComponent(eventId)}`,
|
|
{ anonymous: true },
|
|
);
|
|
}
|
|
|
|
/** 라이브 공지 — 공개. 게시(pinned 우선→최신) 건만. */
|
|
export function getLiveNotices(eventId: string, limit = 100): Promise<LiveNoticeDto[]> {
|
|
return api.get<LiveNoticeDto[]>(
|
|
`/api/public/events/${encodeURIComponent(eventId)}/live-notices?limit=${limit}`,
|
|
{ anonymous: true },
|
|
);
|
|
}
|
|
|
|
/** 사전 주차권 구매(mock 결제) — 인증. 구매자 = JWT 주체. */
|
|
export function purchaseParkingPass(req: PurchasePassRequest): Promise<ParkingPassDto> {
|
|
return api.post<ParkingPassDto>('/api/parking/passes', req);
|
|
}
|
|
|
|
/** 내 주차권 조회 — 인증(본인 소유분만). */
|
|
export function getMyParkingPasses(): Promise<MyPassesDto> {
|
|
return api.get<MyPassesDto>('/api/parking/passes/me');
|
|
}
|