From 7d386ec91dad6e2487946f6993d35418408dc50c Mon Sep 17 00:00:00 2001 From: Grzegorz Siewruk Date: Fri, 7 Jun 2024 13:04:15 +0200 Subject: [PATCH] fixes in asset api --- .../mixeway/api/project/service/OperateOnAssetsService.java | 4 ++-- src/main/java/io/mixeway/db/entity/CodeProject.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/mixeway/api/project/service/OperateOnAssetsService.java b/src/main/java/io/mixeway/api/project/service/OperateOnAssetsService.java index 776d7d7c..b5a43a49 100644 --- a/src/main/java/io/mixeway/api/project/service/OperateOnAssetsService.java +++ b/src/main/java/io/mixeway/api/project/service/OperateOnAssetsService.java @@ -173,7 +173,7 @@ public List getAssetsForProject(Project project) { long low = waVulns.stream() .filter(cv -> cv.getSeverity().equals(Constants.VULN_CRITICALITY_LOW)) .count(); - projectAssetModels.add(new ProjectAssetModel().convertWebApp(wa, (int) crit, (int) medium, (int) low, false)); + projectAssetModels.add(new ProjectAssetModel().convertWebApp(wa, (int) crit, (int) medium, (int) low, (crit + medium + low) > 0)); }); findInterfaceService.findByAssetIn(new ArrayList<>(project.getAssets())).forEach(intf -> { @@ -188,7 +188,7 @@ public List getAssetsForProject(Project project) { long low = iVulns.stream() .filter(cv -> cv.getSeverity().equals(Constants.VULN_CRITICALITY_LOW)) .count(); - projectAssetModels.add(new ProjectAssetModel().convertInterface(intf, (int) crit, (int) medium, (int) low, false)); + projectAssetModels.add(new ProjectAssetModel().convertInterface(intf, (int) crit, (int) medium, (int) low, (crit + medium + low) > 0)); }); return projectAssetModels; } diff --git a/src/main/java/io/mixeway/db/entity/CodeProject.java b/src/main/java/io/mixeway/db/entity/CodeProject.java index 83a906e2..de6d8987 100755 --- a/src/main/java/io/mixeway/db/entity/CodeProject.java +++ b/src/main/java/io/mixeway/db/entity/CodeProject.java @@ -375,7 +375,7 @@ public void setVulns(Set vulns) { this.vulns = vulns; } - @ManyToOne(fetch = FetchType.LAZY, optional = true) + @ManyToOne(fetch = FetchType.EAGER, optional = true) @JoinColumn(name = "parent_id", nullable = true) @OnDelete(action = OnDeleteAction.CASCADE) public CodeProject getParent() {