From 4c709046fe329113113b15de62a181cfc8fa5c13 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sun, 1 Feb 2015 00:48:17 +0100 Subject: Add model code generator --- app/controllers/Application.scala | 1 + app/models/Tables.scala | 223 +++++++++++++++++--------------------- app/models/Views.scala | 84 ++++++++++++++ 3 files changed, 186 insertions(+), 122 deletions(-) create mode 100644 app/models/Views.scala (limited to 'app') 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 import play.api._ import play.api.mvc._ + object Application extends Controller { 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 @@ package models - // AUTO-GENERATED Slick data model /** Stand-alone Slick data model for immediate use */ object Tables extends { - val profile = scala.slick.driver.PostgresDriver + val profile = play.api.db.slick.Config.driver } with Tables /** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */ trait Tables { val profile: scala.slick.driver.JdbcProfile - import profile.simple._ import scala.slick.model.ForeignKeyAction - // NOTE: GetResult mappers for plain SQL are only generated for tables where Slick knows how to map the types of all columns. - import scala.slick.jdbc.{GetResult => GR} - + /** DDL for all tables. Call .create to execute. */ lazy val ddl = Bids.ddl ++ Charges.ddl ++ Items.ddl ++ Transactions.ddl ++ Users.ddl - + /** Entity class storing rows of table Bids - * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) - * @param itemUuid Database column item_uuid DBType(varchar), Length(36,true) - * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) - * @param bidDate Database column bid_date DBType(timestamptz) - * @param offer Database column offer DBType(numeric) */ + * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) + * @param itemUuid Database column item_uuid DBType(varchar), Length(36,true) + * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) + * @param bidDate Database column bid_date DBType(timestamptz) + * @param offer Database column offer DBType(numeric) */ case class Bid(uuid: String, itemUuid: String, userUuid: String, bidDate: java.sql.Timestamp, offer: scala.math.BigDecimal) - /** GetResult implicit for fetching Bid objects using plain SQL queries */ - implicit def GetResultBid(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Bid] = GR { + implicit def GetResultBid(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Bid] = GR{ prs => import prs._ - Bid.tupled((<<[String], <<[String], <<[String], <<[java.sql.Timestamp], <<[scala.math.BigDecimal])) + Bid.tupled((<<[String], <<[String], <<[String], <<[java.sql.Timestamp], <<[scala.math.BigDecimal])) } - /** Table description of table bids. Objects of this class serve as prototypes for rows in queries. */ class Bids(_tableTag: Tag) extends Table[Bid](_tableTag, "bids") { - def * = (uuid, itemUuid, userUuid, bidDate, offer) <>(Bid.tupled, Bid.unapply) - + def * = (uuid, itemUuid, userUuid, bidDate, offer) <> (Bid.tupled, Bid.unapply) /** Maps whole row to an option. Useful for outer joins. */ - 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.")) - + 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.")) + /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ - val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) + val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36,varying=true)) /** Database column item_uuid DBType(varchar), Length(36,true) */ - val itemUuid: Column[String] = column[String]("item_uuid", O.Length(36, varying = true)) + val itemUuid: Column[String] = column[String]("item_uuid", O.Length(36,varying=true)) /** Database column user_uuid DBType(varchar), Length(36,true) */ - val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) + val userUuid: Column[String] = column[String]("user_uuid", O.Length(36,varying=true)) /** Database column bid_date DBType(timestamptz) */ val bidDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("bid_date") /** Database column offer DBType(numeric) */ val offer: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("offer") - + /** Foreign key referencing Items (database name bids_items_fk) */ - lazy val itemsFk = foreignKey("bids_items_fk", itemUuid, Items)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) + lazy val itemsFk = foreignKey("bids_items_fk", itemUuid, Items)(r => r.uuid, onUpdate=ForeignKeyAction.NoAction, onDelete=ForeignKeyAction.NoAction) /** Foreign key referencing Users (database name bids_users_fk) */ - lazy val usersFk = foreignKey("bids_users_fk", userUuid, Users)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) + lazy val usersFk = foreignKey("bids_users_fk", userUuid, Users)(r => r.uuid, onUpdate=ForeignKeyAction.NoAction, onDelete=ForeignKeyAction.NoAction) } - /** Collection-like TableQuery object for table Bids */ lazy val Bids = new TableQuery(tag => new Bids(tag)) - + /** Entity class storing rows of table Charges - * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) - * @param startDate Database column start_date DBType(timestamptz) - * @param endDate Database column end_date DBType(timestamptz) - * @param fee Database column fee DBType(numeric) - * @param rate Database column rate DBType(numeric) */ + * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) + * @param startDate Database column start_date DBType(timestamptz) + * @param endDate Database column end_date DBType(timestamptz) + * @param fee Database column fee DBType(numeric) + * @param rate Database column rate DBType(numeric) */ case class Charge(uuid: String, startDate: java.sql.Timestamp, endDate: java.sql.Timestamp, fee: scala.math.BigDecimal, rate: scala.math.BigDecimal) - /** GetResult implicit for fetching Charge objects using plain SQL queries */ - implicit def GetResultCharge(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Charge] = GR { + implicit def GetResultCharge(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Charge] = GR{ prs => import prs._ - Charge.tupled((<<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[scala.math.BigDecimal], <<[scala.math.BigDecimal])) + Charge.tupled((<<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[scala.math.BigDecimal], <<[scala.math.BigDecimal])) } - /** Table description of table charges. Objects of this class serve as prototypes for rows in queries. */ class Charges(_tableTag: Tag) extends Table[Charge](_tableTag, "charges") { - def * = (uuid, startDate, endDate, fee, rate) <>(Charge.tupled, Charge.unapply) - + def * = (uuid, startDate, endDate, fee, rate) <> (Charge.tupled, Charge.unapply) /** Maps whole row to an option. Useful for outer joins. */ - 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.")) - + 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.")) + /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ - val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) + val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36,varying=true)) /** Database column start_date DBType(timestamptz) */ val startDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("start_date") /** Database column end_date DBType(timestamptz) */ @@ -93,151 +82,141 @@ trait Tables { /** Database column rate DBType(numeric) */ val rate: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("rate") } - /** Collection-like TableQuery object for table Charges */ lazy val Charges = new TableQuery(tag => new Charges(tag)) - + /** Entity class storing rows of table Items - * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) - * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) - * @param startDate Database column start_date DBType(timestamptz) - * @param endDate Database column end_date DBType(timestamptz) - * @param itemName Database column item_name DBType(varchar), Length(20,true) - * @param shortDesc Database column short_desc DBType(varchar), Length(30,true) - * @param longDesc Database column long_desc DBType(text), Length(2147483647,true) - * @param initialPrice Database column initial_price DBType(numeric) */ + * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) + * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) + * @param startDate Database column start_date DBType(timestamptz) + * @param endDate Database column end_date DBType(timestamptz) + * @param itemName Database column item_name DBType(varchar), Length(20,true) + * @param shortDesc Database column short_desc DBType(varchar), Length(30,true) + * @param longDesc Database column long_desc DBType(text), Length(2147483647,true) + * @param initialPrice Database column initial_price DBType(numeric) */ 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) - /** GetResult implicit for fetching Item objects using plain SQL queries */ - implicit def GetResultItem(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Item] = GR { + implicit def GetResultItem(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Item] = GR{ prs => import prs._ - Item.tupled((<<[String], <<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[String], <<[String], <<[String], <<[scala.math.BigDecimal])) + Item.tupled((<<[String], <<[String], <<[java.sql.Timestamp], <<[java.sql.Timestamp], <<[String], <<[String], <<[String], <<[scala.math.BigDecimal])) } - /** Table description of table items. Objects of this class serve as prototypes for rows in queries. */ class Items(_tableTag: Tag) extends Table[Item](_tableTag, "items") { - def * = (uuid, userUuid, startDate, endDate, itemName, shortDesc, longDesc, initialPrice) <>(Item.tupled, Item.unapply) - + def * = (uuid, userUuid, startDate, endDate, itemName, shortDesc, longDesc, initialPrice) <> (Item.tupled, Item.unapply) /** Maps whole row to an option. Useful for outer joins. */ - 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.")) - + 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.")) + /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ - val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) + val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36,varying=true)) /** Database column user_uuid DBType(varchar), Length(36,true) */ - val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) + val userUuid: Column[String] = column[String]("user_uuid", O.Length(36,varying=true)) /** Database column start_date DBType(timestamptz) */ val startDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("start_date") /** Database column end_date DBType(timestamptz) */ val endDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("end_date") /** Database column item_name DBType(varchar), Length(20,true) */ - val itemName: Column[String] = column[String]("item_name", O.Length(20, varying = true)) + val itemName: Column[String] = column[String]("item_name", O.Length(20,varying=true)) /** Database column short_desc DBType(varchar), Length(30,true) */ - val shortDesc: Column[String] = column[String]("short_desc", O.Length(30, varying = true)) + val shortDesc: Column[String] = column[String]("short_desc", O.Length(30,varying=true)) /** Database column long_desc DBType(text), Length(2147483647,true) */ - val longDesc: Column[String] = column[String]("long_desc", O.Length(2147483647, varying = true)) + val longDesc: Column[String] = column[String]("long_desc", O.Length(2147483647,varying=true)) /** Database column initial_price DBType(numeric) */ val initialPrice: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("initial_price") - + /** Foreign key referencing Users (database name items_users_fk) */ - lazy val usersFk = foreignKey("items_users_fk", userUuid, Users)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) + lazy val usersFk = foreignKey("items_users_fk", userUuid, Users)(r => r.uuid, onUpdate=ForeignKeyAction.NoAction, onDelete=ForeignKeyAction.NoAction) } - /** Collection-like TableQuery object for table Items */ lazy val Items = new TableQuery(tag => new Items(tag)) - + /** Entity class storing rows of table Transactions - * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) - * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) - * @param transactionDate Database column transaction_date DBType(timestamptz) - * @param amount Database column amount DBType(numeric) - * @param label Database column label DBType(varchar), Length(255,true) */ + * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) + * @param userUuid Database column user_uuid DBType(varchar), Length(36,true) + * @param transactionDate Database column transaction_date DBType(timestamptz) + * @param amount Database column amount DBType(numeric) + * @param label Database column label DBType(varchar), Length(255,true) */ case class Transaction(uuid: String, userUuid: String, transactionDate: java.sql.Timestamp, amount: scala.math.BigDecimal, label: String) - /** GetResult implicit for fetching Transaction objects using plain SQL queries */ - implicit def GetResultTransaction(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Transaction] = GR { + implicit def GetResultTransaction(implicit e0: GR[String], e1: GR[java.sql.Timestamp], e2: GR[scala.math.BigDecimal]): GR[Transaction] = GR{ prs => import prs._ - Transaction.tupled((<<[String], <<[String], <<[java.sql.Timestamp], <<[scala.math.BigDecimal], <<[String])) + Transaction.tupled((<<[String], <<[String], <<[java.sql.Timestamp], <<[scala.math.BigDecimal], <<[String])) } - /** Table description of table transactions. Objects of this class serve as prototypes for rows in queries. */ class Transactions(_tableTag: Tag) extends Table[Transaction](_tableTag, "transactions") { - def * = (uuid, userUuid, transactionDate, amount, label) <>(Transaction.tupled, Transaction.unapply) - + def * = (uuid, userUuid, transactionDate, amount, label) <> (Transaction.tupled, Transaction.unapply) /** Maps whole row to an option. Useful for outer joins. */ - 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.")) - + 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.")) + /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ - val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) + val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36,varying=true)) /** Database column user_uuid DBType(varchar), Length(36,true) */ - val userUuid: Column[String] = column[String]("user_uuid", O.Length(36, varying = true)) + val userUuid: Column[String] = column[String]("user_uuid", O.Length(36,varying=true)) /** Database column transaction_date DBType(timestamptz) */ val transactionDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("transaction_date") /** Database column amount DBType(numeric) */ val amount: Column[scala.math.BigDecimal] = column[scala.math.BigDecimal]("amount") /** Database column label DBType(varchar), Length(255,true) */ - val label: Column[String] = column[String]("label", O.Length(255, varying = true)) - + val label: Column[String] = column[String]("label", O.Length(255,varying=true)) + /** Foreign key referencing Users (database name transactions_users_fk) */ - lazy val usersFk = foreignKey("transactions_users_fk", userUuid, Users)(r => r.uuid, onUpdate = ForeignKeyAction.NoAction, onDelete = ForeignKeyAction.NoAction) + lazy val usersFk = foreignKey("transactions_users_fk", userUuid, Users)(r => r.uuid, onUpdate=ForeignKeyAction.NoAction, onDelete=ForeignKeyAction.NoAction) } - /** Collection-like TableQuery object for table Transactions */ lazy val Transactions = new TableQuery(tag => new Transactions(tag)) - + /** Entity class storing rows of table Users - * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) - * @param username Database column username DBType(varchar), Length(20,true) - * @param email Database column email DBType(varchar), Length(255,true) - * @param userPassword Database column user_password DBType(varchar), Length(255,true) - * @param firstName Database column first_name DBType(varchar), Length(255,true) - * @param lastName Database column last_name DBType(varchar), Length(255,true) - * @param countryCode Database column country_code DBType(varchar), Length(2,true) - * @param postalCode Database column postal_code DBType(varchar), Length(20,true) - * @param address Database column address DBType(varchar), Length(255,true) - * @param phone Database column phone DBType(varchar), Length(20,true) - * @param birthdate Database column birthdate DBType(timestamptz) */ - 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) - + * @param uuid Database column uuid DBType(varchar), PrimaryKey, Length(36,true) + * @param username Database column username DBType(varchar), Length(20,true) + * @param email Database column email DBType(varchar), Length(255,true) + * @param userPassword Database column user_password DBType(varchar), Length(255,true) + * @param creationDate Database column creation_date DBType(timestamptz) + * @param firstName Database column first_name DBType(varchar), Length(255,true) + * @param lastName Database column last_name DBType(varchar), Length(255,true) + * @param countryCode Database column country_code DBType(varchar), Length(2,true) + * @param postalCode Database column postal_code DBType(varchar), Length(20,true) + * @param address Database column address DBType(varchar), Length(255,true) + * @param phone Database column phone DBType(varchar), Length(20,true) + * @param birthdate Database column birthdate DBType(timestamptz) */ + case class User(uuid: String, username: String, email: String, userPassword: String, creationDate: java.sql.Timestamp, firstName: String, lastName: String, countryCode: String, postalCode: String, address: String, phone: String, birthdate: java.sql.Timestamp) /** GetResult implicit for fetching User objects using plain SQL queries */ - implicit def GetResultUser(implicit e0: GR[String], e1: GR[java.sql.Timestamp]): GR[User] = GR { + implicit def GetResultUser(implicit e0: GR[String], e1: GR[java.sql.Timestamp]): GR[User] = GR{ prs => import prs._ - User.tupled((<<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[java.sql.Timestamp])) + User.tupled((<<[String], <<[String], <<[String], <<[String], <<[java.sql.Timestamp], <<[String], <<[String], <<[String], <<[String], <<[String], <<[String], <<[java.sql.Timestamp])) } - /** Table description of table users. Objects of this class serve as prototypes for rows in queries. */ class Users(_tableTag: Tag) extends Table[User](_tableTag, "users") { - def * = (uuid, username, email, userPassword, firstName, lastName, countryCode, postalCode, address, phone, birthdate) <>(User.tupled, User.unapply) - + def * = (uuid, username, email, userPassword, creationDate, firstName, lastName, countryCode, postalCode, address, phone, birthdate) <> (User.tupled, User.unapply) /** Maps whole row to an option. Useful for outer joins. */ - 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.")) - + def ? = (uuid.?, username.?, email.?, userPassword.?, creationDate.?, 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, _12.get)))}, (_:Any) => throw new Exception("Inserting into ? projection not supported.")) + /** Database column uuid DBType(varchar), PrimaryKey, Length(36,true) */ - val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36, varying = true)) + val uuid: Column[String] = column[String]("uuid", O.PrimaryKey, O.Length(36,varying=true)) /** Database column username DBType(varchar), Length(20,true) */ - val username: Column[String] = column[String]("username", O.Length(20, varying = true)) + val username: Column[String] = column[String]("username", O.Length(20,varying=true)) /** Database column email DBType(varchar), Length(255,true) */ - val email: Column[String] = column[String]("email", O.Length(255, varying = true)) + val email: Column[String] = column[String]("email", O.Length(255,varying=true)) /** Database column user_password DBType(varchar), Length(255,true) */ - val userPassword: Column[String] = column[String]("user_password", O.Length(255, varying = true)) + val userPassword: Column[String] = column[String]("user_password", O.Length(255,varying=true)) + /** Database column creation_date DBType(timestamptz) */ + val creationDate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("creation_date") /** Database column first_name DBType(varchar), Length(255,true) */ - val firstName: Column[String] = column[String]("first_name", O.Length(255, varying = true)) + val firstName: Column[String] = column[String]("first_name", O.Length(255,varying=true)) /** Database column last_name DBType(varchar), Length(255,true) */ - val lastName: Column[String] = column[String]("last_name", O.Length(255, varying = true)) + val lastName: Column[String] = column[String]("last_name", O.Length(255,varying=true)) /** Database column country_code DBType(varchar), Length(2,true) */ - val countryCode: Column[String] = column[String]("country_code", O.Length(2, varying = true)) + val countryCode: Column[String] = column[String]("country_code", O.Length(2,varying=true)) /** Database column postal_code DBType(varchar), Length(20,true) */ - val postalCode: Column[String] = column[String]("postal_code", O.Length(20, varying = true)) + val postalCode: Column[String] = column[String]("postal_code", O.Length(20,varying=true)) /** Database column address DBType(varchar), Length(255,true) */ - val address: Column[String] = column[String]("address", O.Length(255, varying = true)) + val address: Column[String] = column[String]("address", O.Length(255,varying=true)) /** Database column phone DBType(varchar), Length(20,true) */ - val phone: Column[String] = column[String]("phone", O.Length(20, varying = true)) + val phone: Column[String] = column[String]("phone", O.Length(20,varying=true)) /** Database column birthdate DBType(timestamptz) */ val birthdate: Column[java.sql.Timestamp] = column[java.sql.Timestamp]("birthdate") - + /** Uniqueness Index over (username) (database name username_unique) */ - val index1 = index("username_unique", username, unique = true) + val index1 = index("username_unique", username, unique=true) } - /** Collection-like TableQuery object for table Users */ lazy val Users = new TableQuery(tag => new Users(tag)) } \ No newline at end of file diff --git a/app/models/Views.scala b/app/models/Views.scala new file mode 100644 index 0000000..a76b043 --- /dev/null +++ b/app/models/Views.scala @@ -0,0 +1,84 @@ +package models +// AUTO-GENERATED Slick data model +/** Stand-alone Slick data model for immediate use */ +object Views extends { + val profile = play.api.db.slick.Config.driver +} with Views + +/** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */ +trait Views { + val profile: scala.slick.driver.JdbcProfile + import profile.simple._ + import scala.slick.model.ForeignKeyAction + // NOTE: GetResult mappers for plain SQL are only generated for tables where Slick knows how to map the types of all columns. + import scala.slick.jdbc.{GetResult => GR} + + /** DDL for all tables. Call .create to execute. */ + lazy val ddl = Accounts.ddl ++ Sales.ddl + + /** Entity class storing rows of table Accounts + * @param userUuid Database column user_uuid DBType(varchar), Length(36,true), Default(None) + * @param balance Database column balance DBType(numeric), Default(None) + * @param openBids Database column open_bids DBType(numeric), Default(None) + * @param equity Database column equity DBType(numeric), Default(None) */ + 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) + /** GetResult implicit for fetching Account objects using plain SQL queries */ + implicit def GetResultAccount(implicit e0: GR[Option[String]], e1: GR[Option[scala.math.BigDecimal]]): GR[Account] = GR{ + prs => import prs._ + Account.tupled((< (Account.tupled, Account.unapply) + + /** Database column user_uuid DBType(varchar), Length(36,true), Default(None) */ + val userUuid: Column[Option[String]] = column[Option[String]]("user_uuid", O.Length(36,varying=true), O.Default(None)) + /** Database column balance DBType(numeric), Default(None) */ + val balance: Column[Option[scala.math.BigDecimal]] = column[Option[scala.math.BigDecimal]]("balance", O.Default(None)) + /** Database column open_bids DBType(numeric), Default(None) */ + val openBids: Column[Option[scala.math.BigDecimal]] = column[Option[scala.math.BigDecimal]]("open_bids", O.Default(None)) + /** Database column equity DBType(numeric), Default(None) */ + val equity: Column[Option[scala.math.BigDecimal]] = column[Option[scala.math.BigDecimal]]("equity", O.Default(None)) + } + /** Collection-like TableQuery object for table Accounts */ + lazy val Accounts = new TableQuery(tag => new Accounts(tag)) + + /** Entity class storing rows of table Sales + * @param itemUuid Database column item_uuid DBType(varchar), Length(36,true), Default(None) + * @param sellerUuid Database column seller_uuid DBType(varchar), Length(36,true), Default(None) + * @param startDate Database column start_date DBType(timestamptz), Default(None) + * @param endDate Database column end_date DBType(timestamptz), Default(None) + * @param bestBidUuid Database column best_bid_uuid DBType(varchar), Length(36,true), Default(None) + * @param bestBidderUuid Database column best_bidder_uuid DBType(varchar), Length(36,true), Default(None) + * @param bestOffer Database column best_offer DBType(numeric), Default(None) + * @param charges Database column charges DBType(numeric), Default(None) */ + 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) + /** GetResult implicit for fetching Sale objects using plain SQL queries */ + implicit def GetResultSale(implicit e0: GR[Option[String]], e1: GR[Option[java.sql.Timestamp]], e2: GR[Option[scala.math.BigDecimal]]): GR[Sale] = GR{ + prs => import prs._ + Sale.tupled((< (Sale.tupled, Sale.unapply) + + /** Database column item_uuid DBType(varchar), Length(36,true), Default(None) */ + val itemUuid: Column[Option[String]] = column[Option[String]]("item_uuid", O.Length(36,varying=true), O.Default(None)) + /** Database column seller_uuid DBType(varchar), Length(36,true), Default(None) */ + val sellerUuid: Column[Option[String]] = column[Option[String]]("seller_uuid", O.Length(36,varying=true), O.Default(None)) + /** Database column start_date DBType(timestamptz), Default(None) */ + val startDate: Column[Option[java.sql.Timestamp]] = column[Option[java.sql.Timestamp]]("start_date", O.Default(None)) + /** Database column end_date DBType(timestamptz), Default(None) */ + val endDate: Column[Option[java.sql.Timestamp]] = column[Option[java.sql.Timestamp]]("end_date", O.Default(None)) + /** Database column best_bid_uuid DBType(varchar), Length(36,true), Default(None) */ + val bestBidUuid: Column[Option[String]] = column[Option[String]]("best_bid_uuid", O.Length(36,varying=true), O.Default(None)) + /** Database column best_bidder_uuid DBType(varchar), Length(36,true), Default(None) */ + val bestBidderUuid: Column[Option[String]] = column[Option[String]]("best_bidder_uuid", O.Length(36,varying=true), O.Default(None)) + /** Database column best_offer DBType(numeric), Default(None) */ + val bestOffer: Column[Option[scala.math.BigDecimal]] = column[Option[scala.math.BigDecimal]]("best_offer", O.Default(None)) + /** Database column charges DBType(numeric), Default(None) */ + val charges: Column[Option[scala.math.BigDecimal]] = column[Option[scala.math.BigDecimal]]("charges", O.Default(None)) + } + /** Collection-like TableQuery object for table Sales */ + lazy val Sales = new TableQuery(tag => new Sales(tag)) +} \ No newline at end of file -- cgit v1.2.3