fix: resolve architecture validation errors and warnings
- Move database operations from API to service layer:
- Add create_pending_scan() method to code_quality_service
- Add get_running_scans() method to code_quality_service
- Update API to use service methods instead of direct db queries
- Replace inline SVG spinner with $icon('spinner', ...) helper
- Add comment documenting custom dropdown exception
Validation now passes with 0 errors.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -229,6 +229,44 @@ class CodeQualityService:
|
||||
"""Get scan by ID"""
|
||||
return db.query(ArchitectureScan).filter(ArchitectureScan.id == scan_id).first()
|
||||
|
||||
def create_pending_scan(
|
||||
self, db: Session, validator_type: str, triggered_by: str
|
||||
) -> ArchitectureScan:
|
||||
"""
|
||||
Create a new scan record with pending status.
|
||||
|
||||
Args:
|
||||
db: Database session
|
||||
validator_type: Type of validator (architecture, security, performance)
|
||||
triggered_by: Who triggered the scan (e.g., "manual:username")
|
||||
|
||||
Returns:
|
||||
The created ArchitectureScan record with ID populated
|
||||
"""
|
||||
scan = ArchitectureScan(
|
||||
timestamp=datetime.now(UTC),
|
||||
validator_type=validator_type,
|
||||
status="pending",
|
||||
triggered_by=triggered_by,
|
||||
)
|
||||
db.add(scan)
|
||||
db.flush() # Get scan.id
|
||||
return scan
|
||||
|
||||
def get_running_scans(self, db: Session) -> list[ArchitectureScan]:
|
||||
"""
|
||||
Get all currently running scans (pending or running status).
|
||||
|
||||
Returns:
|
||||
List of scans with status 'pending' or 'running', newest first
|
||||
"""
|
||||
return (
|
||||
db.query(ArchitectureScan)
|
||||
.filter(ArchitectureScan.status.in_(["pending", "running"]))
|
||||
.order_by(ArchitectureScan.timestamp.desc())
|
||||
.all()
|
||||
)
|
||||
|
||||
def get_scan_history(
|
||||
self, db: Session, limit: int = 30, validator_type: str = None
|
||||
) -> list[ArchitectureScan]:
|
||||
|
||||
Reference in New Issue
Block a user