All Downloads are FREE. Search and download functionalities are using the official Maven repository.

im.actor.server.persist.ManagerRepo.scala Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package im.actor.server.persist

import slick.driver.PostgresDriver.api._

import im.actor.server.model

final class ManagerTable(tag: Tag) extends Table[model.Manager](tag, "managers") {
  def id = column[Int]("id", O.PrimaryKey)
  def name = column[String]("name")
  def lastName = column[String]("last_name")
  def domain = column[String]("domain")
  def authToken = column[String]("auth_token")
  def email = column[String]("email")
  def emailUnique = index("manager_email_idx", email, unique = true) //way to keep email unique

  def * = (id, name, lastName, domain, authToken, email) <> (model.Manager.tupled, model.Manager.unapply)
}

object ManagerRepo {
  val managers = TableQuery[ManagerTable]

  def create(manager: model.Manager) =
    managers += manager

  def findByEmail(email: String) =
    managers.filter(_.email === email).result.headOption

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy