mirror of
https://github.com/ysoftdevs/odc-analyzer.git
synced 2026-05-02 05:14:22 +02:00
Added support for mail digests
This commit is contained in:
@@ -23,7 +23,7 @@ object Change {
|
||||
|
||||
}
|
||||
|
||||
case class Change (time: DateTime, vulnerabilityName: String, projectName: String, direction: Change.Direction)
|
||||
case class Change (time: DateTime, vulnerabilityName: String, projectName: String, direction: Change.Direction, notifiedToSomebody: Boolean)
|
||||
|
||||
class Changes(tag: Tag) extends Table[(Int, Change)](tag, "change"){
|
||||
def id = column[Int]("id", O.PrimaryKey, O.AutoInc)
|
||||
@@ -32,7 +32,8 @@ class Changes(tag: Tag) extends Table[(Int, Change)](tag, "change"){
|
||||
def vulnerabilityName = column[String]("vulnerability_name")
|
||||
def projectName = column[String]("project_name")
|
||||
def direction = column[Change.Direction]("direction")
|
||||
def notifiedToSomebody = column[Boolean]("notified_to_somebody")
|
||||
|
||||
def base = (time, vulnerabilityName, projectName, direction) <> ((Change.apply _).tupled, Change.unapply)
|
||||
def base = (time, vulnerabilityName, projectName, direction, notifiedToSomebody) <> ((Change.apply _).tupled, Change.unapply)
|
||||
override def * = (id, base)
|
||||
}
|
||||
15
app/models/NotificationDigestStatus.scala
Normal file
15
app/models/NotificationDigestStatus.scala
Normal file
@@ -0,0 +1,15 @@
|
||||
package models
|
||||
|
||||
import com.mohiva.play.silhouette.api.LoginInfo
|
||||
import models.profile.api._
|
||||
import slick.lifted.Tag
|
||||
|
||||
case class NotificationDigestStatus(user: LoginInfo, lastChangelogIdOption: Option[Int])
|
||||
|
||||
|
||||
class NotificationDigestStatuses(tag: Tag) extends Table[NotificationDigestStatus](tag, "notification_digest_status"){
|
||||
val user = new LoginInfoColumns("user", this)
|
||||
def lastChangelogId = column[Int]("last_changelog_id").?
|
||||
def * = (user(), lastChangelogId) <> (NotificationDigestStatus.tupled, NotificationDigestStatus.unapply)
|
||||
def idx = index("notification_digest_status_user_idx", user(), unique = true)
|
||||
}
|
||||
@@ -21,6 +21,7 @@ package object models {
|
||||
val authTokens = TableQuery[CookieAuthenticators]
|
||||
val vulnerabilitySubscriptions = TableQuery[VulnerabilitySubscriptions]
|
||||
val changelog = TableQuery[Changes]
|
||||
val notificationDigestStatuses = TableQuery[NotificationDigestStatuses]
|
||||
|
||||
val issueTrackerExportTables = new ExportPlatformTables[String, (String, String, Int)](){
|
||||
val tableNamePart = "issue_tracker"
|
||||
@@ -64,7 +65,7 @@ package object models {
|
||||
/*{
|
||||
import profile.SchemaDescription
|
||||
val schema = Seq[Any{def schema: SchemaDescription}](
|
||||
diffDbExportTables, changelog
|
||||
notificationDigestStatuses
|
||||
).map(_.schema).foldLeft(profile.DDL(Seq(), Seq()))(_ ++ _)
|
||||
|
||||
val sql = Seq(
|
||||
@@ -75,7 +76,7 @@ package object models {
|
||||
schema.dropStatements.toSeq.map(_+";").mkString("\n").dropWhile(_ == "\n"),
|
||||
"\n"
|
||||
).mkString("\n")
|
||||
Files.write(Paths.get("conf/evolutions/default/7.sql"), sql.getBytes("utf-8"))
|
||||
Files.write(Paths.get("conf/evolutions/default/8.sql"), sql.getBytes("utf-8"))
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user