Skip to content

Commit

Permalink
#1946 Add countImportedAlert and ignore canceled task in countTask
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Apr 10, 2021
1 parent d34b083 commit 9b29358
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions thehive/app/org/thp/thehive/controllers/v1/AlertCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ class AlertCtrl @Inject() (
(graph, authContext) =>
graph.indexCountQuery(s"""v."_label":Alert AND v.organisationId:${organisationSrv.currentId(graph, authContext).value} AND v.read:false""")
),
Query.init[Long](
"countImportedAlert",
(graph, authContext) =>
graph.indexCountQuery(
s"""v."_label":Alert AND v.organisationId:${organisationSrv.currentId(graph, authContext).value} AND NOT v.caseId:[* TO 'ZZZZZZZZ']"""
)
),
Query[Traversal.V[Alert], Traversal.V[Observable]]("observables", (alertSteps, _) => alertSteps.observables),
Query[Traversal.V[Alert], Traversal.V[Case]]("case", (alertSteps, _) => alertSteps.`case`),
Query.withParam[Option[InputQuery[Traversal.Unk, Traversal.Unk]], Traversal.V[Alert], Traversal[
Expand Down
5 changes: 4 additions & 1 deletion thehive/app/org/thp/thehive/controllers/v1/TaskCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ class TaskCtrl @Inject() (
"countTask",
(inCase, graph, authContext) =>
graph.indexCountQuery(
s"""v."_label":Task AND relatedId:${inCase.caseId.value} AND organisationIds:${organisationSrv.currentId(graph, authContext).value}"""
s"""v."_label":Task AND """ +
"v.relatedId:${inCase.caseId.value} AND " +
"v.organisationIds:${organisationSrv.currentId(graph, authContext).value} AND " +
"NOT v.status:Cancel"
)
),
Query.init[Traversal.V[Task]](
Expand Down

0 comments on commit 9b29358

Please sign in to comment.