Clear codes related to Scala/Slick
This commit is contained in:
parent
be4bac6037
commit
93c52542ae
@ -186,7 +186,8 @@ class BigBlueButtonActor(
|
||||
}
|
||||
|
||||
MeetingDAO.delete(msg.meetingId)
|
||||
UserDAO.deleteAllFromMeeting(msg.meetingId)
|
||||
// Removing the meeting is enough, all other tables has "ON DELETE CASCADE"
|
||||
// UserDAO.deleteAllFromMeeting(msg.meetingId)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,15 +22,13 @@ class WhiteboardModel extends SystemConfiguration {
|
||||
}
|
||||
|
||||
private def createWhiteboard(wbId: String): Whiteboard = {
|
||||
val newWb = Whiteboard(
|
||||
Whiteboard(
|
||||
wbId,
|
||||
Array.empty[String],
|
||||
Array.empty[String],
|
||||
System.currentTimeMillis(),
|
||||
new HashMap[String, AnnotationVO]
|
||||
)
|
||||
|
||||
newWb
|
||||
}
|
||||
|
||||
private def deepMerge(test: Map[String, _], that: Map[String, _]): Map[String, _] =
|
||||
@ -76,10 +74,6 @@ class WhiteboardModel extends SystemConfiguration {
|
||||
}
|
||||
val newWb = wb.copy(annotationsMap = newAnnotationsMap)
|
||||
saveWhiteboard(newWb)
|
||||
|
||||
//Use it to add the diff only
|
||||
// annotationsAdded.map(PresAnnotationDAO.insertOrUpdate(_))
|
||||
|
||||
annotationsAdded
|
||||
}
|
||||
|
||||
@ -118,7 +112,6 @@ class WhiteboardModel extends SystemConfiguration {
|
||||
def modifyWhiteboardAccess(wbId: String, multiUser: Array[String]) {
|
||||
val wb = getWhiteboard(wbId)
|
||||
val newWb = wb.copy(multiUser = multiUser, oldMultiUser = wb.multiUser, changedModeOn = System.currentTimeMillis())
|
||||
// UserWhiteboardDAO.updateMultiuser(newWb)
|
||||
PresPageWritersDAO.updateMultiuser(newWb)
|
||||
saveWhiteboard(newWb)
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ package org.bigbluebutton.core.apps.users
|
||||
import org.bigbluebutton.common2.msgs._
|
||||
import org.bigbluebutton.core.models._
|
||||
import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter }
|
||||
import org.bigbluebutton.core.util.RandomStringGenerator
|
||||
import org.bigbluebutton.core2.message.senders.{ MsgBuilder, Sender }
|
||||
|
||||
import scala.util.Random
|
||||
|
||||
trait RegisterUserReqMsgHdlr {
|
||||
@ -55,13 +57,9 @@ trait RegisterUserReqMsgHdlr {
|
||||
|
||||
val guestStatus = msg.body.guestStatus
|
||||
|
||||
val colorOptions = List("#7b1fa2", "#6a1b9a", "#4a148c", "#5e35b1", "#512da8", "#4527a0", "#311b92",
|
||||
"#3949ab", "#303f9f", "#283593", "#1a237e", "#1976d2", "#1565c0", "#0d47a1", "#0277bd", "#01579b")
|
||||
val userColor = colorOptions(Random.nextInt(colorOptions.length))
|
||||
|
||||
val regUser = RegisteredUsers.create(msg.body.intUserId, msg.body.extUserId,
|
||||
msg.body.name, msg.body.role, msg.body.authToken,
|
||||
msg.body.avatarURL, userColor, msg.body.guest, msg.body.authed, guestStatus, msg.body.excludeFromDashboard, false)
|
||||
msg.body.avatarURL, RandomStringGenerator.randomColor, msg.body.guest, msg.body.authed, guestStatus, msg.body.excludeFromDashboard, false)
|
||||
|
||||
checkUserConcurrentAccesses(regUser)
|
||||
RegisteredUsers.add(liveMeeting.registeredUsers, regUser, liveMeeting.props.meetingProp.intId)
|
||||
|
@ -6,6 +6,7 @@ import org.bigbluebutton.core.running.{ LiveMeeting, MeetingActor, OutMsgRouter
|
||||
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
||||
import org.bigbluebutton.core.models._
|
||||
import org.bigbluebutton.core.apps.users.UsersApp
|
||||
import org.bigbluebutton.core.util.RandomStringGenerator
|
||||
import org.bigbluebutton.core2.MeetingStatus2x
|
||||
|
||||
import scala.util.Random
|
||||
@ -21,9 +22,7 @@ trait UserJoinedVoiceConfEvtMsgHdlr extends SystemConfiguration {
|
||||
val guestPolicy = GuestsWaiting.getGuestPolicy(liveMeeting.guestsWaiting)
|
||||
val isDialInUser = msg.body.intId.startsWith(IntIdPrefixType.DIAL_IN)
|
||||
|
||||
val colorOptions = List("#7b1fa2", "#6a1b9a", "#4a148c", "#5e35b1", "#512da8", "#4527a0", "#311b92",
|
||||
"#3949ab", "#303f9f", "#283593", "#1a237e", "#1976d2", "#1565c0", "#0d47a1", "#0277bd", "#01579b")
|
||||
val userColor = colorOptions(Random.nextInt(colorOptions.length))
|
||||
val userColor = RandomStringGenerator.randomColor
|
||||
|
||||
def notifyModeratorsOfGuestWaiting(guest: GuestWaiting, users: Users2x, meetingId: String): Unit = {
|
||||
val moderators = Users2x.findAll(users).filter(p => p.role == Roles.MODERATOR_ROLE)
|
||||
|
@ -53,8 +53,6 @@ class MeetingDbTableDef(tag: Tag) extends Table[MeetingDbModel](tag, None, "meet
|
||||
}
|
||||
|
||||
object MeetingDAO {
|
||||
// val usersTable = TableQuery[UserTableDef]
|
||||
|
||||
def insert(meetingProps: DefaultProps) = {
|
||||
DatabaseConnection.db.run(
|
||||
TableQuery[MeetingDbTableDef].forceInsert(
|
||||
|
@ -1,41 +1,52 @@
|
||||
package org.bigbluebutton.core.db
|
||||
|
||||
import com.github.tminglei.slickpg._
|
||||
import spray.json.{ JsArray, JsBoolean, JsNumber, JsObject, JsString, JsValue, JsonWriter }
|
||||
import spray.json.{ _ }
|
||||
|
||||
trait PostgresProfile extends ExPostgresProfile
|
||||
with PgArraySupport // with PgDate2Support
|
||||
// with PgRangeSupport
|
||||
// with PgHStoreSupport
|
||||
// with PgPlayJsonSupport
|
||||
// with PgSearchSupport
|
||||
// with PgPostGISSupport
|
||||
// with PgNetSupport
|
||||
// with PgLTreeSupport
|
||||
{
|
||||
def pgjson = "jsonb" // jsonb support is in postgres 9.4.0 onward; for 9.3.x use "json"
|
||||
with PgArraySupport {
|
||||
// def pgjson = "jsonb" // jsonb support is in postgres 9.4.0 onward; for 9.3.x use "json"
|
||||
|
||||
// Add back `capabilities.insertOrUpdate` to enable native `upsert` support; for postgres 9.5+
|
||||
override protected def computeCapabilities: Set[slick.basic.Capability] =
|
||||
super.computeCapabilities + slick.jdbc.JdbcCapabilities.insertOrUpdate
|
||||
|
||||
override val api = MyAPI
|
||||
override val api = PgAPI
|
||||
|
||||
object MyAPI extends API with ArrayImplicits // with DateTimeImplicits
|
||||
// with JsonImplicits
|
||||
// with NetImplicits
|
||||
// with LTreeImplicits
|
||||
// with RangeImplicits
|
||||
// with HStoreImplicits
|
||||
// with SearchImplicits
|
||||
// with SearchAssistants
|
||||
object PgAPI extends API with ArrayImplicits // with DateTimeImplicits
|
||||
{
|
||||
implicit val strListTypeMapper = new SimpleArrayJdbcType[String]("text").to(_.toList)
|
||||
// implicit val playJsonArrayTypeMapper =
|
||||
// new AdvancedArrayJdbcType[JsValue](pgjson,
|
||||
// (s) => utils.SimpleArrayUtils.fromString[JsValue](Json.parse(_))(s).orNull,
|
||||
// (v) => utils.SimpleArrayUtils.mkString[JsValue](_.toString())(v)
|
||||
// ).to(_.toList)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object PostgresProfile extends PostgresProfile
|
||||
object PostgresProfile extends PostgresProfile
|
||||
|
||||
object JsonUtils {
|
||||
implicit object AnyJsonWriter extends JsonWriter[Any] {
|
||||
def write(x: Any): JsValue = x match {
|
||||
case n: Int => JsNumber(n)
|
||||
case s: String => JsString(s)
|
||||
case b: Boolean => JsBoolean(b)
|
||||
case f: Float => JsNumber(f)
|
||||
case d: Double => JsNumber(d)
|
||||
case m: Map[_, _] => JsObject(m.asInstanceOf[Map[String, Any]].map { case (k, v) => k -> write(v) })
|
||||
case l: List[_] => JsArray(l.map(write).toVector)
|
||||
case _ => throw new IllegalArgumentException(s"Unsupported type: ${x.getClass.getName}")
|
||||
// case _ => JsNull
|
||||
}
|
||||
}
|
||||
|
||||
// Cria um JsonWriter implícito para o tipo Map[String, Any]
|
||||
implicit val mapFormat: JsonWriter[Map[String, Any]] = new JsonWriter[Map[String, Any]] {
|
||||
def write(m: Map[String, Any]): JsValue = {
|
||||
JsObject(m.map { case (k, v) => k -> AnyJsonWriter.write(v) })
|
||||
}
|
||||
}
|
||||
|
||||
def mapToJson(genericMap: Map[String, Any]) = {
|
||||
genericMap.toJson.compactPrint
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,8 @@
|
||||
package org.bigbluebutton.core.db
|
||||
|
||||
import org.bigbluebutton.common2.msgs.AnnotationVO
|
||||
import slick.jdbc.PostgresProfile.api._
|
||||
import spray.json.{ JsValue, _ }
|
||||
|
||||
import scala.concurrent.Await
|
||||
import PostgresProfile.api._
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.concurrent.duration.Duration
|
||||
import scala.util.{ Failure, Success }
|
||||
|
||||
case class PresAnnotationDbModel(
|
||||
@ -30,45 +26,6 @@ class PresAnnotationDbTableDef(tag: Tag) extends Table[PresAnnotationDbModel](ta
|
||||
}
|
||||
|
||||
object PresAnnotationDAO {
|
||||
implicit object AnyJsonWriter extends JsonWriter[Any] {
|
||||
def write(x: Any): JsValue = x match {
|
||||
case n: Int => JsNumber(n)
|
||||
case s: String => JsString(s)
|
||||
case b: Boolean => JsBoolean(b)
|
||||
case f: Float => JsNumber(f)
|
||||
case d: Double => JsNumber(d)
|
||||
case m: Map[_, _] => JsObject(m.asInstanceOf[Map[String, Any]].map { case (k, v) => k -> write(v) })
|
||||
case l: List[_] => JsArray(l.map(write).toVector)
|
||||
case _ => throw new IllegalArgumentException(s"Unsupported type: ${x.getClass.getName}")
|
||||
// case _ => JsNull
|
||||
}
|
||||
}
|
||||
|
||||
// Cria um JsonWriter implícito para o tipo Map[String, Any]
|
||||
implicit val mapFormat: JsonWriter[Map[String, Any]] = new JsonWriter[Map[String, Any]] {
|
||||
def write(m: Map[String, Any]): JsValue = {
|
||||
JsObject(m.map { case (k, v) => k -> AnyJsonWriter.write(v) })
|
||||
}
|
||||
}
|
||||
|
||||
// def insertOrUpdate(annotation: AnnotationVO) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[PresAnnotationDbTableDef].insertOrUpdate(
|
||||
// PresAnnotationDbModel(
|
||||
// annotationId = annotation.id,
|
||||
// pageId = annotation.wbId,
|
||||
// userId = annotation.userId,
|
||||
// annotationInfo = annotation.annotationInfo.toMap.toJson.compactPrint,
|
||||
// // annotationInfo = annotation.annotationInfo.toString(),
|
||||
// lastUpdatedAt = new java.sql.Timestamp(System.currentTimeMillis())
|
||||
// )
|
||||
// )
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) inserted on PresAnnotation table!")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error inserting PresAnnotation: $e")
|
||||
// }
|
||||
// }
|
||||
|
||||
def insertOrUpdate(annotation: AnnotationVO, annotationDiff: AnnotationVO) = {
|
||||
PresAnnotationHistoryDAO.insert(annotationDiff).onComplete {
|
||||
case Success(sequence) => {
|
||||
@ -79,7 +36,7 @@ object PresAnnotationDAO {
|
||||
annotationId = annotation.id,
|
||||
pageId = annotation.wbId,
|
||||
userId = annotation.userId,
|
||||
annotationInfo = annotation.annotationInfo.toJson.compactPrint,
|
||||
annotationInfo = JsonUtils.mapToJson(annotation.annotationInfo),
|
||||
lastHistorySequence = sequence.getOrElse(0),
|
||||
lastUpdatedAt = new java.sql.Timestamp(System.currentTimeMillis())
|
||||
)
|
||||
|
@ -1,11 +1,7 @@
|
||||
package org.bigbluebutton.core.db
|
||||
|
||||
import org.bigbluebutton.common2.msgs.AnnotationVO
|
||||
import slick.jdbc.PostgresProfile.api._
|
||||
import spray.json.{ JsValue, _ }
|
||||
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.util.{ Failure, Success }
|
||||
import PostgresProfile.api._
|
||||
|
||||
case class PresAnnotationHistoryDbModel(
|
||||
sequence: Option[Int] = None,
|
||||
@ -28,26 +24,6 @@ class PresAnnotationHistoryDbTableDef(tag: Tag) extends Table[PresAnnotationHist
|
||||
}
|
||||
|
||||
object PresAnnotationHistoryDAO {
|
||||
implicit object AnyJsonWriter extends JsonWriter[Any] {
|
||||
def write(x: Any): JsValue = x match {
|
||||
case n: Int => JsNumber(n)
|
||||
case s: String => JsString(s)
|
||||
case b: Boolean => JsBoolean(b)
|
||||
case f: Float => JsNumber(f)
|
||||
case d: Double => JsNumber(d)
|
||||
case m: Map[_, _] => JsObject(m.asInstanceOf[Map[String, Any]].map { case (k, v) => k -> write(v) })
|
||||
case l: List[_] => JsArray(l.map(write).toVector)
|
||||
case _ => throw new IllegalArgumentException(s"Unsupported type: ${x.getClass.getName}")
|
||||
// case _ => JsNull
|
||||
}
|
||||
}
|
||||
|
||||
// Cria um JsonWriter implícito para o tipo Map[String, Any]
|
||||
implicit val mapFormat: JsonWriter[Map[String, Any]] = new JsonWriter[Map[String, Any]] {
|
||||
def write(m: Map[String, Any]): JsValue = {
|
||||
JsObject(m.map { case (k, v) => k -> AnyJsonWriter.write(v) })
|
||||
}
|
||||
}
|
||||
|
||||
def insert(annotationDiff: AnnotationVO) = {
|
||||
DatabaseConnection.db.run(
|
||||
@ -58,7 +34,7 @@ object PresAnnotationHistoryDAO {
|
||||
annotationId = annotationDiff.id,
|
||||
pageId = annotationDiff.wbId,
|
||||
userId = annotationDiff.userId,
|
||||
annotationInfo = annotationDiff.annotationInfo.toJson.compactPrint
|
||||
annotationInfo = JsonUtils.mapToJson(annotationDiff.annotationInfo)
|
||||
)
|
||||
)
|
||||
}
|
||||
@ -75,44 +51,5 @@ object PresAnnotationHistoryDAO {
|
||||
annotationInfo = ""
|
||||
)
|
||||
)
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[PresAnnotationDbTableDef]
|
||||
// .filter(_.annotationId === annotationId)
|
||||
// .map(a => (a.annotationInfo, a.lastUpdatedAt))
|
||||
// .update("", new java.sql.Timestamp(System.currentTimeMillis()))
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated annotationInfo=null on PresAnnotation table!")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error updating annotationInfo=null PresAnnotation: $e")
|
||||
// }
|
||||
}
|
||||
|
||||
// def insertOrUpdate(annotation: AnnotationVO) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[PresAnnotationHistoryDbTableDef].insertOrUpdate(
|
||||
// PresAnnotationHistoryDbModel(
|
||||
// sequence = None,
|
||||
// annotationId = annotation.id,
|
||||
// pageId = annotation.wbId,
|
||||
// userId = annotation.userId,
|
||||
// annotationInfo = annotation.annotationInfo.toJson.compactPrint
|
||||
// )
|
||||
// )
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) inserted on PresAnnotationHistory table!")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error inserting PresAnnotationHistory: $e")
|
||||
// }
|
||||
// }
|
||||
|
||||
// def delete(annotationId: String) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[PresAnnotationHistoryDbTableDef]
|
||||
// .filter(_.annotationId === annotationId)
|
||||
// .map(a => (a.annotationInfo))
|
||||
// .update(""))
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated annotationInfo=null on PresAnnotationHistory table!")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error updating annotationInfo=null PresAnnotationHistory: $e")
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package org.bigbluebutton.core.db
|
||||
|
||||
import org.bigbluebutton.common2.msgs.AnnotationVO
|
||||
import org.bigbluebutton.core.models.PresentationInPod
|
||||
import slick.jdbc.PostgresProfile.api._
|
||||
|
||||
@ -29,18 +28,13 @@ class PresPageDbTableDef(tag: Tag) extends Table[PresPageDbModel](tag, None, "pr
|
||||
val yOffset = column[Double]("yOffset")
|
||||
val widthRatio = column[Double]("widthRatio")
|
||||
val heightRatio = column[Double]("heightRatio")
|
||||
|
||||
// val presentation = foreignKey("presentation_fk", presentationId, Presentations)(_.presentationId, onDelete = ForeignKeyAction.Cascade)
|
||||
def * = (pageId, presentationId, num, urls, current, xOffset, yOffset, widthRatio, heightRatio) <> (PresPageDbModel.tupled, PresPageDbModel.unapply)
|
||||
}
|
||||
|
||||
object PresPageDAO {
|
||||
|
||||
// def setCurrentPage(wbId: String, userId: String, annotationId: String) = {
|
||||
def setCurrentPage(presentation: PresentationInPod, pageId: String) = {
|
||||
|
||||
// val updateSql =
|
||||
|
||||
DatabaseConnection.db.run(
|
||||
sqlu"""UPDATE pres_page SET
|
||||
"current" = (case when "pageId" = ${pageId} then true else false end)
|
||||
|
@ -6,7 +6,6 @@ import org.bigbluebutton.core.models.{ PresentationInPod }
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.util.{ Failure, Success }
|
||||
import spray.json._
|
||||
//import DefaultJsonProtocol._
|
||||
|
||||
case class PresPresentationDbModel(presentationId: String, meetingId: String, current: Boolean, downloadable: Boolean, removable: Boolean)
|
||||
|
||||
@ -16,7 +15,6 @@ class PresPresentationDbTableDef(tag: Tag) extends Table[PresPresentationDbModel
|
||||
val current = column[Boolean]("current")
|
||||
val downloadable = column[Boolean]("downloadable")
|
||||
val removable = column[Boolean]("removable")
|
||||
|
||||
// val meeting = foreignKey("meeting_fk", meetingId, Meetings)(_.meetingId, onDelete = ForeignKeyAction.Cascade)
|
||||
|
||||
def * = (presentationId, meetingId, current, downloadable, removable) <> (PresPresentationDbModel.tupled, PresPresentationDbModel.unapply)
|
||||
|
@ -67,8 +67,6 @@ class UserDbTableDef(tag: Tag) extends Table[UserDbModel](tag, None, "user") {
|
||||
}
|
||||
|
||||
object UserDAO {
|
||||
// val usersTable = TableQuery[UserTableDef]
|
||||
|
||||
def insert(meetingId: String, regUser: RegisteredUser) = {
|
||||
DatabaseConnection.db.run(
|
||||
TableQuery[UserDbTableDef].forceInsert(
|
||||
@ -126,17 +124,6 @@ object UserDAO {
|
||||
}
|
||||
}
|
||||
|
||||
// def delete(regUser: RegisteredUser) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[UserDbTableDef]
|
||||
// .filter(_.userId === regUser.id)
|
||||
// .delete
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"User ${regUser.id} deleted")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error deleting user ${regUser.id}: $e")
|
||||
// }
|
||||
// }
|
||||
|
||||
def delete(intId: String) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[UserDbTableDef]
|
||||
@ -169,14 +156,5 @@ object UserDAO {
|
||||
}
|
||||
}
|
||||
|
||||
// def insert(user: UserDbModel) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[UserDbTableDef].forceInsert(user)
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error updating user: $e")
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
@ -50,8 +50,6 @@ class UserVoiceDbTableDef(tag: Tag) extends Table[UserVoiceDbModel](tag, None, "
|
||||
|
||||
|
||||
object UserVoiceDAO {
|
||||
// val usersTable = TableQuery[UserTableDef]
|
||||
|
||||
def insert(voiceUserState: VoiceUserState) = {
|
||||
DatabaseConnection.db.run(
|
||||
TableQuery[UserVoiceDbTableDef].insertOrUpdate(
|
||||
@ -95,7 +93,6 @@ object UserVoiceDAO {
|
||||
}
|
||||
|
||||
def updateTalking(voiceUserState: VoiceUserState) = {
|
||||
// DatabaseConnection.db.run(sql"SELECT * FROM $users".as[(Int, Double, String)]).onComplete {
|
||||
val now = System.currentTimeMillis()
|
||||
|
||||
val updateSql = if(voiceUserState.talking) {
|
||||
|
@ -27,7 +27,7 @@ object Users2x {
|
||||
}
|
||||
|
||||
def remove(users: Users2x, intId: String): Option[UserState] = {
|
||||
UserDAO.delete(intId) //TODO maybe just flag online=false, instead of delete
|
||||
UserDAO.delete(intId)
|
||||
users.remove(intId)
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ object Users2x {
|
||||
_ <- users.remove(intId)
|
||||
ejectedUser <- users.removeFromCache(intId)
|
||||
} yield {
|
||||
UserDAO.delete(intId) //TODO maybe just flag online=false, instead of delete
|
||||
UserDAO.delete(intId)
|
||||
ejectedUser
|
||||
}
|
||||
}
|
||||
|
@ -13,5 +13,12 @@ object RandomStringGenerator {
|
||||
// Generate a random alphabnumeric string of length n
|
||||
def randomAlphanumericString(n: Int) =
|
||||
randomString("abcdefghijklmnopqrstuvwxyz0123456789")(n)
|
||||
|
||||
def randomColor = {
|
||||
val colorOptions = List("#7b1fa2", "#6a1b9a", "#4a148c", "#5e35b1", "#512da8", "#4527a0", "#311b92",
|
||||
"#3949ab", "#303f9f", "#283593", "#1a237e", "#1976d2", "#1565c0", "#0d47a1", "#0277bd", "#01579b")
|
||||
colorOptions(random.nextInt(colorOptions.length))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user