mirror of
https://github.com/ysoftdevs/odc-analyzer.git
synced 2026-03-19 07:44:44 +01:00
Fixed issues not exporting when they disappear
This commit is contained in:
@@ -63,8 +63,14 @@ class VulnerabilityNotificationService @Inject() (protected val dbConfigProvider
|
||||
}
|
||||
|
||||
class ExportPlatform[T, U] private[VulnerabilityNotificationService] (ept: ExportPlatformTables[T, U]) {
|
||||
def changeProjects(ticketId: Int, diff: SetDiff[String], projects: ProjectsWithReports) = db.run(
|
||||
|
||||
def loadUnfinishedTickets(): Future[Seq[(Int, ExportedVulnerability[T])]] = db.run(
|
||||
ept.tickets.filter(_.done === false).result
|
||||
)
|
||||
|
||||
def changeProjects(ticketId: Int, diff: SetDiff[String], projects: ProjectsWithReports): Future[Unit] = db.run(
|
||||
DBIO.seq(
|
||||
ept.tickets.filter(_.id === ticketId).map(_.done).update(diff.newSet.isEmpty),
|
||||
ept.projects.filter(_.exportedVulnerabilityId === ticketId).delete,
|
||||
ept.projects ++= diff.newSet.map(fullId => ExportedVulnerabilityProject(ticketId, fullId)).toSet
|
||||
).transactionally
|
||||
@@ -74,7 +80,7 @@ class VulnerabilityNotificationService @Inject() (protected val dbConfigProvider
|
||||
ept.projects.filter(_.exportedVulnerabilityId inSet ticketsIds).result
|
||||
).map{_.groupBy(_.exportedVulnerabilityId).mapValues(_.map(_.projectFullId).toSet).map(identity).withDefaultValue(Set())}
|
||||
|
||||
def ticketsForVulnerabilities(vulnerabilities: Traversable[String]) = db.run(
|
||||
def ticketsForVulnerabilities(vulnerabilities: Traversable[String]): Future[Map[String, (Int, ExportedVulnerability[T])]] = db.run(
|
||||
ept.tickets.filter(_.vulnerabilityName inSet vulnerabilities).result
|
||||
).map(_.map{ rec =>
|
||||
rec._2.vulnerabilityName -> rec
|
||||
|
||||
Reference in New Issue
Block a user