feat: 3-mode inspection with tabbed UI + batch upload
- Add batch inspection backend (multipart upload, SSE streaming, MongoDB) - Add tabbed UI (single page / site crawling / batch upload) on home and history pages - Add batch inspection progress, result pages with 2-panel layout - Rename "사이트 전체" to "사이트 크롤링" across codebase - Add python-multipart dependency for file upload - Consolidate nginx SSE location for all inspection types Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
86
backend/app/models/batch_schemas.py
Normal file
86
backend/app/models/batch_schemas.py
Normal file
@ -0,0 +1,86 @@
|
||||
"""
|
||||
Pydantic models for batch inspection request/response validation.
|
||||
|
||||
Batch inspection allows inspecting multiple URLs from a file upload
|
||||
without any crawling phase - URLs are inspected directly.
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
|
||||
from app.models.site_schemas import AggregateScores, PageStatus
|
||||
|
||||
|
||||
# --- Enums ---
|
||||
|
||||
class BatchInspectionStatus(str, Enum):
|
||||
"""Batch inspection status (no crawling phase)."""
|
||||
INSPECTING = "inspecting"
|
||||
COMPLETED = "completed"
|
||||
ERROR = "error"
|
||||
|
||||
|
||||
# --- Core Data Models ---
|
||||
|
||||
class BatchPage(BaseModel):
|
||||
"""배치 검사 개별 페이지 (크롤링 없이 직접 지정된 URL)."""
|
||||
url: str
|
||||
depth: int = 0
|
||||
parent_url: Optional[str] = None
|
||||
inspection_id: Optional[str] = None
|
||||
status: PageStatus = PageStatus.PENDING
|
||||
title: Optional[str] = None
|
||||
overall_score: Optional[int] = None
|
||||
grade: Optional[str] = None
|
||||
|
||||
|
||||
class BatchInspectionConfig(BaseModel):
|
||||
"""배치 검사 설정."""
|
||||
concurrency: int = 4
|
||||
|
||||
|
||||
# --- Response Models ---
|
||||
|
||||
class StartBatchInspectionResponse(BaseModel):
|
||||
"""배치 검사 시작 응답."""
|
||||
batch_inspection_id: str
|
||||
status: str = "inspecting"
|
||||
name: str
|
||||
total_urls: int
|
||||
stream_url: str
|
||||
|
||||
|
||||
class BatchInspectionResult(BaseModel):
|
||||
"""배치 검사 전체 결과."""
|
||||
batch_inspection_id: str
|
||||
name: str
|
||||
status: BatchInspectionStatus
|
||||
created_at: datetime
|
||||
completed_at: Optional[datetime] = None
|
||||
config: BatchInspectionConfig
|
||||
source_urls: list[str] = []
|
||||
discovered_pages: list[BatchPage] = []
|
||||
aggregate_scores: Optional[AggregateScores] = None
|
||||
|
||||
|
||||
class BatchInspectionListItem(BaseModel):
|
||||
"""배치 검사 목록 항목 (요약)."""
|
||||
batch_inspection_id: str
|
||||
name: str
|
||||
status: BatchInspectionStatus
|
||||
created_at: datetime
|
||||
total_urls: int = 0
|
||||
pages_inspected: int = 0
|
||||
overall_score: Optional[int] = None
|
||||
grade: Optional[str] = None
|
||||
|
||||
|
||||
class BatchInspectionPaginatedResponse(BaseModel):
|
||||
"""배치 검사 목록 페이지네이션 응답."""
|
||||
items: list[BatchInspectionListItem]
|
||||
total: int
|
||||
page: int
|
||||
limit: int
|
||||
total_pages: int
|
||||
Reference in New Issue
Block a user