Merge branch 'RED-8248' into 'master'

RED-8248: Sent comments are not sorted by order of arrival

Closes RED-8248

See merge request redactmanager/persistence-service!321
This commit is contained in:
Maverick Studer 2024-01-24 12:15:06 +01:00
commit 9329023ff6
3 changed files with 10 additions and 1 deletions

View File

@ -108,7 +108,7 @@ public class CommentService {
public List<Comment> getComments(String fileId, String annotationId) {
return toCommentList(commentPersistenceService.findCommentsByAnnotationId(fileId, annotationId, false));
return toCommentList(commentPersistenceService.findCommentsByAnnotationIdSortByDate(fileId, annotationId, false));
}

View File

@ -78,6 +78,12 @@ public class CommentPersistenceService {
}
public List<CommentEntity> findCommentsByAnnotationIdSortByDate(String fileId, String annotationId, boolean includeDeletions) {
return commentRepository.findByFileIdAndAnnotationIdOrderByDate(fileId, annotationId, includeDeletions);
}
@Transactional
public void softDelete(long commentId, OffsetDateTime softDeletedTime) {

View File

@ -15,6 +15,9 @@ public interface CommentRepository extends JpaRepository<CommentEntity, Long> {
@Query("select e from CommentEntity e where e.fileId = :fileId and e.annotationId = :annotationId and (:includeDeletions = true or e.softDeletedTime is null)")
List<CommentEntity> findByFileIdAndAnnotationId(@Param("fileId") String fileId, @Param("annotationId") String annotationId, @Param("includeDeletions") boolean includeDeletions);
@Query("select e from CommentEntity e where e.fileId = :fileId and e.annotationId = :annotationId and (:includeDeletions = true or e.softDeletedTime is null) ORDER BY e.date")
List<CommentEntity> findByFileIdAndAnnotationIdOrderByDate(@Param("fileId") String fileId, @Param("annotationId") String annotationId, @Param("includeDeletions") boolean includeDeletions);
@Query("select e from CommentEntity e where e.fileId = :fileId and (:includeDeletions = true or e.softDeletedTime is null)")
List<CommentEntity> findByFileId(@Param("fileId") String fileId, @Param("includeDeletions") boolean includeDeletions);