feat: 사이트 전체 검사 기능 추가
도메인 하위 링크를 BFS로 자동 크롤링하여 페이지별 검사 수행. - BFS 링크 크롤러 (같은 도메인 필터링, max_pages/max_depth 설정) - 사이트 검사 오케스트레이션 (크롤링→순차 검사→집계) - SSE 실시간 진행 상태 (크롤링/검사/완료) - 페이지 트리 + 집계 결과 UI - UrlInputForm에 "사이트 전체 검사" 버튼 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@ -7,6 +7,11 @@ import type {
|
||||
HistoryParams,
|
||||
TrendResponse,
|
||||
} from "@/types/inspection";
|
||||
import type {
|
||||
StartSiteInspectionResponse,
|
||||
SiteInspectionResult,
|
||||
InspectPageResponse,
|
||||
} from "@/types/site-inspection";
|
||||
|
||||
const API_BASE_URL =
|
||||
process.env.NEXT_PUBLIC_API_URL ?? "";
|
||||
@ -143,6 +148,50 @@ class ApiClient {
|
||||
getStreamUrl(inspectionId: string): string {
|
||||
return `${this.baseUrl}/api/inspections/${inspectionId}/stream`;
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────
|
||||
// 사이트 전체 검사 API
|
||||
// ─────────────────────────────────────────────────────
|
||||
|
||||
/** 사이트 전체 검사 시작 */
|
||||
async startSiteInspection(
|
||||
url: string,
|
||||
maxPages?: number,
|
||||
maxDepth?: number
|
||||
): Promise<StartSiteInspectionResponse> {
|
||||
return this.request("/api/site-inspections", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
url,
|
||||
max_pages: maxPages,
|
||||
max_depth: maxDepth,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 사이트 검사 결과 조회 */
|
||||
async getSiteInspection(id: string): Promise<SiteInspectionResult> {
|
||||
return this.request(`/api/site-inspections/${id}`);
|
||||
}
|
||||
|
||||
/** 특정 페이지 수동 검사 */
|
||||
async inspectPage(
|
||||
siteInspectionId: string,
|
||||
pageUrl: string
|
||||
): Promise<InspectPageResponse> {
|
||||
return this.request(
|
||||
`/api/site-inspections/${siteInspectionId}/inspect-page`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({ url: pageUrl }),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/** 사이트 검사 SSE 스트림 URL 반환 */
|
||||
getSiteStreamUrl(siteInspectionId: string): string {
|
||||
return `${this.baseUrl}/api/site-inspections/${siteInspectionId}/stream`;
|
||||
}
|
||||
}
|
||||
|
||||
export const api = new ApiClient(API_BASE_URL);
|
||||
|
||||
Reference in New Issue
Block a user