Merge pull request #18932 from gustavotrott/graphql-moderator-always-unlocked

refactor (graphql): Displays `locked: false` while user is Moderator, Rename `meeting.duration` to `durationInSeconds`
This commit is contained in:
Gustavo Trott 2023-10-12 10:32:59 -03:00 committed by GitHub
commit 3aa025fff1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 24 deletions

View File

@ -70,7 +70,7 @@ trait CreateBreakoutRoomsCmdMsgHdlr extends RightsManagementTrait {
breakout.freeJoin,
liveMeeting.props.voiceProp.dialNumber,
breakout.voiceConf,
msg.body.durationInMinutes * 60,
msg.body.durationInMinutes,
liveMeeting.props.password.moderatorPass,
liveMeeting.props.password.viewerPass,
presId, presSlide, msg.body.record,

View File

@ -20,7 +20,7 @@ case class MeetingDbModel(
presentationUploadExternalUrl: String,
learningDashboardAccessToken: String,
createdTime: Long,
duration: Int
durationInSeconds: Int
)
class MeetingDbTableDef(tag: Tag) extends Table[MeetingDbModel](tag, None, "meeting") {
@ -37,7 +37,7 @@ class MeetingDbTableDef(tag: Tag) extends Table[MeetingDbModel](tag, None, "meet
presentationUploadExternalUrl,
learningDashboardAccessToken,
createdTime,
duration
durationInSeconds
) <> (MeetingDbModel.tupled, MeetingDbModel.unapply)
val meetingId = column[String]("meetingId", O.PrimaryKey)
val extId = column[String]("extId")
@ -51,7 +51,7 @@ class MeetingDbTableDef(tag: Tag) extends Table[MeetingDbModel](tag, None, "meet
val presentationUploadExternalUrl = column[String]("presentationUploadExternalUrl")
val learningDashboardAccessToken = column[String]("learningDashboardAccessToken")
val createdTime = column[Long]("createdTime")
val duration = column[Int]("duration")
val durationInSeconds = column[Int]("durationInSeconds")
}
object MeetingDAO {
@ -71,7 +71,7 @@ object MeetingDAO {
presentationUploadExternalUrl = meetingProps.meetingProp.presentationUploadExternalUrl,
learningDashboardAccessToken = meetingProps.password.learningDashboardAccessToken,
createdTime = meetingProps.durationProps.createdTime,
duration = meetingProps.durationProps.duration
durationInSeconds = meetingProps.durationProps.duration * 60
)
)
).onComplete {
@ -103,11 +103,11 @@ object MeetingDAO {
DatabaseConnection.db.run(
TableQuery[MeetingDbTableDef]
.filter(_.extId in subqueryBreakoutRooms)
.map(u => u.duration)
.map(u => u.durationInSeconds)
.update(newDurationInSeconds)
).onComplete {
case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated duration on Meeting table")
case Failure(e) => DatabaseConnection.logger.debug(s"Error updating duration on Meeting: $e")
case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) updated durationInSeconds on Meeting table")
case Failure(e) => DatabaseConnection.logger.debug(s"Error updating durationInSeconds on Meeting: $e")
}
}

View File

@ -7,19 +7,19 @@ import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.{ Failure, Success }
case class UserReactionDbModel(
userId: String,
reactionEmoji: String,
duration: Int,
createdAt: java.sql.Timestamp
userId: String,
reactionEmoji: String,
durationInSeconds: Int,
createdAt: java.sql.Timestamp
)
class UserReactionDbTableDef(tag: Tag) extends Table[UserReactionDbModel](tag, "user_reaction") {
val userId = column[String]("userId")
val reactionEmoji = column[String]("reactionEmoji")
val duration = column[Int]("duration")
val durationInSeconds = column[Int]("durationInSeconds")
val createdAt = column[java.sql.Timestamp]("createdAt")
override def * : ProvenShape[UserReactionDbModel] = (userId, reactionEmoji, duration, createdAt) <> (UserReactionDbModel.tupled, UserReactionDbModel.unapply)
override def * : ProvenShape[UserReactionDbModel] = (userId, reactionEmoji, durationInSeconds, createdAt) <> (UserReactionDbModel.tupled, UserReactionDbModel.unapply)
}
object UserReactionDAO {
@ -29,7 +29,7 @@ object UserReactionDAO {
UserReactionDbModel(
userId = userId,
reactionEmoji = reactionEmoji,
duration = 60,
durationInSeconds = 60,
createdAt = new java.sql.Timestamp(System.currentTimeMillis())
)
)

View File

@ -21,7 +21,7 @@ create table "meeting" (
"learningDashboardAccessToken" varchar(100),
"html5InstanceId" varchar(100),
"createdTime" bigint,
"duration" integer
"durationInSeconds" integer
);
create index "idx_meeting_extId" on "meeting"("extId");
@ -349,7 +349,7 @@ AS SELECT "user"."userId",
"user"."registeredAt",
"user"."presenter",
"user"."pinned",
"user"."locked",
CASE WHEN "user"."role" = 'MODERATOR' THEN false ELSE "user"."locked" END "locked",
"user"."speechLocale",
CASE WHEN "user"."echoTestRunningAt" > current_timestamp - INTERVAL '3 seconds' THEN TRUE ELSE FALSE END "isRunningEchoTest",
"user"."hasDrawPermissionOnCurrentPage",
@ -403,7 +403,7 @@ AS SELECT "user"."userId",
"user"."registeredAt",
"user"."presenter",
"user"."pinned",
"user"."locked",
CASE WHEN "user"."role" = 'MODERATOR' THEN false ELSE "user"."locked" END "locked",
"user"."speechLocale",
"user"."hasDrawPermissionOnCurrentPage",
"user"."echoTestRunningAt",
@ -451,7 +451,7 @@ AS SELECT "user"."userId",
"user"."registeredAt",
"user"."presenter",
"user"."pinned",
"user"."locked",
CASE WHEN "user"."role" = 'MODERATOR' THEN false ELSE "user"."locked" END "locked",
"user"."speechLocale",
"user"."hasDrawPermissionOnCurrentPage",
CASE WHEN "user"."role" = 'MODERATOR' THEN true ELSE false END "isModerator",
@ -700,7 +700,7 @@ create view "v_user_localSettings" as select * from "user_localSettings";
CREATE TABLE "user_reaction" (
"userId" varchar(50) REFERENCES "user"("userId") ON DELETE CASCADE,
"reactionEmoji" varchar(25),
"duration" integer not null,
"durationInSeconds" integer not null,
"createdAt" timestamp with time zone not null,
"expiresAt" timestamp with time zone
);
@ -708,7 +708,7 @@ CREATE TABLE "user_reaction" (
--Set expiresAt on isert or update user_reaction
CREATE OR REPLACE FUNCTION "update_user_reaction_trigger_func"() RETURNS TRIGGER AS $$
BEGIN
NEW."expiresAt" := NEW."createdAt" + '1 seconds'::INTERVAL * NEW."duration";
NEW."expiresAt" := NEW."createdAt" + '1 seconds'::INTERVAL * NEW."durationInSeconds";
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
@ -719,7 +719,7 @@ CREATE TRIGGER "update_user_reaction_trigger" BEFORE UPDATE ON "user_reaction"
CREATE TRIGGER "insert_user_reaction_trigger" BEFORE INSERT ON "user_reaction" FOR EACH ROW
EXECUTE FUNCTION "update_user_reaction_trigger_func"();
--ALTER TABLE "user_reaction" ADD COLUMN "expiresAt" timestamp with time zone GENERATED ALWAYS AS ("createdAt" + '1 seconds'::INTERVAL * "duration") STORED;
--ALTER TABLE "user_reaction" ADD COLUMN "expiresAt" timestamp with time zone GENERATED ALWAYS AS ("createdAt" + '1 seconds'::INTERVAL * "durationInSeconds") STORED;
CREATE INDEX "idx_user_reaction_userId_createdAt" ON "user_reaction"("userId", "expiresAt");

View File

@ -131,7 +131,7 @@ select_permissions:
columns:
- createdTime
- disabledFeatures
- duration
- durationInSeconds
- extId
- html5InstanceId
- isBreakout

View File

@ -5,7 +5,7 @@ const MEETING_SUBSCRIPTION = gql`
meeting {
createdTime
disabledFeatures
duration
durationInSeconds
extId
lockSettings {
disableCam