Newer
Older
yuyuko-bot / src / main / scala / models / Users.scala
@Dale TwoKey Dale TwoKey on 23 Aug 2021 699 bytes misc: Initial commit
package social.gensokyo.discordbot.models

import slick.jdbc.SQLiteProfile.api._

case class User(
  username: String,
  nickname: String,
  isAdmin: Boolean,
  isModerator: Boolean)

class Users(tag: Tag) extends Table[Users.TableRow](tag, "Users") {
  def id = column[String]("id", O.PrimaryKey)
  def nickname: Rep[String] = column[String]("nickname")
  def isAdmin = column[Boolean]("isAdming")
  def isModerator = column[Boolean]("isModerator")
  def * = (id, nickname, isAdmin, isModerator)
}

object Users {
  type TableRow = (String, String, Boolean, Boolean)
  val table = TableQuery[Users]

  def toUser(row: TableRow): User = User.tupled(row)
  def getAllusersQuery =
    table.result

}