aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/Views.scala9
-rw-r--r--res/sql/orcl_all.sql2
-rw-r--r--res/sql/pg_all.sql2
-rw-r--r--res/sql/views/orcl_accounts.sql1
-rw-r--r--res/sql/views/pg_accounts.sql1
5 files changed, 12 insertions, 3 deletions
diff --git a/app/models/Views.scala b/app/models/Views.scala
index a76b043..438c1d3 100644
--- a/app/models/Views.scala
+++ b/app/models/Views.scala
@@ -18,21 +18,24 @@ trait Views {
18 18
19 /** Entity class storing rows of table Accounts 19 /** Entity class storing rows of table Accounts
20 * @param userUuid Database column user_uuid DBType(varchar), Length(36,true), Default(None) 20 * @param userUuid Database column user_uuid DBType(varchar), Length(36,true), Default(None)
21 * @param username Database column username DBType(varchar), Length(20,true), Default(None)
21 * @param balance Database column balance DBType(numeric), Default(None) 22 * @param balance Database column balance DBType(numeric), Default(None)
22 * @param openBids Database column open_bids DBType(numeric), Default(None) 23 * @param openBids Database column open_bids DBType(numeric), Default(None)
23 * @param equity Database column equity DBType(numeric), Default(None) */ 24 * @param equity Database column equity DBType(numeric), Default(None) */
24 case class Account(userUuid: Option[String] = None, balance: Option[scala.math.BigDecimal] = None, openBids: Option[scala.math.BigDecimal] = None, equity: Option[scala.math.BigDecimal] = None) 25 case class Account(userUuid: Option[String] = None, username: Option[String] = None, balance: Option[scala.math.BigDecimal] = None, openBids: Option[scala.math.BigDecimal] = None, equity: Option[scala.math.BigDecimal] = None)
25 /** GetResult implicit for fetching Account objects using plain SQL queries */ 26 /** GetResult implicit for fetching Account objects using plain SQL queries */
26 implicit def GetResultAccount(implicit e0: GR[Option[String]], e1: GR[Option[scala.math.BigDecimal]]): GR[Account] = GR{ 27 implicit def GetResultAccount(implicit e0: GR[Option[String]], e1: GR[Option[scala.math.BigDecimal]]): GR[Account] = GR{
27 prs => import prs._ 28 prs => import prs._
28 Account.tupled((<<?[String], <<?[scala.math.BigDecimal], <<?[scala.math.BigDecimal], <<?[scala.math.BigDecimal])) 29 Account.tupled((<<?[String], <<?[String], <<?[scala.math.BigDecimal], <<?[scala.math.BigDecimal], <<?[scala.math.BigDecimal]))
29 } 30 }
30 /** Table description of table accounts. Objects of this class serve as prototypes for rows in queries. */ 31 /** Table description of table accounts. Objects of this class serve as prototypes for rows in queries. */
31 class Accounts(_tableTag: Tag) extends Table[Account](_tableTag, "accounts") { 32 class Accounts(_tableTag: Tag) extends Table[Account](_tableTag, "accounts") {
32 def * = (userUuid, balance, openBids, equity) <> (Account.tupled, Account.unapply) 33 def * = (userUuid, username, balance, openBids, equity) <> (Account.tupled, Account.unapply)
33 34
34 /** Database column user_uuid DBType(varchar), Length(36,true), Default(None) */ 35 /** Database column user_uuid DBType(varchar), Length(36,true), Default(None) */
35 val userUuid: Column[Option[String]] = column[Option[String]]("user_uuid", O.Length(36,varying=true), O.Default(None)) 36 val userUuid: Column[Option[String]] = column[Option[String]]("user_uuid", O.Length(36,varying=true), O.Default(None))
37 /** Database column username DBType(varchar), Length(20,true), Default(None) */
38 val username: Column[Option[String]] = column[Option[String]]("username", O.Length(20,varying=true), O.Default(None))
36 /** Database column balance DBType(numeric), Default(None) */ 39 /** Database column balance DBType(numeric), Default(None) */
37 val balance: Column[Option[scala.math.BigDecimal]] = column[Option[scala.math.BigDecimal]]("balance", O.Default(None)) 40 val balance: Column[Option[scala.math.BigDecimal]] = column[Option[scala.math.BigDecimal]]("balance", O.Default(None))
38 /** Database column open_bids DBType(numeric), Default(None) */ 41 /** Database column open_bids DBType(numeric), Default(None) */
diff --git a/res/sql/orcl_all.sql b/res/sql/orcl_all.sql
index b0367de..08015f4 100644
--- a/res/sql/orcl_all.sql
+++ b/res/sql/orcl_all.sql
@@ -222,6 +222,7 @@ CREATE OR REPLACE VIEW accounts AS
222 222
223 SELECT 223 SELECT
224 users.uuid AS user_uuid, 224 users.uuid AS user_uuid,
225 users.username AS username,
225 COALESCE(transactions.balance, 0) AS balance, 226 COALESCE(transactions.balance, 0) AS balance,
226 COALESCE(sales.open_bids, 0) AS open_bids, 227 COALESCE(sales.open_bids, 0) AS open_bids,
227 COALESCE(transactions.balance, 0) - COALESCE(sales.open_bids, 0) AS equity 228 COALESCE(transactions.balance, 0) - COALESCE(sales.open_bids, 0) AS equity
@@ -249,6 +250,7 @@ CREATE OR REPLACE VIEW accounts AS
249 GROUP BY best_bidder_uuid 250 GROUP BY best_bidder_uuid
250 ) sales 251 ) sales
251 ON sales.best_bidder_uuid = users.uuid; 252 ON sales.best_bidder_uuid = users.uuid;
253
252INSERT INTO USERS (UUID, USERNAME, EMAIL, USER_PASSWORD, CREATION_DATE, FIRST_NAME, LAST_NAME, COUNTRY_CODE, POSTAL_CODE, ADDRESS, PHONE, BIRTHDATE) 254INSERT INTO USERS (UUID, USERNAME, EMAIL, USER_PASSWORD, CREATION_DATE, FIRST_NAME, LAST_NAME, COUNTRY_CODE, POSTAL_CODE, ADDRESS, PHONE, BIRTHDATE)
253VALUES ('0C99BEF9-375F-3E4A-E050-D7936EBE2782', 'duf', 'duf@gmail.com', '123456', 255VALUES ('0C99BEF9-375F-3E4A-E050-D7936EBE2782', 'duf', 'duf@gmail.com', '123456',
254 TO_TIMESTAMP_TZ('2000-01-01 00:00:00.000000', 'YYYY-MM-DD Hh24:MI:SS.FF'), 'Francis', 'Dumas', 'FR', '86544', 256 TO_TIMESTAMP_TZ('2000-01-01 00:00:00.000000', 'YYYY-MM-DD Hh24:MI:SS.FF'), 'Francis', 'Dumas', 'FR', '86544',
diff --git a/res/sql/pg_all.sql b/res/sql/pg_all.sql
index b76cb88..5d763e0 100644
--- a/res/sql/pg_all.sql
+++ b/res/sql/pg_all.sql
@@ -196,6 +196,7 @@ CREATE OR REPLACE VIEW accounts AS
196 196
197 SELECT 197 SELECT
198 users.uuid AS user_uuid, 198 users.uuid AS user_uuid,
199 users.username AS username,
199 COALESCE(transactions.balance, 0) AS balance, 200 COALESCE(transactions.balance, 0) AS balance,
200 COALESCE(sales.open_bids, 0) AS open_bids, 201 COALESCE(sales.open_bids, 0) AS open_bids,
201 COALESCE(transactions.balance, 0) - COALESCE(sales.open_bids, 0) AS equity 202 COALESCE(transactions.balance, 0) - COALESCE(sales.open_bids, 0) AS equity
@@ -223,6 +224,7 @@ CREATE OR REPLACE VIEW accounts AS
223 GROUP BY best_bidder_uuid 224 GROUP BY best_bidder_uuid
224 ) sales 225 ) sales
225 ON sales.best_bidder_uuid = users.uuid; 226 ON sales.best_bidder_uuid = users.uuid;
227
226INSERT INTO USERS (UUID, USERNAME, EMAIL, USER_PASSWORD, CREATION_DATE, FIRST_NAME, LAST_NAME, COUNTRY_CODE, POSTAL_CODE, ADDRESS, PHONE, BIRTHDATE) 228INSERT INTO USERS (UUID, USERNAME, EMAIL, USER_PASSWORD, CREATION_DATE, FIRST_NAME, LAST_NAME, COUNTRY_CODE, POSTAL_CODE, ADDRESS, PHONE, BIRTHDATE)
227VALUES 229VALUES
228 ('0C99BEF9-375F-3E4A-E050-D7936EBE2782', 'duf', 'duf@gmail.com', '123456', '2000-01-01 00:00:00.000000', 'Francis', 230 ('0C99BEF9-375F-3E4A-E050-D7936EBE2782', 'duf', 'duf@gmail.com', '123456', '2000-01-01 00:00:00.000000', 'Francis',
diff --git a/res/sql/views/orcl_accounts.sql b/res/sql/views/orcl_accounts.sql
index 400d38f..f3f5d6e 100644
--- a/res/sql/views/orcl_accounts.sql
+++ b/res/sql/views/orcl_accounts.sql
@@ -2,6 +2,7 @@ CREATE OR REPLACE VIEW accounts AS
2 2
3 SELECT 3 SELECT
4 users.uuid AS user_uuid, 4 users.uuid AS user_uuid,
5 users.username AS username,
5 COALESCE(transactions.balance, 0) AS balance, 6 COALESCE(transactions.balance, 0) AS balance,
6 COALESCE(sales.open_bids, 0) AS open_bids, 7 COALESCE(sales.open_bids, 0) AS open_bids,
7 COALESCE(transactions.balance, 0) - COALESCE(sales.open_bids, 0) AS equity 8 COALESCE(transactions.balance, 0) - COALESCE(sales.open_bids, 0) AS equity
diff --git a/res/sql/views/pg_accounts.sql b/res/sql/views/pg_accounts.sql
index 400d38f..f3f5d6e 100644
--- a/res/sql/views/pg_accounts.sql
+++ b/res/sql/views/pg_accounts.sql
@@ -2,6 +2,7 @@ CREATE OR REPLACE VIEW accounts AS
2 2
3 SELECT 3 SELECT
4 users.uuid AS user_uuid, 4 users.uuid AS user_uuid,
5 users.username AS username,
5 COALESCE(transactions.balance, 0) AS balance, 6 COALESCE(transactions.balance, 0) AS balance,
6 COALESCE(sales.open_bids, 0) AS open_bids, 7 COALESCE(sales.open_bids, 0) AS open_bids,
7 COALESCE(transactions.balance, 0) - COALESCE(sales.open_bids, 0) AS equity 8 COALESCE(transactions.balance, 0) - COALESCE(sales.open_bids, 0) AS equity