Remove presentation from Postgres when presentation is deleted

This commit is contained in:
Paul Trudel 2023-09-27 14:59:36 +00:00
parent 49d60f6f88
commit 7dee20c3ec
2 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package org.bigbluebutton.core.apps.presentationpod
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.apps.{ PermissionCheck, RightsManagementTrait }
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.db.PresPresentationDAO
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.running.LiveMeeting
@ -38,6 +39,8 @@ trait RemovePresentationPubMsgHdlr extends RightsManagementTrait {
val podId = msg.body.podId
val presentationId = msg.body.presentationId
PresPresentationDAO.delete(presentationId)
val newState = for {
pod <- PresentationPodsApp.getPresentationPod(state, podId)
} yield {

View File

@ -114,4 +114,15 @@ object PresPresentationDAO {
}
}
def delete(presentationId: String) = {
DatabaseConnection.db.run(
TableQuery[PresPresentationDbTableDef]
.filter(_.presentationId === presentationId)
.delete
).onComplete {
case Success(rowAffected) => DatabaseConnection.logger.debug(s"$rowAffected row(s) deleted presentation on PresPresentation table")
case Failure(e) => DatabaseConnection.logger.error(s"Error deleting presentation on PresPresentation: $e")
}
}
}