Added audio caption table
This commit is contained in:
parent
ba239f7b05
commit
3d86f0fd5a
@ -2,6 +2,7 @@ package org.bigbluebutton.core.apps.audiocaptions
|
||||
|
||||
import org.bigbluebutton.common2.msgs._
|
||||
import org.bigbluebutton.core.bus.MessageBus
|
||||
import org.bigbluebutton.core.db.AudioCaptionDAO
|
||||
import org.bigbluebutton.core.models.AudioCaptions
|
||||
import org.bigbluebutton.core.running.LiveMeeting
|
||||
|
||||
@ -12,6 +13,8 @@ trait UpdateTranscriptPubMsgHdlr {
|
||||
val meetingId = liveMeeting.props.meetingProp.intId
|
||||
|
||||
def broadcastEvent(userId: String, transcriptId: String, transcript: String, locale: String, result: Boolean): Unit = {
|
||||
AudioCaptionDAO.insertOrUpdateAudioCaption(transcriptId, meetingId, transcript)
|
||||
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, "nodeJSapp")
|
||||
val envelope = BbbCoreEnvelope(TranscriptUpdatedEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(TranscriptUpdatedEvtMsg.NAME, meetingId, userId)
|
||||
|
50
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/AudioCaptionDAO.scala
Executable file
50
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/AudioCaptionDAO.scala
Executable file
@ -0,0 +1,50 @@
|
||||
package org.bigbluebutton.core.db
|
||||
|
||||
import slick.jdbc.PostgresProfile.api._
|
||||
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.util.{ Failure, Success }
|
||||
|
||||
case class AudioCaptionDbModel(
|
||||
transcriptId: String,
|
||||
meetingId: String,
|
||||
transcript: String
|
||||
)
|
||||
|
||||
class AudioCaptionTableDef(tag: Tag) extends Table[AudioCaptionDbModel](tag, None, "audio_caption") {
|
||||
val transcriptId = column[String]("transcriptId", O.PrimaryKey)
|
||||
val meetingId = column[String]("meetingId")
|
||||
val transcript = column[String]("transcript")
|
||||
def * = (transcriptId, meetingId, transcript) <> (AudioCaptionDbModel.tupled, AudioCaptionDbModel.unapply)
|
||||
}
|
||||
|
||||
object AudioCaptionDAO {
|
||||
|
||||
def insertOrUpdateAudioCaption(transcriptId: String, meetingId: String, transcript: String) = {
|
||||
// DatabaseConnection.db.run(
|
||||
// TableQuery[AudioCaptionTableDef]
|
||||
// .filter(_.transcriptId === transcriptId)
|
||||
// .map(a => a.transcript)
|
||||
// .update((transcript))
|
||||
// ).onComplete {
|
||||
// case Success(rowsAffected) => rowsAffected match {
|
||||
// case 0 => DatabaseConnection.db.run(
|
||||
// TableQuery[AudioCaptionTableDef] += AudioCaptionDbModel(transcriptId, meetingId, transcript)
|
||||
// ).onComplete {
|
||||
// case Success => DatabaseConnection.logger.debug(s"Inserted new audio caption with ID $transcriptId on AudioCaption table")
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error inserting or updating audio caption on AudioCaption: $e")
|
||||
// }
|
||||
// case 1 => DatabaseConnection.logger.debug(s"Updated audio caption with ID $transcriptId on AudioCaption table")
|
||||
// case n => DatabaseConnection.logger.debug(s"Error: Expected to insert or update a single row not $n rows")
|
||||
// }
|
||||
// case Failure(e) => DatabaseConnection.logger.debug(s"Error updating audio caption on AudioCaption: $e")
|
||||
// }
|
||||
TableQuery[AudioCaptionTableDef].insertOrUpdate(
|
||||
AudioCaptionDbModel(
|
||||
transcriptId = transcriptId,
|
||||
meetingId = meetingId,
|
||||
transcript = transcript
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
@ -1282,3 +1282,15 @@ CREATE OR REPLACE VIEW "v_current_time" AS
|
||||
SELECT
|
||||
current_timestamp AS "currentTimestamp",
|
||||
FLOOR(EXTRACT(EPOCH FROM current_timestamp) * 1000)::bigint AS "currentTimeMillis";
|
||||
|
||||
------------------------------------
|
||||
----audioCaption
|
||||
|
||||
CREATE TABLE "audio_caption" (
|
||||
"transcriptId" varchar(100) NOT NULL PRIMARY KEY,
|
||||
"meetingId" varchar(100) REFERENCES "meeting"("meetingId") ON DELETE CASCADE,
|
||||
"transcript" text
|
||||
);
|
||||
|
||||
CREATE VIEW "v_audio_caption" AS
|
||||
SELECT * FROM "audio_caption";
|
@ -0,0 +1,13 @@
|
||||
table:
|
||||
name: v_audio_caption
|
||||
schema: public
|
||||
select_permissions:
|
||||
- role: bbb_client
|
||||
permission:
|
||||
columns:
|
||||
- transcriptId
|
||||
- meetingId
|
||||
- transcript
|
||||
filter:
|
||||
meetingId:
|
||||
_eq: X-Hasura-PresenterInMeeting
|
@ -1,15 +1,14 @@
|
||||
- "!include public_v_chat_user.yaml"
|
||||
- "!include public_v_meeting.yaml"
|
||||
- "!include public_v_user_connectionStatus.yaml"
|
||||
- "!include public_v_user_localSettings.yaml"
|
||||
- "!include public_v_audio_caption.yaml"
|
||||
- "!include public_v_breakoutRoom.yaml"
|
||||
- "!include public_v_breakoutRoom_assignedUser.yaml"
|
||||
- "!include public_v_breakoutRoom_participant.yaml"
|
||||
- "!include public_v_chat.yaml"
|
||||
- "!include public_v_chat_message_private.yaml"
|
||||
- "!include public_v_chat_message_public.yaml"
|
||||
- "!include public_v_chat_user.yaml"
|
||||
- "!include public_v_current_time.yaml"
|
||||
- "!include public_v_external_video.yaml"
|
||||
- "!include public_v_meeting.yaml"
|
||||
- "!include public_v_meeting_breakoutPolicies.yaml"
|
||||
- "!include public_v_meeting_group.yaml"
|
||||
- "!include public_v_meeting_lockSettings.yaml"
|
||||
@ -34,10 +33,12 @@
|
||||
- "!include public_v_user.yaml"
|
||||
- "!include public_v_user_breakoutRoom.yaml"
|
||||
- "!include public_v_user_camera.yaml"
|
||||
- "!include public_v_user_connectionStatus.yaml"
|
||||
- "!include public_v_user_connectionStatusReport.yaml"
|
||||
- "!include public_v_user_current.yaml"
|
||||
- "!include public_v_user_customParameter.yaml"
|
||||
- "!include public_v_user_guest.yaml"
|
||||
- "!include public_v_user_localSettings.yaml"
|
||||
- "!include public_v_user_reaction.yaml"
|
||||
- "!include public_v_user_reaction_current.yaml"
|
||||
- "!include public_v_user_ref.yaml"
|
||||
|
Loading…
Reference in New Issue
Block a user