snp-global/frontend/src/api/screeningGuideApi.ts
HYOJIN b2b268f1e5 chore: 프로젝트 초기 설정 및 팀 워크플로우 구성
- Spring Boot 3.2.1 + React 19 프로젝트 구조
- S&P Global Maritime API Bypass 및 Risk & Compliance Screening 기능
- 팀 워크플로우 v1.6.1 적용 (settings.json, hooks, workflow-version)
- 프론트엔드 빌드 (Vite + TypeScript + Tailwind CSS)
- 메인 카드 레이아웃 CSS Grid 전환

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 15:42:23 +09:00

150 lines
4.8 KiB
TypeScript

// API 응답 타입
interface ApiResponse<T> {
success: boolean;
message: string;
data: T;
}
// Risk 지표 타입
export interface RiskIndicatorResponse {
indicatorId: number;
fieldKey: string;
fieldName: string;
description: string;
conditionRed: string;
conditionAmber: string;
conditionGreen: string;
dataType: string;
}
export interface RiskCategoryResponse {
categoryCode: string;
categoryName: string;
indicators: RiskIndicatorResponse[];
}
// Compliance 지표 타입
export interface ComplianceIndicatorResponse {
indicatorId: number;
fieldKey: string;
fieldName: string;
description: string;
conditionRed: string;
conditionAmber: string;
conditionGreen: string;
dataType: string;
}
export interface ComplianceCategoryResponse {
categoryCode: string;
categoryName: string;
indicatorType: string;
indicators: ComplianceIndicatorResponse[];
}
// 방법론 변경 이력 타입
export interface MethodologyHistoryResponse {
historyId: number;
changeDate: string;
changeTypeCode: string;
changeType: string;
description: string;
}
// 값 변경 이력 타입
export interface ChangeHistoryResponse {
rowIndex: number;
searchKey: string;
lastModifiedDate: string;
changedColumnName: string;
beforeValue: string;
afterValue: string;
fieldName: string;
narrative: string;
prevNarrative: string;
sortOrder: number;
}
// 선박 기본 정보
export interface ShipInfoResponse {
imoNo: string;
shipName: string;
shipStatus: string;
nationalityCode: string;
nationalityIsoCode: string | null;
nationality: string;
shipType: string;
dwt: string;
gt: string;
buildYear: string;
mmsiNo: string;
callSign: string;
shipTypeGroup: string;
}
// 회사 기본 정보
export interface CompanyInfoResponse {
companyCode: string;
fullName: string;
abbreviation: string;
status: string;
parentCompanyCode: string | null;
parentCompanyName: string | null;
registrationCountry: string;
registrationCountryCode: string;
registrationCountryIsoCode: string | null;
controlCountry: string | null;
controlCountryCode: string | null;
controlCountryIsoCode: string | null;
foundedDate: string | null;
email: string | null;
phone: string | null;
website: string | null;
}
// 지표 현재 상태
export interface IndicatorStatusResponse {
columnName: string;
fieldName: string;
categoryCode: string;
category: string;
value: string | null;
narrative: string | null;
sortOrder: number;
}
const BASE = '/snp-global/api/screening-guide';
async function fetchJson<T>(url: string): Promise<T> {
const res = await fetch(url);
if (!res.ok) throw new Error(`API Error: ${res.status}`);
return res.json();
}
export const screeningGuideApi = {
getRiskIndicators: (lang = 'KO') =>
fetchJson<ApiResponse<RiskCategoryResponse[]>>(`${BASE}/risk-indicators?lang=${lang}`),
getComplianceIndicators: (lang = 'KO', type = 'SHIP') =>
fetchJson<ApiResponse<ComplianceCategoryResponse[]>>(`${BASE}/compliance-indicators?lang=${lang}&type=${type}`),
getMethodologyHistory: (lang = 'KO') =>
fetchJson<ApiResponse<MethodologyHistoryResponse[]>>(`${BASE}/methodology-history?lang=${lang}`),
getMethodologyBanner: (lang = 'KO') =>
fetchJson<ApiResponse<MethodologyHistoryResponse>>(`${BASE}/methodology-banner?lang=${lang}`),
getShipRiskHistory: (imoNo: string, lang = 'KO') =>
fetchJson<ApiResponse<ChangeHistoryResponse[]>>(`${BASE}/history/ship-risk?imoNo=${imoNo}&lang=${lang}`),
getShipComplianceHistory: (imoNo: string, lang = 'KO') =>
fetchJson<ApiResponse<ChangeHistoryResponse[]>>(`${BASE}/history/ship-compliance?imoNo=${imoNo}&lang=${lang}`),
getCompanyComplianceHistory: (companyCode: string, lang = 'KO') =>
fetchJson<ApiResponse<ChangeHistoryResponse[]>>(`${BASE}/history/company-compliance?companyCode=${companyCode}&lang=${lang}`),
getShipInfo: (imoNo: string) =>
fetchJson<ApiResponse<ShipInfoResponse>>(`${BASE}/ship-info?imoNo=${imoNo}`),
getShipRiskStatus: (imoNo: string, lang = 'KO') =>
fetchJson<ApiResponse<IndicatorStatusResponse[]>>(`${BASE}/ship-risk-status?imoNo=${imoNo}&lang=${lang}`),
getShipComplianceStatus: (imoNo: string, lang = 'KO') =>
fetchJson<ApiResponse<IndicatorStatusResponse[]>>(`${BASE}/ship-compliance-status?imoNo=${imoNo}&lang=${lang}`),
getCompanyInfo: (companyCode: string) =>
fetchJson<ApiResponse<CompanyInfoResponse>>(`${BASE}/company-info?companyCode=${companyCode}`),
getCompanyComplianceStatus: (companyCode: string, lang = 'KO') =>
fetchJson<ApiResponse<IndicatorStatusResponse[]>>(`${BASE}/company-compliance-status?companyCode=${companyCode}&lang=${lang}`),
};