2026-05-04 09:03:09 +05:30
|
|
|
from datetime import datetime
|
2026-04-25 19:27:06 +05:30
|
|
|
from pydantic import BaseModel, HttpUrl
|
|
|
|
|
from typing import List, Optional, Dict, Any
|
|
|
|
|
|
|
|
|
|
class CodeScanRequest(BaseModel):
|
|
|
|
|
repo_url: str
|
|
|
|
|
github_token: str
|
|
|
|
|
# branch or commit hash optional
|
|
|
|
|
branch: Optional[str] = "main"
|
|
|
|
|
|
|
|
|
|
class VulnerabilityIssue(BaseModel):
|
|
|
|
|
file_path: str
|
|
|
|
|
severity: str # High, Medium, Low, Critical
|
|
|
|
|
issue: str
|
|
|
|
|
explanation: str
|
|
|
|
|
suggested_fix: Optional[str] = None
|
|
|
|
|
line_number: Optional[int] = None
|
|
|
|
|
|
|
|
|
|
class CodeScanResponse(BaseModel):
|
|
|
|
|
scan_id: str
|
|
|
|
|
repo_url: str
|
|
|
|
|
summary: str
|
|
|
|
|
issues: List[VulnerabilityIssue]
|
2026-05-04 09:03:09 +05:30
|
|
|
created_at: Optional[datetime] = None
|
2026-04-25 19:27:06 +05:30
|
|
|
|
2026-06-12 19:10:58 +05:30
|
|
|
class CodeScanSyncRequest(BaseModel):
|
|
|
|
|
repo_url: str
|
|
|
|
|
summary: str
|
|
|
|
|
issues: List[VulnerabilityIssue]
|
|
|
|
|
|
2026-04-25 19:27:06 +05:30
|
|
|
class CodeChatRequest(BaseModel):
|
|
|
|
|
scan_id: str
|
|
|
|
|
message: str
|
|
|
|
|
|
|
|
|
|
class CodeChatResponse(BaseModel):
|
|
|
|
|
reply: str
|
2026-05-04 09:03:09 +05:30
|
|
|
|
|
|
|
|
class CodeScanHistoryItem(BaseModel):
|
|
|
|
|
id: str
|
|
|
|
|
repo_url: str
|
|
|
|
|
created_at: datetime
|
|
|
|
|
|
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
|
|
|
|
class CodeScanHistoryResponse(BaseModel):
|
|
|
|
|
scans: List[CodeScanHistoryItem]
|
|
|
|
|
total: int
|
|
|
|
|
page: int
|
|
|
|
|
per_page: int
|