aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/Application.scala1
-rw-r--r--app/models/Tables.scala223
-rw-r--r--app/models/Views.scala84
3 files changed, 186 insertions, 122 deletions
diff --git a/app/controllers/Application.scala b/app/controllers/Application.scala
index 43b579e..3380e38 100644
--- a/app/controllers/Application.scala
+++ b/app/controllers/Application.scala
@@ -3,6 +3,7 @@ package controllers
3import play.api._ 3import play.api._
4import play.api.mvc._ 4import play.api.mvc._
5 5
6
6object Application extends Controller { 7object Application extends Controller {
7 8
8 def index = Action { 9 def index = Action {
diff --git a/app/models/Tables.scala b/app/models/Tables.scala
index 7d4406c..ff1f267 100644
--- a/app/models/Tables.scala
+++ b/app/models/Tables.scala
@@ -1,89 +1,78 @@
1package models 1package models
2
3// AUTO-GENERATED Slick data model 2// AUTO-GENERATED Slick data model
4/** Stand-alone Slick data model for immediate use */ 3/** Stand-alone Slick data model for immediate use */
5object Tables extends { 4object Tables extends {
6 val profile = scala.slick.driver.PostgresDriver 5 val profile = play.api.db.slick.Config.driver
7} with Tables 6} with Tables
8 7
9/** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */ 8/** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */
10trait Tables { 9trait Tables {
11 val profile: scala.slick.driver.JdbcProfile 10 val profile: scala.slick.driver.JdbcProfile
12
13 import profile.simple._ 11 import profile.simple._
14 import scala.slick.model.ForeignKeyAction 12 import scala.slick.model.ForeignKeyAction
15
16 // NOTE: GetResult mappers for plain SQL are only generated for tables where Slick knows how to map the types of all columns. 13 // NOTE: GetResult mappers for plain SQL are only generated for tables where Slick knows how to map the types of all columns.
17
18 import scala.slick.jdbc.{GetResult => GR} 14 import scala.slick.jdbc.{GetResult => GR}
19 15
20 /** DDL for all tables. Call .create to execute. */ 16 /** DDL for all tables. Call .create to execute. */
21 lazy val ddl = Bids.ddl ++ Charges.ddl ++ Items.ddl ++ Transactions.ddl ++ Users.ddl 17 lazy val ddl = Bids.ddl ++ Charges.ddl ++ Items.ddl ++ Transactions.ddl ++ Users.ddl
22 18
23 /** Entity class storing rows of table Bids 19 /** Entity class storing rows of table Bids
24 * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) 20 * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true)
25 * @param itemUuid Database column item_uuid DBType(varchar), Length(36,true) 21 * @param itemUuid Database column item_uuid DBType(varchar), Length(36,true)
26 * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) 22 * @param userUuid Database column user_uuid DBType(varchar), Length(36,true)
27 * @param bidDate Database column bid_date DBType(timestamptz) 23 * @param bidDate Database column bid_date DBType(timestamptz)
28 * @param offer Database column offer DBType(numeric) */ 24 * @param offer Database column offer DBType(numeric) */
29 case class Bid(uuid: String, itemUuid: String, userUuid: String, bidDate: java.sql.Timestamp, offer: scala.math.BigDecimal) 25 case class Bid(uuid: String, itemUuid: String, userUuid: String, bidDate: java.sql.Timestamp, offer: scala.math.BigDecimal)
30
31 /** GetResult implicit for fetching Bid objects using plain SQL queries */ 26 /** GetResult implicit for fetching Bid objects using plain SQL queries */
32 implicit def GetResultBid(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Bid] = GR { 27 implicit def GetResultBid(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Bid] = GR{
33 prs => import prs._ 28 prs => import prs._
34 Bid.tupled((<<[String], <<[String], <<[String], <<[java.sql.Timestamp], <<[scala.math.BigDecimal])) 29 Bid.tupled((<<[String], <<[String], <<[String], <<[java.sql.Timestamp], <<[scala.math.BigDecimal]))
35 } 30 }
36
37 /** Table description of table bids. Objects of this class serve as prototypes for rows in queries. */ 31 /** Table description of table bids. Objects of this class serve as prototypes for rows in queries. */
38 class Bids(_tableTag: Tag) extends Table[Bid](_tableTag, "bids") { 32 class Bids(_tableTag: Tag) extends Table[Bid](_tableTag, "bids") {
39 def * = (uuid, itemUuid, userUuid, bidDate, offer) <>(Bid.tupled, Bid.unapply) 33 def * = (uuid, itemUuid, userUuid, bidDate, offer) <> (Bid.tupled, Bid.unapply)
40
41 /** Maps whole row to an option. Useful for outer joins. */ 34 /** Maps whole row to an option. Useful for outer joins. */
42 def ? = (uuid.?, itemUuid.?, userUuid.?, bidDate.?, offer.?).shaped.<>({ r => import r._; _1.map(_ => Bid.tupled((_1.get, _2.get, _3.get, _4.get, _5.get)))}, (_: Any) => throw new Exception("Inserting into ? projection not supported.")) 35 def ? = (uuid.?, itemUuid.?, userUuid.?, bidDate.?, offer.?).shaped.<>({r=>import r._; _1.map(_=> Bid.tupled((_1.get, _2.get, _3.get, _4.get, _5.get)))}, (_:Any) => throw new Exception("Inserting into ? projection not supported."))
43 36
44 /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ 37 /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */
45 val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) 38 val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36,varying=true))
46 /** Database column item_uuid DBType(varchar), Length(36,true) */ 39 /** Database column item_uuid DBType(varchar), Length(36,true) */
47 val itemUuid: Column[String] = column[String]("item_uuid", O.Length(36, varying = true)) 40 val itemUuid: Column[String] = column[String]("item_uuid", O.Length(36,varying=true))
48 /** Database column user_uuid DBType(varchar), Length(36,true) */ 41 /** Database column user_uuid DBType(varchar), Length(36,true) */
49 val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) 42 val userUuid: Column[String] = column[String]("user_uuid", O.Length(36,varying=true))
50 /** Database column bid_date DBType(timestamptz) */ 43 /** Database column bid_date DBType(timestamptz) */
51 val bidDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("bid_date") 44 val bidDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("bid_date")
52 /** Database column offer DBType(numeric) */ 45 /** Database column offer DBType(numeric) */
53 val offer: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("offer") 46 val offer: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("offer")
54 47
55 /** Foreign key referencing Items (database name bids_items_fk) */ 48 /** Foreign key referencing Items (database name bids_items_fk) */
56 lazy val itemsFk = foreignKey("bids_items_fk", itemUuid, Items)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) 49 lazy val itemsFk = foreignKey("bids_items_fk", itemUuid, Items)(r => r.uuid, onUpdate=ForeignKeyAction.NoAction, onDelete=ForeignKeyAction.NoAction)
57 /** Foreign key referencing Users (database name bids_users_fk) */ 50 /** Foreign key referencing Users (database name bids_users_fk) */
58 lazy val usersFk = foreignKey("bids_users_fk", userUuid, Users)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) 51 lazy val usersFk = foreignKey("bids_users_fk", userUuid, Users)(r => r.uuid, onUpdate=ForeignKeyAction.NoAction, onDelete=ForeignKeyAction.NoAction)
59 } 52 }
60
61 /** Collection-like TableQuery object for table Bids */ 53 /** Collection-like TableQuery object for table Bids */
62 lazy val Bids = new TableQuery(tag => new Bids(tag)) 54 lazy val Bids = new TableQuery(tag => new Bids(tag))
63 55
64 /** Entity class storing rows of table Charges 56 /** Entity class storing rows of table Charges
65 * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) 57 * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true)
66 * @param startDate Database column start_date DBType(timestamptz) 58 * @param startDate Database column start_date DBType(timestamptz)
67 * @param endDate Database column end_date DBType(timestamptz) 59 * @param endDate Database column end_date DBType(timestamptz)
68 * @param fee Database column fee DBType(numeric) 60 * @param fee Database column fee DBType(numeric)
69 * @param rate Database column rate DBType(numeric) */ 61 * @param rate Database column rate DBType(numeric) */
70 case class Charge(uuid: String, startDate: java.sql.Timestamp, endDate: java.sql.Timestamp, fee: scala.math.BigDecimal, rate: scala.math.BigDecimal) 62 case class Charge(uuid: String, startDate: java.sql.Timestamp, endDate: java.sql.Timestamp, fee: scala.math.BigDecimal, rate: scala.math.BigDecimal)
71
72 /** GetResult implicit for fetching Charge objects using plain SQL queries */ 63 /** GetResult implicit for fetching Charge objects using plain SQL queries */
73 implicit def GetResultCharge(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Charge] = GR { 64 implicit def GetResultCharge(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Charge] = GR{
74 prs => import prs._ 65 prs => import prs._
75 Charge.tupled((<<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[scala.math.BigDecimal], <<[scala.math.BigDecimal])) 66 Charge.tupled((<<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[scala.math.BigDecimal], <<[scala.math.BigDecimal]))
76 } 67 }
77
78 /** Table description of table charges. Objects of this class serve as prototypes for rows in queries. */ 68 /** Table description of table charges. Objects of this class serve as prototypes for rows in queries. */
79 class Charges(_tableTag: Tag) extends Table[Charge](_tableTag, "charges") { 69 class Charges(_tableTag: Tag) extends Table[Charge](_tableTag, "charges") {
80 def * = (uuid, startDate, endDate, fee, rate) <>(Charge.tupled, Charge.unapply) 70 def * = (uuid, startDate, endDate, fee, rate) <> (Charge.tupled, Charge.unapply)
81
82 /** Maps whole row to an option. Useful for outer joins. */ 71 /** Maps whole row to an option. Useful for outer joins. */
83 def ? = (uuid.?, startDate.?, endDate.?, fee.?, rate.?).shaped.<>({ r => import r._; _1.map(_ => Charge.tupled((_1.get, _2.get, _3.get, _4.get, _5.get)))}, (_: Any) => throw new Exception("Inserting into ? projection not supported.")) 72 def ? = (uuid.?, startDate.?, endDate.?, fee.?, rate.?).shaped.<>({r=>import r._; _1.map(_=> Charge.tupled((_1.get, _2.get, _3.get, _4.get, _5.get)))}, (_:Any) => throw new Exception("Inserting into ? projection not supported."))
84 73
85 /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ 74 /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */
86 val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) 75 val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36,varying=true))
87 /** Database column start_date DBType(timestamptz) */ 76 /** Database column start_date DBType(timestamptz) */
88 val startDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("start_date") 77 val startDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("start_date")
89 /** Database column end_date DBType(timestamptz) */ 78 /** Database column end_date DBType(timestamptz) */
@@ -93,151 +82,141 @@ trait Tables {
93 /** Database column rate DBType(numeric) */ 82 /** Database column rate DBType(numeric) */
94 val rate: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("rate") 83 val rate: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("rate")
95 } 84 }
96
97 /** Collection-like TableQuery object for table Charges */ 85 /** Collection-like TableQuery object for table Charges */
98 lazy val Charges = new TableQuery(tag => new Charges(tag)) 86 lazy val Charges = new TableQuery(tag => new Charges(tag))
99 87
100 /** Entity class storing rows of table Items 88 /** Entity class storing rows of table Items
101 * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) 89 * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true)
102 * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) 90 * @param userUuid Database column user_uuid DBType(varchar), Length(36,true)
103 * @param startDate Database column start_date DBType(timestamptz) 91 * @param startDate Database column start_date DBType(timestamptz)
104 * @param endDate Database column end_date DBType(timestamptz) 92 * @param endDate Database column end_date DBType(timestamptz)
105 * @param itemName Database column item_name DBType(varchar), Length(20,true) 93 * @param itemName Database column item_name DBType(varchar), Length(20,true)
106 * @param shortDesc Database column short_desc DBType(varchar), Length(30,true) 94 * @param shortDesc Database column short_desc DBType(varchar), Length(30,true)
107 * @param longDesc Database column long_desc DBType(text), Length(2147483647,true) 95 * @param longDesc Database column long_desc DBType(text), Length(2147483647,true)
108 * @param initialPrice Database column initial_price DBType(numeric) */ 96 * @param initialPrice Database column initial_price DBType(numeric) */
109 case class Item(uuid: String, userUuid: String, startDate: java.sql.Timestamp, endDate: java.sql.Timestamp, itemName: String, shortDesc: String, longDesc: String, initialPrice: scala.math.BigDecimal) 97 case class Item(uuid: String, userUuid: String, startDate: java.sql.Timestamp, endDate: java.sql.Timestamp, itemName: String, shortDesc: String, longDesc: String, initialPrice: scala.math.BigDecimal)
110
111 /** GetResult implicit for fetching Item objects using plain SQL queries */ 98 /** GetResult implicit for fetching Item objects using plain SQL queries */
112 implicit def GetResultItem(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Item] = GR { 99 implicit def GetResultItem(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Item] = GR{
113 prs => import prs._ 100 prs => import prs._
114 Item.tupled((<<[String], <<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[String], <<[String], <<[String], <<[scala.math.BigDecimal])) 101 Item.tupled((<<[String], <<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[String], <<[String], <<[String], <<[scala.math.BigDecimal]))
115 } 102 }
116
117 /** Table description of table items. Objects of this class serve as prototypes for rows in queries. */ 103 /** Table description of table items. Objects of this class serve as prototypes for rows in queries. */
118 class Items(_tableTag: Tag) extends Table[Item](_tableTag, "items") { 104 class Items(_tableTag: Tag) extends Table[Item](_tableTag, "items") {
119 def * = (uuid, userUuid, startDate, endDate, itemName, shortDesc, longDesc, initialPrice) <>(Item.tupled, Item.unapply) 105 def * = (uuid, userUuid, startDate, endDate, itemName, shortDesc, longDesc, initialPrice) <> (Item.tupled, Item.unapply)
120
121 /** Maps whole row to an option. Useful for outer joins. */ 106 /** Maps whole row to an option. Useful for outer joins. */
122 def ? = (uuid.?, userUuid.?, startDate.?, endDate.?, itemName.?, shortDesc.?, longDesc.?, initialPrice.?).shaped.<>({ r => import r._; _1.map(_ => Item.tupled((_1.get, _2.get, _3.get, _4.get, _5.get, _6.get, _7.get, _8.get)))}, (_: Any) => throw new Exception("Inserting into ? projection not supported.")) 107 def ? = (uuid.?, userUuid.?, startDate.?, endDate.?, itemName.?, shortDesc.?, longDesc.?, initialPrice.?).shaped.<>({r=>import r._; _1.map(_=> Item.tupled((_1.get, _2.get, _3.get, _4.get, _5.get, _6.get, _7.get, _8.get)))}, (_:Any) => throw new Exception("Inserting into ? projection not supported."))
123 108
124 /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ 109 /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */
125 val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) 110 val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36,varying=true))
126 /** Database column user_uuid DBType(varchar), Length(36,true) */ 111 /** Database column user_uuid DBType(varchar), Length(36,true) */
127 val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) 112 val userUuid: Column[String] = column[String]("user_uuid", O.Length(36,varying=true))
128 /** Database column start_date DBType(timestamptz) */ 113 /** Database column start_date DBType(timestamptz) */
129 val startDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("start_date") 114 val startDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("start_date")
130 /** Database column end_date DBType(timestamptz) */ 115 /** Database column end_date DBType(timestamptz) */
131 val endDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("end_date") 116 val endDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("end_date")