Auction status change and confirmation
This commit is contained in:
@@ -33,9 +33,16 @@ class AuthTokensTable(tag: Tag) extends Table[AuthToken](tag, "auth_tokens") {
|
||||
|
||||
lazy val AuthTokens = TableQuery[AuthTokensTable]
|
||||
|
||||
implicit val auctionStatusColumnType: BaseColumnType[AuctionStatus] =
|
||||
MappedColumnType.base[AuctionStatus, Short](
|
||||
enumValue => enumValue.value,
|
||||
intValue => AuctionStatus.byValue(intValue)
|
||||
)
|
||||
|
||||
class AuctionsTable(tag: Tag) extends Table[Auction](tag, "auctions") {
|
||||
def id = column[Int]("id", O.PrimaryKey, O.AutoInc)
|
||||
def name = column[String]("name")
|
||||
def status = column[AuctionStatus]("status")
|
||||
def gid = column[String]("gid", O.Unique)
|
||||
def authorId = column[Int]("author_id")
|
||||
def startingPrice = column[BigDecimal]("starting_price")
|
||||
@@ -44,7 +51,7 @@ class AuctionsTable(tag: Tag) extends Table[Auction](tag, "auctions") {
|
||||
def currentBidAt = column[Option[Instant]]("current_bid_at")
|
||||
def createdAt = column[Instant]("created_at")
|
||||
|
||||
override def * : ProvenShape[Auction] = (id.?, name, gid, authorId, startingPrice, currentBid, currentBidderId, currentBidAt, createdAt).mapTo[Auction]
|
||||
override def * : ProvenShape[Auction] = (id.?, name, status, gid, authorId, startingPrice, currentBid, currentBidderId, currentBidAt, createdAt).mapTo[Auction]
|
||||
|
||||
def author = foreignKey("users", authorId, Users)(_.id, onDelete = Restrict)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user