refactor: JSON data column for findings, code snippets captured and displayed

This commit is contained in:
Marker689
2026-05-09 05:52:10 +03:00
parent e83167a938
commit e577f1944c
11 changed files with 60 additions and 57 deletions

View File

@@ -84,12 +84,13 @@ async def get_package(
if not scans:
return {"detail": "Not found"}
all_findings = []
all_findings: list[dict] = []
for s in scans:
findings = (
(await session.execute(select(Finding).where(Finding.scan_id == s.id))).scalars().all()
)
all_findings.extend(f.__dict__ for f in findings)
for f in findings:
all_findings.append({"id": f.id, **f.data})
return {
"name": scans[0].package_name,
@@ -107,14 +108,5 @@ async def get_package(
}
for s in scans
],
"findings": [
{
"id": f["id"],
"rule": f.get("rule"),
"severity": f.get("severity"),
"message": f.get("message"),
"location": f.get("location"),
}
for f in all_findings
],
"findings": all_findings,
}