Merge pull request #18279 from gustavotrott/graphql-update-props
refactor (graphql-server): new prop user.speechLocale
This commit is contained in:
commit
55e4b94ac8
@ -25,11 +25,12 @@ case class UserStateDbModel(
|
||||
presenter: Boolean = false,
|
||||
pinned: Boolean = false,
|
||||
locked: Boolean = false,
|
||||
speechLocale: String,
|
||||
)
|
||||
|
||||
class UserStateDbTableDef(tag: Tag) extends Table[UserStateDbModel](tag, None, "user") {
|
||||
override def * = (
|
||||
userId,emoji,away,raiseHand,guestStatus,guestStatusSetByModerator,guestLobbyMessage,mobile,clientType,disconnected,expired,ejected,ejectReason,ejectReasonCode,ejectedByModerator,presenter,pinned,locked) <> (UserStateDbModel.tupled, UserStateDbModel.unapply)
|
||||
userId,emoji,away,raiseHand,guestStatus,guestStatusSetByModerator,guestLobbyMessage,mobile,clientType,disconnected,expired,ejected,ejectReason,ejectReasonCode,ejectedByModerator,presenter,pinned,locked,speechLocale) <> (UserStateDbModel.tupled, UserStateDbModel.unapply)
|
||||
val userId = column[String]("userId", O.PrimaryKey)
|
||||
val emoji = column[String]("emoji")
|
||||
val away = column[Boolean]("away")
|
||||
@ -48,6 +49,7 @@ class UserStateDbTableDef(tag: Tag) extends Table[UserStateDbModel](tag, None, "
|
||||
val presenter = column[Boolean]("presenter")
|
||||
val pinned = column[Boolean]("pinned")
|
||||
val locked = column[Boolean]("locked")
|
||||
val speechLocale = column[String]("speechLocale")
|
||||
}
|
||||
|
||||
object UserStateDAO {
|
||||
@ -55,8 +57,8 @@ object UserStateDAO {
|
||||
DatabaseConnection.db.run(
|
||||
TableQuery[UserStateDbTableDef]
|
||||
.filter(_.userId === userState.intId)
|
||||
.map(u => (u.presenter, u.pinned, u.locked, u.emoji, u.away, u.raiseHand, u.mobile, u.clientType, u.disconnected))
|
||||
.update((userState.presenter, userState.pin, userState.locked, userState.emoji, userState.away, userState.raiseHand, userState.mobile, userState.clientType, userState.userLeftFlag.left))
|
||||
.map(u => (u.presenter, u.pinned, u.locked, u.speechLocale, u.emoji, u.away, u.raiseHand, u.mobile, u.clientType, u.disconnected))
|
||||
.update((userState.presenter, userState.pin, userState.locked, userState.speechLocale, userState.emoji, userState.away, userState.raiseHand, userState.mobile, userState.clientType, userState.userLeftFlag.left))
|
||||
).onComplete {
|
||||
case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated on user table!")
|
||||
case Failure(e) => DatabaseConnection.logger.error(s"Error updating user: $e")
|
||||
|
@ -20,7 +20,6 @@ case class UserVoiceDbModel(
|
||||
floor: Boolean,
|
||||
lastFloorTime: String,
|
||||
voiceConf: String,
|
||||
color: String,
|
||||
startTime: Option[Long],
|
||||
endTime: Option[Long],
|
||||
)
|
||||
@ -28,7 +27,7 @@ case class UserVoiceDbModel(
|
||||
class UserVoiceDbTableDef(tag: Tag) extends Table[UserVoiceDbModel](tag, None, "user_voice") {
|
||||
override def * = (
|
||||
userId, voiceUserId, callerName, callerNum, callingWith, joined, listenOnly,
|
||||
muted, spoke, talking, floor, lastFloorTime, voiceConf, color, startTime, endTime
|
||||
muted, spoke, talking, floor, lastFloorTime, voiceConf, startTime, endTime
|
||||
) <> (UserVoiceDbModel.tupled, UserVoiceDbModel.unapply)
|
||||
val userId = column[String]("userId", O.PrimaryKey)
|
||||
val voiceUserId = column[String]("voiceUserId")
|
||||
@ -43,7 +42,6 @@ class UserVoiceDbTableDef(tag: Tag) extends Table[UserVoiceDbModel](tag, None, "
|
||||
val floor = column[Boolean]("floor")
|
||||
val lastFloorTime = column[String]("lastFloorTime")
|
||||
val voiceConf = column[String]("voiceConf")
|
||||
val color = column[String]("color")
|
||||
val startTime = column[Option[Long]]("startTime")
|
||||
val endTime = column[Option[Long]]("endTime")
|
||||
}
|
||||
@ -67,7 +65,6 @@ object UserVoiceDAO {
|
||||
floor = voiceUserState.floor,
|
||||
lastFloorTime = voiceUserState.lastFloorTime,
|
||||
voiceConf = "",
|
||||
color = "",
|
||||
startTime = None,
|
||||
endTime = None
|
||||
)
|
||||
|
@ -253,6 +253,7 @@ object Users2x {
|
||||
u <- findWithIntId(users, intId)
|
||||
} yield {
|
||||
val newUser = u.modify(_.speechLocale).setTo(locale)
|
||||
UserStateDAO.update(newUser)
|
||||
users.save(newUser)
|
||||
newUser
|
||||
}
|
||||
|
@ -285,6 +285,7 @@ CREATE TABLE "user" (
|
||||
"presenter" bool,
|
||||
"pinned" bool,
|
||||
"locked" bool,
|
||||
"speechLocale" varchar(255),
|
||||
"hasDrawPermissionOnCurrentPage" bool default FALSE
|
||||
);
|
||||
CREATE INDEX "idx_user_meetingId" ON "user"("meetingId");
|
||||
@ -371,6 +372,7 @@ AS SELECT "user"."userId",
|
||||
"user"."presenter",
|
||||
"user"."pinned",
|
||||
"user"."locked",
|
||||
"user"."speechLocale",
|
||||
"user"."hasDrawPermissionOnCurrentPage",
|
||||
CASE WHEN "user"."role" = 'MODERATOR' THEN true ELSE false END "isModerator",
|
||||
CASE WHEN "user"."joined" IS true AND "user"."expired" IS false AND "user"."loggedOut" IS false THEN true ELSE false END "isOnline"
|
||||
@ -419,6 +421,7 @@ AS SELECT "user"."userId",
|
||||
"user"."presenter",
|
||||
"user"."pinned",
|
||||
"user"."locked",
|
||||
"user"."speechLocale",
|
||||
"user"."hasDrawPermissionOnCurrentPage",
|
||||
CASE WHEN "user"."role" = 'MODERATOR' THEN true ELSE false END "isModerator"
|
||||
FROM "user";
|
||||
@ -462,6 +465,7 @@ AS SELECT "user"."userId",
|
||||
"user"."presenter",
|
||||
"user"."pinned",
|
||||
"user"."locked",
|
||||
"user"."speechLocale",
|
||||
"user"."hasDrawPermissionOnCurrentPage",
|
||||
CASE WHEN "user"."role" = 'MODERATOR' THEN true ELSE false END "isModerator",
|
||||
CASE WHEN "user"."joined" IS true AND "user"."expired" IS false AND "user"."loggedOut" IS false THEN true ELSE false END "isOnline"
|
||||
@ -503,7 +507,6 @@ CREATE TABLE "user_voice" (
|
||||
"floor" boolean,
|
||||
"lastFloorTime" varchar(25),
|
||||
"voiceConf" varchar(100),
|
||||
"color" varchar(7),
|
||||
"endTime" bigint,
|
||||
"startTime" bigint
|
||||
);
|
||||
|
@ -77,6 +77,7 @@ select_permissions:
|
||||
- disconnected
|
||||
- emoji
|
||||
- emojiTime
|
||||
- expired
|
||||
- extId
|
||||
- guest
|
||||
- guestStatus
|
||||
@ -95,6 +96,7 @@ select_permissions:
|
||||
- raiseHandTime
|
||||
- registeredOn
|
||||
- role
|
||||
- speechLocale
|
||||
- userId
|
||||
filter:
|
||||
_and:
|
||||
|
@ -123,6 +123,7 @@ select_permissions:
|
||||
- ejectReasonCode
|
||||
- ejected
|
||||
- emoji
|
||||
- expired
|
||||
- extId
|
||||
- guest
|
||||
- hasDrawPermissionOnCurrentPage
|
||||
@ -138,6 +139,7 @@ select_permissions:
|
||||
- raiseHand
|
||||
- registeredOn
|
||||
- role
|
||||
- speechLocale
|
||||
- userId
|
||||
filter:
|
||||
_and:
|
||||
|
@ -18,6 +18,7 @@ select_permissions:
|
||||
- color
|
||||
- disconnected
|
||||
- emoji
|
||||
- expired
|
||||
- extId
|
||||
- guest
|
||||
- guestStatus
|
||||
@ -35,6 +36,7 @@ select_permissions:
|
||||
- raiseHand
|
||||
- registeredOn
|
||||
- role
|
||||
- speechLocale
|
||||
- userId
|
||||
filter:
|
||||
meetingId:
|
||||
|
@ -23,7 +23,6 @@ select_permissions:
|
||||
- callerName
|
||||
- callerNum
|
||||
- callingWith
|
||||
- color
|
||||
- endTime
|
||||
- floor
|
||||
- joined
|
||||
|
Loading…
Reference in New Issue
Block a user