aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorPacien TRAN-GIRARD2015-02-08 20:06:39 +0100
committerPacien TRAN-GIRARD2015-02-08 20:06:39 +0100
commit4496e089bca542fc98bfad0e005469211e7cbc1e (patch)
tree8e8473f34d339468eaceb42cee97a9db7f60770e /app
parentc00cb6ae05f548f7ae270a93ad44f57207380406 (diff)
downloadminibay-4496e089bca542fc98bfad0e005469211e7cbc1e.tar.gz
Implement current sales listing
Diffstat (limited to 'app')
-rw-r--r--app/controllers/Sale.scala37
-rw-r--r--app/models/Views.scala12
2 files changed, 46 insertions, 3 deletions
diff --git a/app/controllers/Sale.scala b/app/controllers/Sale.scala
new file mode 100644
index 0000000..b5e4622
--- /dev/null
+++ b/app/controllers/Sale.scala
@@ -0,0 +1,37 @@
1package controllers
2
3import play.api._
4import play.api.data._
5import play.api.data.Forms._
6import play.api.mvc._
7
8import play.api.db.slick._
9import play.api.db.slick.Config.driver.simple._
10import play.api.Play.current
11
12import scala.concurrent.Future
13
14import models._
15
16
17object Sale extends Controller {
18
19 def sales = Auth { implicit request =>
20 DB.withSession { implicit session =>
21 val currentDateTime = new java.sql.Timestamp((new java.util.Date).getTime)
22 val sales = Views.Sales.filter(_.endDate > currentDateTime).sortBy(_.endDate.asc).run
23
24 Ok(views.html.pages.sales.currentSales(sales))
25 }
26 }
27
28 def sell(itemUuid: String) = TODO
29
30
31 def item(itemUuid: String) = TODO
32
33 def bids(itemUuid: String) = TODO
34
35 def bidSubmit(itemUuid: String) = TODO
36
37}
diff --git a/app/models/Views.scala b/app/models/Views.scala
index 438c1d3..154ca86 100644
--- a/app/models/Views.scala
+++ b/app/models/Views.scala
@@ -48,25 +48,29 @@ trait Views {
48 48
49 /** Entity class storing rows of table Sales 49 /** Entity class storing rows of table Sales
50 * @param itemUuid Database column item_uuid DBType(varchar), Length(36,true), Default(None) 50 * @param itemUuid Database column item_uuid DBType(varchar), Length(36,true), Default(None)
51 * @param itemName Database column item_name DBType(varchar), Length(20,true), Default(None)
51 * @param sellerUuid Database column seller_uuid DBType(varchar), Length(36,true), Default(None) 52 * @param sellerUuid Database column seller_uuid DBType(varchar), Length(36,true), Default(None)
52 * @param startDate Database column start_date DBType(timestamptz), Default(None) 53 * @param startDate Database column start_date DBType(timestamptz), Default(None)
53 * @param endDate Database column end_date DBType(timestamptz), Default(None) 54 * @param endDate Database column end_date DBType(timestamptz), Default(None)
54 * @param bestBidUuid Database column best_bid_uuid DBType(varchar), Length(36,true), Default(None) 55 * @param bestBidUuid Database column best_bid_uuid DBType(varchar), Length(36,true), Default(None)
55 * @param bestBidderUuid Database column best_bidder_uuid DBType(varchar), Length(36,true), Default(None) 56 * @param bestBidderUuid Database column best_bidder_uuid DBType(varchar), Length(36,true), Default(None)
57 * @param initialPrice Database column initial_price DBType(numeric), Default(None)
56 * @param bestOffer Database column best_offer DBType(numeric), Default(None) 58 * @param bestOffer Database column best_offer DBType(numeric), Default(None)
57 * @param charges Database column charges DBType(numeric), Default(None) */ 59 * @param charges Database column charges DBType(numeric), Default(None) */
58 case class Sale(itemUuid: Option[String] = None, sellerUuid: Option[String] = None, startDate: Option[java.sql.Timestamp] = None, endDate: Option[java.sql.Timestamp] = None, bestBidUuid: Option[String] = None, bestBidderUuid: Option[String] = None, bestOffer: Option[scala.math.BigDecimal] = None, charges: Option[scala.math.BigDecimal] = None) 60 case class Sale(itemUuid: Option[String] = None, itemName: Option[String] = None, sellerUuid: Option[String] = None, startDate: Option[java.sql.Timestamp] = None, endDate: Option[java.sql.Timestamp] = None, bestBidUuid: Option[String] = None, bestBidderUuid: Option[String] = None, initialPrice: Option[scala.math.BigDecimal] = None, bestOffer: Option[scala.math.BigDecimal] = None, charges: Option[scala.math.BigDecimal] = None)
59 /** GetResult implicit for fetching Sale objects using plain SQL queries */ 61 /** GetResult implicit for fetching Sale objects using plain SQL queries */
60 implicit def GetResultSale(implicit e0: GR[Option[String]], e1: GR[Option[java.sql.Timestamp]], e2: GR[Option[scala.math.BigDecimal]]): GR[Sale] = GR{ 62 implicit def GetResultSale(implicit e0: GR[Option[String]], e1: GR[Option[java.sql.Timestamp]], e2: GR[Option[scala.math.BigDecimal]]): GR[Sale] = GR{
61 prs => import prs._ 63 prs => import prs._
62 Sale.tupled((<<?[String], <<?[String], <<?[java.sql.Timestamp], <<?[java.sql.Timestamp], <<?[String], <<?[String], <<?[scala.math.BigDecimal], <<?[scala.math.BigDecimal])) 64 Sale.tupled((<<?[String], <<?[String], <<?[String], <<?[java.sql.Timestamp], <<?[java.sql.Timestamp], <<?[String], <<?[String], <<?[scala.math.BigDecimal], <<?[scala.math.BigDecimal], <<?[scala.math.BigDecimal]))
63 } 65 }
64 /** Table description of table sales. Objects of this class serve as prototypes for rows in queries. */ 66 /** Table description of table sales. Objects of this class serve as prototypes for rows in queries. */
65 class Sales(_tableTag: Tag) extends Table[Sale](_tableTag, "sales") { 67 class Sales(_tableTag: Tag) extends Table[Sale](_tableTag, "sales") {
66 def * = (itemUuid, sellerUuid, startDate, endDate, bestBidUuid, bestBidderUuid, bestOffer, charges) <> (Sale.tupled, Sale.unapply) 68 def * = (itemUuid, itemName, sellerUuid, startDate, endDate, bestBidUuid, bestBidderUuid, initialPrice, bestOffer, charges) <> (Sale.tupled, Sale.unapply)
67 69
68 /** Database column item_uuid DBType(varchar), Length(36,true), Default(None) */ 70 /** Database column item_uuid DBType(varchar), Length(36,true), Default(None) */
69 val itemUuid: Column[Option[String]] = column[Option[String]]("item_uuid", O.Length(36,varying=true), O.Default(None)) 71 val itemUuid: Column[Option[String]] = column[Option[String]]("item_uuid", O.Length(36,varying=true), O.Default(None))
72 /** Database column item_name DBType(varchar), Length(20,true), Default(None) */
73 val itemName: Column[Option[String]] = column[Option[String]]("item_name", O.Length(20,varying=true), O.Default(None))
70 /** Database column seller_uuid DBType(varchar), Length(36,true), Default(None) */ 74 /** Database column seller_uuid DBType(varchar), Length(36,true), Default(None) */
71 val sellerUuid: Column[Option[String]] = column[Option[String]]("seller_uuid", O.Length(36,varying=true), O.Default(None)) 75 val sellerUuid: Column[Option[String]] = column[Option[String]]("seller_uuid", O.Length(36,varying=true), O.Default(None))
72 /** Database column start_date DBType(timestamptz), Default(None) */ 76 /** Database column start_date DBType(timestamptz), Default(None) */
@@ -77,6 +81,8 @@ trait Views {
77 val bestBidUuid: Column[Option[String]] = column[Option[String]]("best_bid_uuid", O.Length(36,varying=true), O.Default(None)) 81 val bestBidUuid: Column[Option[String]] = column[Option[String]]("best_bid_uuid", O.Length(36,varying=true), O.Default(None))
78 /** Database column best_bidder_uuid DBType(varchar), Length(36,true), Default(None) */ 82 /** Database column best_bidder_uuid DBType(varchar), Length(36,true), Default(None) */
79 val bestBidderUuid: Column[Option[String]] = column[Option[String]]("best_bidder_uuid", O.Length(36,varying=true), O.Default(None)) 83 val bestBidderUuid: Column[Option[String]] = column[Option[String]]("best_bidder_uuid", O.Length(36,varying=true), O.Default(None))
84 /** Database column initial_price DBType(numeric), Default(None) */
85 val initialPrice: Column[Option[scala.math.BigDecimal]] = column[Option[scala.math.BigDecimal]]("initial_price", O.Default(None))
80 /** Database column best_offer DBType(numeric), Default(None) */ 86 /** Database column best_offer DBType(numeric), Default(None) */
81 val bestOffer: Column[Option[scala.math.BigDecimal]] = column[Option[scala.math.BigDecimal]]("best_offer", O.Default(None)) 87 val bestOffer: Column[Option[scala.math.BigDecimal]] = column[Option[scala.math.BigDecimal]]("best_offer", O.Default(None))
82 /** Database column charges DBType(numeric), Default(None) */ 88 /** Database column charges DBType(numeric), Default(None) */