mirror of
https://github.com/ysoftdevs/odc-analyzer.git
synced 2026-06-17 03:31:19 +02:00
Added support for changelog
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package models
|
||||
|
||||
import java.time.LocalTime
|
||||
|
||||
import models.profile.MappedJdbcType
|
||||
import models.profile.api._
|
||||
import models.jodaSupport._
|
||||
import models.profile.api._
|
||||
import org.joda.time.{DateTime, LocalDate}
|
||||
import play.api.data.Form
|
||||
import slick.lifted.{ProvenShape, Tag}
|
||||
|
||||
|
||||
object Change {
|
||||
abstract sealed class Direction private[Change] (private[Change] val description: String)
|
||||
object Direction{
|
||||
object Added extends Direction("added")
|
||||
object Removed extends Direction("removed")
|
||||
val All = Set(Added, Removed)
|
||||
val ByName = All.map(x => x.description -> x).toMap
|
||||
implicit val TypeMapper = MappedJdbcType.base[Direction, String](_.description, ByName)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
case class Change (time: DateTime, vulnerabilityName: String, projectName: String, direction: Change.Direction)
|
||||
|
||||
class Changes(tag: Tag) extends Table[(Int, Change)](tag, "change"){
|
||||
def id = column[Int]("id", O.PrimaryKey, O.AutoInc)
|
||||
import Change.Direction.TypeMapper
|
||||
def time = column[DateTime]("time")
|
||||
def vulnerabilityName = column[String]("vulnerability_name")
|
||||
def projectName = column[String]("project_name")
|
||||
def direction = column[Change.Direction]("direction")
|
||||
|
||||
def base = (time, vulnerabilityName, projectName, direction) <> ((Change.apply _).tupled, Change.unapply)
|
||||
override def * = (id, base)
|
||||
}
|
||||
Reference in New Issue
Block a user