Skip to content

Commit

Permalink
#1238 Make alert date optional
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Mar 3, 2020
1 parent 9d635d5 commit 722cdd0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dto/src/main/scala/org/thp/thehive/dto/v0/Alert.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ case class InputAlert(
title: String,
description: String,
severity: Option[Int] = None,
date: Date = new Date,
date: Option[Date] = None,
tags: Set[String] = Set.empty,
flag: Option[Boolean] = None,
tlp: Option[Int] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ object Conversion {
.withFieldComputed(_.severity, _.severity.getOrElse(2))
.withFieldComputed(_.tlp, _.tlp.getOrElse(2))
.withFieldComputed(_.pap, _.pap.getOrElse(2))
.withFieldComputed(_.date, _.date.getOrElse(new Date))
.withFieldConst(_.read, false)
.withFieldConst(_.lastSyncDate, new Date)
.withFieldConst(_.follow, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class AlertCtrlTest extends PlaySpecification with TestAppBuilder {
title = "alert title (create alert test)",
description = "alert description (create alert test)",
severity = Some(2),
date = now,
date = Some(now),
tags = Set("tag1", "tag2"),
flag = Some(false),
tlp = Some(1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AlertCreatedTest extends PlaySpecification with TestAppBuilder {
title = "alert title (create alert test)",
description = "alert description (create alert test)",
severity = Some(2),
date = new Date(),
date = Some(new Date()),
tags = Set("tag1", "tag2"),
flag = Some(false),
tlp = Some(1),
Expand Down

0 comments on commit 722cdd0

Please sign in to comment.