diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresAnnotationDAO.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresAnnotationDAO.scala index 83878499d3..8f8bb533c2 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresAnnotationDAO.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresAnnotationDAO.scala @@ -23,28 +23,23 @@ class PresAnnotationDbTableDef(tag: Tag) extends Table[PresAnnotationDbModel](ta } object PresAnnotationDAO { - - def prepareInsertOrUpdate(meetingId: String, annotation: AnnotationVO, annotationUpdatedAt: Long) = { - TableQuery[PresAnnotationDbTableDef].insertOrUpdate( - PresAnnotationDbModel( - annotationId = annotation.id, - pageId = annotation.wbId, - meetingId = meetingId, - userId = annotation.userId, - annotationInfo = JsonUtils.mapToJson(annotation.annotationInfo).compactPrint, - lastUpdatedAt = new java.sql.Timestamp(annotationUpdatedAt) - ) - ) - } - def insertOrUpdateMap(meetingId: String, annotations: Array[AnnotationVO], annotationUpdatedAt: Long) = { - DatabaseConnection.enqueue( - DBIO.sequence( - annotations.map { annotation => - prepareInsertOrUpdate(meetingId, annotation, annotationUpdatedAt) - }.toVector - ).transactionally - ) + for { + annotation <- annotations + } yield { + DatabaseConnection.enqueue( + TableQuery[PresAnnotationDbTableDef].insertOrUpdate( + PresAnnotationDbModel( + annotationId = annotation.id, + pageId = annotation.wbId, + meetingId = meetingId, + userId = annotation.userId, + annotationInfo = JsonUtils.mapToJson(annotation.annotationInfo).compactPrint, + lastUpdatedAt = new java.sql.Timestamp(annotationUpdatedAt) + ) + ) + ) + } } def deleteAnnotations(meetingId: String, userId: String, annotationIds: Array[String], annotationUpdatedAt: Long) = { diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresAnnotationHistoryDAO.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresAnnotationHistoryDAO.scala index 8a08367d89..d0889b487b 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresAnnotationHistoryDAO.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/PresAnnotationHistoryDAO.scala @@ -24,24 +24,8 @@ class PresAnnotationHistoryDbTableDef(tag: Tag) extends Table[PresAnnotationHist object PresAnnotationHistoryDAO { - def delete(wbId: String, meetingId: String, userId: String, annotationId: String, annotationUpdatedAt: Long) = { - DatabaseConnection.enqueue( - TableQuery[PresAnnotationHistoryDbTableDef].forceInsert( - PresAnnotationHistoryDbModel( - // None, - annotationId = annotationId, - pageId = wbId, - meetingId = meetingId, - userId = userId, - annotationInfo = "", - updatedAt = new java.sql.Timestamp(annotationUpdatedAt) - ) - ) - ) - } - - def prepareInsertOrUpdate(meetingId: String, annotation: AnnotationVO, annotationUpdatedAt: Long) = { - TableQuery[PresAnnotationHistoryDbTableDef].forceInsert( + def insertOrUpdateMap(meetingId: String, annotations: Array[AnnotationVO], annotationUpdatedAt: Long) = { + val dbModels = annotations.map { annotation => PresAnnotationHistoryDbModel( annotationId = annotation.id, pageId = annotation.wbId, @@ -50,21 +34,14 @@ object PresAnnotationHistoryDAO { annotationInfo = JsonUtils.mapToJson(annotation.annotationInfo).compactPrint, updatedAt = new java.sql.Timestamp(annotationUpdatedAt) ) - ) - } - - def insertOrUpdateMap(meetingId: String, annotations: Array[AnnotationVO], annotationUpdatedAt: Long) = { + } DatabaseConnection.enqueue( - DBIO.sequence( - annotations.map { annotation => - prepareInsertOrUpdate(meetingId, annotation, annotationUpdatedAt) - }.toVector - ).transactionally + TableQuery[PresAnnotationHistoryDbTableDef] ++= dbModels ) } - def prepareDelete(meetingId: String, pageId: String, annotationId: String, userId: String, annotationUpdatedAt: Long) = { - TableQuery[PresAnnotationHistoryDbTableDef].forceInsert( + def deleteAnnotations(meetingId: String, pageId: String, userId: String, annotations: Array[String], annotationUpdatedAt: Long) = { + val dbModels = annotations.map { annotationId => PresAnnotationHistoryDbModel( annotationId = annotationId, pageId = pageId, @@ -73,16 +50,11 @@ object PresAnnotationHistoryDAO { annotationInfo = "", updatedAt = new java.sql.Timestamp(annotationUpdatedAt) ) - ) - } + } - def deleteAnnotations(meetingId: String, pageId: String, userId: String, annotations: Array[String], annotationUpdatedAt: Long) = { DatabaseConnection.enqueue( - DBIO.sequence( - annotations.map { annotationId => - prepareDelete(meetingId, pageId, annotationId, userId, annotationUpdatedAt) - }.toVector - ).transactionally + TableQuery[PresAnnotationHistoryDbTableDef] ++= dbModels ) + } } \ No newline at end of file diff --git a/bigbluebutton-html5/imports/ui/components/whiteboard/queries.ts b/bigbluebutton-html5/imports/ui/components/whiteboard/queries.ts index 2d3aa7757d..1fd0853e90 100644 --- a/bigbluebutton-html5/imports/ui/components/whiteboard/queries.ts +++ b/bigbluebutton-html5/imports/ui/components/whiteboard/queries.ts @@ -111,7 +111,6 @@ export const CURRENT_PAGE_ANNOTATIONS_QUERY = gql`query CurrentPageAnnotationsQu pres_annotation_curr(order_by: { lastUpdatedAt: desc }) { annotationId annotationInfo - lastHistorySequence lastUpdatedAt pageId presentationId