diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/Tables.scala | 243 |
1 files changed, 243 insertions, 0 deletions
diff --git a/app/models/Tables.scala b/app/models/Tables.scala new file mode 100644 index 0000000..7d4406c --- /dev/null +++ b/app/models/Tables.scala | |||
@@ -0,0 +1,243 @@ | |||
1 | package models | ||
2 | |||
3 | // AUTO-GENERATED Slick data model | ||
4 | /** Stand-alone Slick data model for immediate use */ | ||
5 | object Tables extends { | ||
6 | val profile = scala.slick.driver.PostgresDriver | ||
7 | } with Tables | ||
8 | |||
9 | /** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */ | ||
10 | trait Tables { | ||
11 | val profile: scala.slick.driver.JdbcProfile | ||
12 | |||
13 | import profile.simple._ | ||
14 | 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. | ||
17 | |||
18 | import scala.slick.jdbc.{GetResult => GR} | ||
19 | |||
20 | /** DDL for all tables. Call .create to execute. */ | ||
21 | lazy val ddl = Bids.ddl ++ Charges.ddl ++ Items.ddl ++ Transactions.ddl ++ Users.ddl | ||
22 | |||
23 | /** Entity class storing rows of table Bids | ||
24 | * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) | ||
25 | * @param itemUuid Database column item_uuid DBType(varchar), Length(36,true) | ||
26 | * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) | ||
27 | * @param bidDate Database column bid_date DBType(timestamptz) | ||
28 | * @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) | ||
30 | |||
31 | /** 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 { | ||
33 | prs => import prs._ | ||
34 | Bid.tupled((<<[String], <<[String], <<[String], <<[java.sql.Timestamp], <<[scala.math.BigDecimal])) | ||
35 | } | ||
36 | |||
37 | /** 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") { | ||
39 | def * = (uuid, itemUuid, userUuid, bidDate, offer) <>(Bid.tupled, Bid.unapply) | ||
40 | |||
41 | /** 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.")) | ||
43 | |||
44 | /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ | ||
45 | val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) | ||
46 | /** Database column item_uuid DBType(varchar), Length(36,true) */ | ||
47 | val itemUuid: Column[String] = column[String]("item_uuid", O.Length(36, varying = true)) | ||
48 | /** Database column user_uuid DBType(varchar), Length(36,true) */ | ||
49 | val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) | ||
50 | /** Database column bid_date DBType(timestamptz) */ | ||
51 | val bidDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("bid_date") | ||
52 | /** Database column offer DBType(numeric) */ | ||
53 | val offer: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("offer") | ||
54 | |||
55 | /** 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) | ||
57 | /** 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) | ||
59 | } | ||
60 | |||
61 | /** Collection-like TableQuery object for table Bids */ | ||
62 | lazy val Bids = new TableQuery(tag => new Bids(tag)) | ||
63 | |||
64 | /** Entity class storing rows of table Charges | ||
65 | * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) | ||
66 | * @param startDate Database column start_date DBType(timestamptz) | ||
67 | * @param endDate Database column end_date DBType(timestamptz) | ||
68 | * @param fee Database column fee DBType(numeric) | ||
69 | * @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) | ||
71 | |||
72 | /** 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 { | ||
74 | prs => import prs._ | ||
75 | Charge.tupled((<<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[scala.math.BigDecimal], <<[scala.math.BigDecimal])) | ||
76 | } | ||
77 | |||
78 | /** 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") { | ||
80 | def * = (uuid, startDate, endDate, fee, rate) <>(Charge.tupled, Charge.unapply) | ||
81 | |||
82 | /** 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.")) | ||
84 | |||
85 | /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ | ||
86 | val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) | ||
87 | /** Database column start_date DBType(timestamptz) */ | ||
88 | val startDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("start_date") | ||
89 | /** Database column end_date DBType(timestamptz) */ | ||
90 | val endDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("end_date") | ||
91 | /** Database column fee DBType(numeric) */ | ||
92 | val fee: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("fee") | ||
93 | /** Database column rate DBType(numeric) */ | ||
94 | val rate: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("rate") | ||
95 | } | ||
96 | |||
97 | /** Collection-like TableQuery object for table Charges */ | ||
98 | lazy val Charges = new TableQuery(tag => new Charges(tag)) | ||
99 | |||
100 | /** Entity class storing rows of table Items | ||
101 | * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) | ||
102 | * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) | ||
103 | * @param startDate Database column start_date DBType(timestamptz) | ||
104 | * @param endDate Database column end_date DBType(timestamptz) | ||
105 | * @param itemName Database column item_name DBType(varchar), Length(20,true) | ||
106 | * @param shortDesc Database column short_desc DBType(varchar), Length(30,true) | ||
107 | * @param longDesc Database column long_desc DBType(text), Length(2147483647,true) | ||
108 | * @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) | ||
110 | |||
111 | /** 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 { | ||
113 | prs => import prs._ | ||
114 | Item.tupled((<<[String], <<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[String], <<[String], <<[String], <<[scala.math.BigDecimal])) | ||
115 | } | ||
116 | |||
117 | /** 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") { | ||
119 | 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. */ | ||
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.")) | ||
123 | |||
124 | /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ | ||
125 | val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) | ||
126 | /** Database column user_uuid DBType(varchar), Length(36,true) */ | ||
127 | val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) | ||
128 | /** Database column start_date DBType(timestamptz) */ | ||
129 | val startDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("start_date") | ||
130 | /** Database column end_date DBType(timestamptz) */ | ||
131 | val endDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("end_date") | ||
132 | /** Database column item_name DBType(varchar), Length(20,true) */ | ||
133 | val itemName: Column[String] = column[String]("item_name", O.Length(20, varying = true)) | ||
134 | /** Database column short_desc DBType(varchar), Length(30,true) */ | ||
135 | val shortDesc: Column[String] = column[String]("short_desc", O.Length(30, varying = true)) | ||
136 | /** Database column long_desc DBType(text), Length(2147483647,true) */ | ||
137 | val longDesc: Column[String] = column[String]("long_desc", O.Length(2147483647, varying = true)) | ||
138 | /** Database column initial_price DBType(numeric) */ | ||
139 | val initialPrice: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("initial_price") | ||
140 | |||
141 | /** Foreign key referencing Users (database name items_users_fk) */ | ||
142 | lazy val usersFk = foreignKey("items_users_fk", userUuid, Users)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) | ||
143 | } | ||
144 | |||
145 | /** Collection-like TableQuery object for table Items */ | ||
146 | lazy val Items = new TableQuery(tag => new Items(tag)) | ||
147 | |||
148 | /** Entity class storing rows of table Transactions | ||
149 | * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) | ||
150 | * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) | ||
151 | * @param transactionDate Database column transaction_date DBType(timestamptz) | ||
152 | * @param amount Database column amount DBType(numeric) | ||
153 | * @param label Database column label DBType(varchar), Length(255,true) */ | ||
154 | case class Transaction(uuid: String, userUuid: String, transactionDate: java.sql.Timestamp, amount: scala.math.BigDecimal, label: String) | ||
155 | |||
156 | /** GetResult implicit for fetching Transaction objects using plain SQL queries */ | ||
157 | implicit def GetResultTransaction(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Transaction] = GR { | ||
158 | prs => import prs._ | ||
159 | Transaction.tupled((<<[String], <<[String], <<[java.sql.Timestamp], <<[scala.math.BigDecimal], <<[String])) | ||
160 | } | ||
161 | |||
162 | /** Table description of table transactions. Objects of this class serve as prototypes for rows in queries. */ | ||
163 | class Transactions(_tableTag: Tag) extends Table[Transaction](_tableTag, "transactions") { | ||
164 | def * = (uuid, userUuid, transactionDate, amount, label) <>(Transaction.tupled, Transaction.unapply) | ||
165 | |||
166 | /** Maps whole row to an option. Useful for outer joins. */ | ||
167 | def ? = (uuid.?, userUuid.?, transactionDate.?, amount.?, label.?).shaped.<>({ r => import r._; _1.map(_ => Transaction.tupled((_1.get, _2.get, _3.get, _4.get, _5.get)))}, (_: Any) => throw new Exception("Inserting into ? projection not supported.")) | ||
168 | |||
169 | /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ | ||
170 | val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) | ||
171 | /** Database column user_uuid DBType(varchar), Length(36,true) */ | ||
172 | val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) | ||
173 | /** Database column transaction_date DBType(timestamptz) */ | ||
174 | val transactionDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("transaction_date") | ||
175 | /** Database column amount DBType(numeric) */ | ||
176 | val amount: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("amount") | ||
177 | /** Database column label DBType(varchar), Length(255,true) */ | ||
178 | val label: Column[String] = column[String]("label", O.Length(255, varying = true)) | ||
179 | |||
180 | /** Foreign key referencing Users (database name transactions_users_fk) */ | ||
181 | lazy val usersFk = foreignKey("transactions_users_fk", userUuid, Users)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) | ||
182 | } | ||
183 | |||
184 | /** Collection-like TableQuery object for table Transactions */ | ||
185 | lazy val Transactions = new TableQuery(tag => new Transactions(tag)) | ||
186 | |||
187 | /** Entity class storing rows of table Users | ||
188 | * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) | ||
189 | * @param username Database column username DBType(varchar), Length(20,true) | ||
190 | * @param email Database column email DBType(varchar), Length(255,true) | ||
191 | * @param userPassword Database column user_password DBType(varchar), Length(255,true) | ||
192 | * @param firstName Database column first_name DBType(varchar), Length(255,true) | ||
193 | * @param lastName Database column last_name DBType(varchar), Length(255,true) | ||
194 | * @param countryCode Database column country_code DBType(varchar), Length(2,true) | ||
195 | * @param postalCode Database column postal_code DBType(varchar), Length(20,true) | ||
196 | * @param address Database column address DBType(varchar), Length(255,true) | ||
197 | * @param phone Database column phone DBType(varchar), Length(20,true) | ||
198 | * @param birthdate Database column birthdate DBType(timestamptz) */ | ||
199 | case class User(uuid: String, username: String, email: String, userPassword: String, firstName: String, lastName: String, countryCode: String, postalCode: String, address: String, phone: String, birthdate: java.sql.Timestamp) | ||
200 | |||
201 | /** GetResult implicit for fetching User objects using plain SQL queries */ | ||
202 | implicit def GetResultUser(implicit e0: GR[String], e1: GR[java.sql.Timestamp]): GR[User] = GR { | ||
203 | prs => import prs._ | ||
204 | User.tupled((<<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[java.sql.Timestamp])) | ||
205 | } | ||
206 | |||
207 | /** Table description of table users. Objects of this class serve as prototypes for rows in queries. */ | ||
208 | class Users(_tableTag: Tag) extends Table[User](_tableTag, "users") { | ||
209 | def * = (uuid, username, email, userPassword, firstName, lastName, countryCode, postalCode, address, phone, birthdate) <>(User.tupled, User.unapply) | ||
210 | |||
211 | /** Maps whole row to an option. Useful for outer joins. */ | ||
212 | def ? = (uuid.?, username.?, email.?, userPassword.?, firstName.?, lastName.?, countryCode.?, postalCode.?, address.?, phone.?, birthdate.?).shaped.<>({ r => import r._; _1.map(_ => User.tupled((_1.get, _2.get, _3.get, _4.get, _5.get, _6.get, _7.get, _8.get, _9.get, _10.get, _11.get)))}, (_: Any) => throw new Exception("Inserting into ? projection not supported.")) | ||
213 | |||
214 | /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ | ||
215 | val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) | ||
216 | /** Database column username DBType(varchar), Length(20,true) */ | ||
217 | val username: Column[String] = column[String]("username", O.Length(20, varying = true)) | ||