Skip to content

Commit

Permalink
#2059 Replace "filter(where)" by "where"
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jun 14, 2021
1 parent fb1f8b5 commit fc81a2e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.thp.thehive.connector.cortex.controllers.v0

import com.google.inject.name.Named
import org.thp.scalligraph.EntityIdOrName
import org.thp.scalligraph.{EntityIdOrName, NotFoundError}
import org.thp.scalligraph.controllers.{Entrypoint, FFile, FieldsParser}
import org.thp.scalligraph.models.{Database, Entity, UMapping}
import org.thp.scalligraph.query._
Expand Down Expand Up @@ -37,6 +37,9 @@ class AnalyzerTemplateCtrl @Inject() (
analyzerTemplateSrv
.getOrFail(EntityIdOrName(id))
.map(report => Results.Ok(report.content))
.recover {
case _: NotFoundError => Results.NotFound(s"AnalyzerTemplate $id not found")
}
}

def importTemplates: Action[AnyContent] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ class JobSrv @Inject() (
Future
.fromTry {
db.tryTransaction { implicit graph =>
for {
origObs <- get(job).observable.getOrFail("Observable")
obs <- observableSrv.create(artifact.toObservable(job._id, origObs.organisationIds), artifact.data.get)
_ <- addObservable(job, obs.observable)
} yield ()
get(job).observable.getOrFail("Observable").map { origObs =>
observableSrv
.create(artifact.toObservable(job._id, origObs.organisationIds), artifact.data.get)
.foreach(obs => addObservable(job, obs.observable))
}
}
}
}
Expand Down Expand Up @@ -336,7 +336,7 @@ object JobOps {
_.reportObservables
.project(
_.by(_.richObservable)
.by(_.similar.filter(_.`case`.observables.out[ObservableJob].where(P.eq[String](thisJob.name)))._id.fold)
.by(_.similar.where(_.`case`.observables.out[ObservableJob].v[Job].isStep(P.eq[String](thisJob.name)))._id.fold)
)
.fold
)
Expand Down

0 comments on commit fc81a2e

Please sign in to comment.