From c66379c8791a4cbb60cbe7956e2830ceed6dd7ed Mon Sep 17 00:00:00 2001 From: Loup Theron Date: Wed, 14 Aug 2024 15:50:05 +0200 Subject: [PATCH 1/2] Fix pno to verify after invalidation --- .../database/repositories/JpaFleetSegmentRepository.kt | 2 +- .../repositories/JpaManualPriorNotificationRepository.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaFleetSegmentRepository.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaFleetSegmentRepository.kt index 300e31cf90..78587b111c 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaFleetSegmentRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaFleetSegmentRepository.kt @@ -66,7 +66,7 @@ class JpaFleetSegmentRepository( dbFleetSegmentRepository.findBySegmentAndYearEquals(segment, year).toFleetSegment() } } catch (e: Throwable) { - throw CouldNotUpdateFleetSegmentException("Could not update fleet segment: ${e.message}") + throw CouldNotUpdateFleetSegmentException("Could not update fleet segment: ${e.message}", e) } } diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepository.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepository.kt index 3a95e3517b..81b918e37b 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaManualPriorNotificationRepository.kt @@ -72,7 +72,7 @@ class JpaManualPriorNotificationRepository( } @Transactional - @CacheEvict(value = ["pno_to_verify"], allEntries = true) + @CacheEvict(value = ["manual_pno_to_verify"], allEntries = true) override fun save(newOrNextPriorNotification: PriorNotification): PriorNotification { try { val manualPriorNotificationEntity = dbManualPriorNotificationRepository @@ -105,6 +105,7 @@ class JpaManualPriorNotificationRepository( } @Transactional + @CacheEvict(value = ["manual_pno_to_verify"], allEntries = true) override fun invalidate(reportId: String) { val manualPriorNotification = dbManualPriorNotificationRepository.findByReportId(reportId) ?: throw BackendUsageException( From a478531adc0844dd94219730c91d9a2e255f72ae Mon Sep 17 00:00:00 2001 From: Loup Theron Date: Wed, 14 Aug 2024 15:51:02 +0200 Subject: [PATCH 2/2] Fix logbook pno to verify after invalidation --- .../database/repositories/JpaLogbookReportRepository.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaLogbookReportRepository.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaLogbookReportRepository.kt index 6cd1e37e8d..3469e22f79 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaLogbookReportRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaLogbookReportRepository.kt @@ -440,6 +440,7 @@ class JpaLogbookReportRepository( } @Transactional + @CacheEvict(value = ["pno_to_verify"], allEntries = true) override fun invalidate(reportId: String, operationDate: ZonedDateTime) { val logbookReportEntities = dbLogbookReportRepository.findEnrichedPnoReferenceAndRelatedOperationsByReportId(