Added support for mail digests

This commit is contained in:
Šesták Vít
2016-03-10 16:25:32 +01:00
parent dd99fe8e9b
commit 7b6192593d
12 changed files with 216 additions and 31 deletions

View File

@@ -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)
}

View 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)
}

View File

@@ -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"))
}*/
}