diff --git a/misp/client/src/main/scala/org/thp/misp/dto/Attribute.scala b/misp/client/src/main/scala/org/thp/misp/dto/Attribute.scala index cf47db5544..6f8c0684a3 100644 --- a/misp/client/src/main/scala/org/thp/misp/dto/Attribute.scala +++ b/misp/client/src/main/scala/org/thp/misp/dto/Attribute.scala @@ -5,8 +5,6 @@ import akka.util.ByteString import play.api.libs.functional.syntax._ import play.api.libs.json.{JsPath, Json, OWrites, Reads} -import java.time.OffsetDateTime -import java.time.format.{DateTimeFormatter, DateTimeFormatterBuilder} import java.util.{Base64, Date} case class Attribute( diff --git a/misp/connector/src/test/scala/org/thp/thehive/connector/misp/services/MispImportSrvTest.scala b/misp/connector/src/test/scala/org/thp/thehive/connector/misp/services/MispImportSrvTest.scala index 4d115ca0d9..dbffbe8c63 100644 --- a/misp/connector/src/test/scala/org/thp/thehive/connector/misp/services/MispImportSrvTest.scala +++ b/misp/connector/src/test/scala/org/thp/thehive/connector/misp/services/MispImportSrvTest.scala @@ -6,12 +6,11 @@ import org.thp.misp.dto.{Event, Organisation, Tag, User} import org.thp.scalligraph.auth.AuthContext import org.thp.scalligraph.models.{Database, DummyUserSrv} import org.thp.scalligraph.traversal.TraversalOps._ -import org.thp.scalligraph.{AppBuilder, EntityId, EntityName} +import org.thp.scalligraph.{AppBuilder, EntityId} import org.thp.thehive.TestAppBuilder import org.thp.thehive.models.{Alert, Permissions} import org.thp.thehive.services.AlertOps._ import org.thp.thehive.services.ObservableOps._ -import org.thp.thehive.services.OrganisationOps._ import org.thp.thehive.services.{AlertSrv, OrganisationSrv} import play.api.test.PlaySpecification diff --git a/thehive/app/org/thp/thehive/controllers/v1/AlertRenderer.scala b/thehive/app/org/thp/thehive/controllers/v1/AlertRenderer.scala index 6c50e51912..0776e9f960 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/AlertRenderer.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/AlertRenderer.scala @@ -9,6 +9,7 @@ import org.thp.thehive.services.AlertOps._ import org.thp.thehive.services.OrganisationSrv import play.api.libs.json._ +import java.lang.{Integer => JInt} import java.util.{Date, List => JList, Map => JMap} trait AlertRenderer extends BaseRenderer[Alert] { @@ -43,6 +44,9 @@ trait AlertRenderer extends BaseRenderer[Alert] { def importDate: Traversal.V[Alert] => Traversal[JsValue, JList[Date], Converter[JsValue, JList[Date]]] = _.importDate.fold.domainMap(_.headOption.fold[JsValue](JsNull)(d => JsNumber(d.getTime))) + def caseNumber: Traversal.V[Alert] => Traversal[JsValue, JList[JInt], Converter[JsValue, JList[JInt]]] = + _.`case`.value(_.number).option.domainMap(_.fold[JsValue](JsNull)(JsNumber(_))) + def alertStatsRenderer(organisationSrv: OrganisationSrv, extraData: Set[String])(implicit authContext: AuthContext ): Traversal.V[Alert] => JsTraversal = { implicit traversal => @@ -52,6 +56,7 @@ trait AlertRenderer extends BaseRenderer[Alert] { { case (f, "similarCases") => addData("similarCases", f)(similarCasesStats(organisationSrv)) case (f, "importDate") => addData("importDate", f)(importDate) + case (f, "caseNumber") => addData("caseNumber", f)(caseNumber) case (f, _) => f } ) diff --git a/thehive/app/org/thp/thehive/controllers/v1/Properties.scala b/thehive/app/org/thp/thehive/controllers/v1/Properties.scala index 1284e3a45a..a262ff3bf0 100644 --- a/thehive/app/org/thp/thehive/controllers/v1/Properties.scala +++ b/thehive/app/org/thp/thehive/controllers/v1/Properties.scala @@ -17,7 +17,6 @@ import org.thp.thehive.services.CustomFieldOps._ import org.thp.thehive.services.DashboardOps._ import org.thp.thehive.services.LogOps._ import org.thp.thehive.services.ObservableOps._ -import org.thp.thehive.services.OrganisationOps._ import org.thp.thehive.services.PatternOps._ import org.thp.thehive.services.ProcedureOps._ import org.thp.thehive.services.ShareOps._