- Extract database models from monolithic main.py (2,373 lines) into organized modules - Implement service layer pattern with dedicated business logic classes - Split API endpoints into modular FastAPI routers by functionality - Add centralized configuration management with environment variable handling - Create proper separation of concerns across data, service, and presentation layers **Architecture Changes:** - models/: SQLAlchemy database models (CVE, SigmaRule, RuleTemplate, BulkProcessingJob) - config/: Centralized settings and database configuration - services/: Business logic (CVEService, SigmaRuleService, GitHubExploitAnalyzer) - routers/: Modular API endpoints (cves, sigma_rules, bulk_operations, llm_operations) - schemas/: Pydantic request/response models **Key Improvements:** - 95% reduction in main.py size (2,373 → 120 lines) - Updated 15+ backend files with proper import structure - Eliminated circular dependencies and tight coupling - Enhanced testability with isolated service components - Better code organization for team collaboration **Backward Compatibility:** - All API endpoints maintain same URLs and behavior - Zero breaking changes to existing functionality - Database schema unchanged - Environment variables preserved 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
No EOL
833 B
Python
40 lines
No EOL
833 B
Python
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class BulkSeedRequest(BaseModel):
|
|
start_year: int = 2002
|
|
end_year: Optional[int] = None
|
|
skip_nvd: bool = False
|
|
skip_nomi_sec: bool = True
|
|
|
|
|
|
class NomiSecSyncRequest(BaseModel):
|
|
cve_id: Optional[str] = None
|
|
batch_size: int = 50
|
|
|
|
|
|
class GitHubPoCSyncRequest(BaseModel):
|
|
cve_id: Optional[str] = None
|
|
batch_size: int = 50
|
|
|
|
|
|
class ExploitDBSyncRequest(BaseModel):
|
|
cve_id: Optional[str] = None
|
|
batch_size: int = 30
|
|
|
|
|
|
class CISAKEVSyncRequest(BaseModel):
|
|
cve_id: Optional[str] = None
|
|
batch_size: int = 100
|
|
|
|
|
|
class ReferenceSyncRequest(BaseModel):
|
|
cve_id: Optional[str] = None
|
|
batch_size: int = 30
|
|
max_cves: Optional[int] = None
|
|
force_resync: bool = False
|
|
|
|
|
|
class RuleRegenRequest(BaseModel):
|
|
force: bool = False |