3가지 검사 모드(한 페이지, 사이트 크롤링, 목록 업로드) 모두에서 접근성 표준을 선택할 수 있도록 추가. WCAG 2.0 A/AA, 2.1 AA, 2.2 AA와 KWCAG 2.1, 2.2를 지원하며, KWCAG 선택 시 axe-core 결과를 KWCAG 검사항목으로 자동 매핑. - KWCAG 2.2 (33항목) / 2.1 (24항목) ↔ WCAG 매핑 테이블 (kwcag_mapping.py) - AccessibilityChecker에 표준 파싱 및 KWCAG 변환 로직 추가 - 전체 API 파이프라인에 accessibility_standard 파라미터 전파 - 프론트엔드 3개 폼에 공용 표준 선택 드롭다운 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
88 lines
2.2 KiB
Python
88 lines
2.2 KiB
Python
"""
|
|
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
|
|
accessibility_standard: str = "wcag_2.1_aa"
|
|
|
|
|
|
# --- 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
|