refactor: JSON data column for findings, code snippets captured and displayed
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user