Move Timer init to akka-apps (instead of Meteor)

This commit is contained in:
Gustavo Trott 2024-04-25 11:02:03 -03:00
parent a527ea659d
commit ab97cc60a2
3 changed files with 24 additions and 17 deletions

View File

@ -144,7 +144,7 @@ object MeetingDAO {
MeetingWelcomeDAO.insert(meetingProps.meetingProp.intId, meetingProps.welcomeProp)
MeetingGroupDAO.insert(meetingProps.meetingProp.intId, meetingProps.groups)
MeetingBreakoutDAO.insert(meetingProps.meetingProp.intId, meetingProps.breakoutProps)
TimerDAO.insert(meetingProps.meetingProp.intId)
TimerDAO.insert(meetingProps.meetingProp.intId, clientSettings)
LayoutDAO.insert(meetingProps.meetingProp.intId, meetingProps.usersProp.meetingLayout)
MeetingClientSettingsDAO.insert(meetingProps.meetingProp.intId, JsonUtils.mapToJson(clientSettings))
}

View File

@ -1,5 +1,6 @@
package org.bigbluebutton.core.db
import org.bigbluebutton.ClientSettings.{getConfigPropertyValueByPathAsBooleanOrElse, getConfigPropertyValueByPathAsIntOrElse}
import org.bigbluebutton.core.apps.TimerModel
import org.bigbluebutton.core.apps.TimerModel.{getAccumulated, getEndedAt, getIsActive, getRunning, getStartedAt, getStopwatch, getTime, getTrack}
import slick.jdbc.PostgresProfile.api._
@ -33,25 +34,31 @@ class TimerDbTableDef(tag: Tag) extends Table[TimerDbModel](tag, None, "timer")
}
object TimerDAO {
def insert(meetingId: String) = {
DatabaseConnection.db.run(
TableQuery[TimerDbTableDef].insertOrUpdate(
TimerDbModel(
meetingId = meetingId,
stopwatch = true,
running = false,
active = false,
time = 300000,
accumulated = 0,
startedOn = 0,
endedOn = 0,
songTrack = "noTrack",
def insert(meetingId: String, clientSettings: Map[String, Object]) = {
val timerEnabled = getConfigPropertyValueByPathAsBooleanOrElse(clientSettings, "public.timer.enabled", alternativeValue = true)
if(timerEnabled) {
val timerDefaultTimeInMinutes = getConfigPropertyValueByPathAsIntOrElse(clientSettings, "public.timer.time", 5)
val timerDefaultTimeInMilli = timerDefaultTimeInMinutes * 60000
DatabaseConnection.db.run(
TableQuery[TimerDbTableDef].insertOrUpdate(
TimerDbModel(
meetingId = meetingId,
stopwatch = true,
running = false,
active = false,
time = timerDefaultTimeInMilli,
accumulated = 0,
startedOn = 0,
endedOn = 0,
songTrack = "noTrack",
)
)
)
).onComplete {
).onComplete {
case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) inserted on Timer table!")
case Failure(e) => DatabaseConnection.logger.debug(s"Error inserting Timer: $e")
}
}
}
def update(meetingId: String, timerModel: TimerModel) = {

View File

@ -228,7 +228,7 @@ export default async function addMeeting(meeting) {
if (insertedId) {
Logger.info(`Added meeting id=${meetingId}`);
// Init Timer collection
createTimer(meetingId);
// createTimer(meetingId);
if (newMeeting.meetingProp.disabledFeatures.indexOf('sharedNotes') === -1) {
initPads(meetingId);
}