diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/logbook/messages/PNO.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/logbook/messages/PNO.kt index 02174d0b39..6464b3e1c6 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/logbook/messages/PNO.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/logbook/messages/PNO.kt @@ -14,6 +14,12 @@ class PNO() : LogbookMessageValue { var hasPortEntranceAuthorization: Boolean? = null var hasPortLandingAuthorization: Boolean? = null + @Deprecated( + """ + Kept because some historical messages used a manually entered trigram to identify the author of the message. + It's now automated via `createdBy` and `updatedBy` fields. + """, + ) var authorTrigram: String? = null var catchOnboard: List = emptyList() var catchToLand: List = emptyList() diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/repositories/LogbookReportRepository.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/repositories/LogbookReportRepository.kt index 641b4ad312..ecb087871e 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/repositories/LogbookReportRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/repositories/LogbookReportRepository.kt @@ -79,10 +79,9 @@ interface LogbookReportRepository { fun findAllPriorNotificationsToVerify(): List - fun updatePriorNotificationAuthorTrigramAndNote( + fun updatePriorNotificationNote( reportId: String, operationDate: ZonedDateTime, - authorTrigram: String?, note: String?, updatedBy: String?, ) diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt index f7d1739384..accb213478 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/CreateOrUpdateManualPriorNotification.kt @@ -192,7 +192,6 @@ class CreateOrUpdateManualPriorNotification( val portName = allPorts.find { it.locode == portLocode }?.name return PNO().apply { - this.authorTrigram = authorTrigram this.catchOnboard = fishingCatches this.catchToLand = fishingCatches this.economicZone = null diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotification.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotification.kt index ff0de1cbc5..26b02c0a8e 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotification.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotification.kt @@ -19,7 +19,6 @@ class UpdateLogbookPriorNotification( fun execute( reportId: String, operationDate: ZonedDateTime, - authorTrigram: String?, note: String?, updatedBy: String?, ): PriorNotification { @@ -31,10 +30,9 @@ class UpdateLogbookPriorNotification( logger.warn("Could not delete existing PDF document", e) } - logbookReportRepository.updatePriorNotificationAuthorTrigramAndNote( + logbookReportRepository.updatePriorNotificationNote( reportId = reportId, operationDate = operationDate, - authorTrigram = authorTrigram, note = note, updatedBy = updatedBy, ) diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/PriorNotificationController.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/PriorNotificationController.kt index 54a415ebdf..84fea18365 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/PriorNotificationController.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/PriorNotificationController.kt @@ -181,7 +181,6 @@ class PriorNotificationController( updateLogbookPriorNotification.execute( reportId = reportId, operationDate = operationDate, - authorTrigram = logbookPriorNotificationFormDataInput.authorTrigram, note = logbookPriorNotificationFormDataInput.note, updatedBy = response.getHeader(UserAuthorizationCheckFilter.EMAIL_HEADER), ) diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/input/LogbookPriorNotificationFormDataInput.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/input/LogbookPriorNotificationFormDataInput.kt index 7b210904fc..f7ba9099b3 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/input/LogbookPriorNotificationFormDataInput.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/input/LogbookPriorNotificationFormDataInput.kt @@ -1,6 +1,5 @@ package fr.gouv.cnsp.monitorfish.infrastructure.api.input data class LogbookPriorNotificationFormDataInput( - val authorTrigram: String?, val note: String?, ) diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/LogbookPriorNotificationFormDataOutput.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/LogbookPriorNotificationFormDataOutput.kt index a261d3e9ce..ede6a53501 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/LogbookPriorNotificationFormDataOutput.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/LogbookPriorNotificationFormDataOutput.kt @@ -3,13 +3,11 @@ package fr.gouv.cnsp.monitorfish.infrastructure.api.outputs import fr.gouv.cnsp.monitorfish.domain.entities.prior_notification.PriorNotification data class LogbookPriorNotificationFormDataOutput( - val authorTrigram: String?, val note: String?, ) { companion object { fun fromPriorNotification(priorNotification: PriorNotification): LogbookPriorNotificationFormDataOutput { return LogbookPriorNotificationFormDataOutput( - authorTrigram = priorNotification.logbookMessageAndValue.value.authorTrigram, note = priorNotification.logbookMessageAndValue.value.note, ) } diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/ManualPriorNotificationFormDataOutput.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/ManualPriorNotificationFormDataOutput.kt index fb5718aae5..3ecc7260c2 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/ManualPriorNotificationFormDataOutput.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/ManualPriorNotificationFormDataOutput.kt @@ -8,14 +8,13 @@ import java.time.ZonedDateTime data class ManualPriorNotificationFormDataOutput( val reportId: String, - val hasPortEntranceAuthorization: Boolean, - val hasPortLandingAuthorization: Boolean, - val authorTrigram: String, val didNotFishAfterZeroNotice: Boolean, val expectedArrivalDate: String, val expectedLandingDate: String, val fishingCatches: List, val globalFaoArea: String?, + val hasPortEntranceAuthorization: Boolean, + val hasPortLandingAuthorization: Boolean, val note: String?, val portLocode: String, val sentAt: ZonedDateTime, @@ -29,10 +28,6 @@ data class ManualPriorNotificationFormDataOutput( val logbookMessage = priorNotification.logbookMessageAndValue.logbookMessage val pnoValue = priorNotification.logbookMessageAndValue.value - val authorTrigram = - requireNotNull(pnoValue.authorTrigram) { - "`pnoValue.authorTrigram` is null." - } val expectedArrivalDate = CustomZonedDateTime.fromZonedDateTime( requireNotNull(pnoValue.predictedArrivalDatetimeUtc) { @@ -64,8 +59,8 @@ data class ManualPriorNotificationFormDataOutput( "`priorNotification.vessel` is null." }.id - val hasPortEntranceAuthorization = pnoValue.hasPortEntranceAuthorization ?: true - val hasPortLandingAuthorization = pnoValue.hasPortLandingAuthorization ?: true + val hasPortEntranceAuthorization = pnoValue.hasPortEntranceAuthorization != false + val hasPortLandingAuthorization = pnoValue.hasPortLandingAuthorization != false // In Frontend form, manual prior notifications can: // - either have a single global FAO area field // - or have an FAO area field per fishing catch @@ -85,7 +80,6 @@ data class ManualPriorNotificationFormDataOutput( return ManualPriorNotificationFormDataOutput( reportId = reportId, - authorTrigram = authorTrigram, didNotFishAfterZeroNotice = priorNotification.didNotFishAfterZeroNotice, expectedArrivalDate = expectedArrivalDate, expectedLandingDate = expectedLandingDate, 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 aa8bc8c1b6..bd5b7bf127 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 @@ -394,10 +394,9 @@ class JpaLogbookReportRepository( } @Transactional - override fun updatePriorNotificationAuthorTrigramAndNote( + override fun updatePriorNotificationNote( reportId: String, operationDate: ZonedDateTime, - authorTrigram: String?, note: String?, updatedBy: String?, ) { @@ -410,16 +409,12 @@ class JpaLogbookReportRepository( ?: throw BackendUsageException(BackendUsageErrorCode.NOT_FOUND) val pnoValue = objectMapper.readValue(logbookReport.message, PNO::class.java) - if ( - Utils.areStringsEqual(authorTrigram, pnoValue.authorTrigram) && - Utils.areStringsEqual(note, pnoValue.note) - ) { + if (Utils.areStringsEqual(note, pnoValue.note)) { return } val nextPnoValue = pnoValue.apply { - this.authorTrigram = authorTrigram this.note = note this.updatedBy = updatedBy diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotificationITests.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotificationITests.kt index 9b8e047c09..a9e2cef544 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotificationITests.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotificationITests.kt @@ -270,7 +270,7 @@ class UpdateLogbookPriorNotificationITests : AbstractDBTests() { // When val afterPriorNotification = - updateLogbookPriorNotification.execute(reportId, operationDate, "ABC", "Une note.", "bob@example.org") + updateLogbookPriorNotification.execute(reportId, operationDate, "ABC", "editor@example.org") // Then val afterPnoValue = afterPriorNotification.logbookMessageAndValue.value diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotificationUTests.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotificationUTests.kt index 77382b04fa..4c88ca5026 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotificationUTests.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/UpdateLogbookPriorNotificationUTests.kt @@ -43,9 +43,8 @@ class UpdateLogbookPriorNotificationUTests { ).execute( reportId = fakePriorNotification.reportId!!, operationDate = fakePriorNotification.logbookMessageAndValue.logbookMessage.operationDateTime, - authorTrigram = "ABC", note = null, - updatedBy = "bob@example.org", + updatedBy = "editor@example.org", ) // Then diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/PriorNotificationControllerUTests.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/PriorNotificationControllerUTests.kt index 1d66f2d940..96a9b8f348 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/PriorNotificationControllerUTests.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/PriorNotificationControllerUTests.kt @@ -139,7 +139,6 @@ class PriorNotificationControllerUTests { updateLogbookPriorNotification.execute( reportId = anyOrNull(), operationDate = anyOrNull(), - authorTrigram = anyOrNull(), note = anyOrNull(), updatedBy = anyOrNull(), ), @@ -147,13 +146,7 @@ class PriorNotificationControllerUTests { .willReturn(fakePriorNotification) // When - val requestBody = - objectMapper.writeValueAsString( - LogbookPriorNotificationFormDataInput( - authorTrigram = "ABC", - note = "Test !", - ), - ) + val requestBody = objectMapper.writeValueAsString(LogbookPriorNotificationFormDataInput(note = "Test !")) val pnoValue = fakePriorNotification.logbookMessageAndValue.value api.perform( put( @@ -164,7 +157,6 @@ class PriorNotificationControllerUTests { ) // Then .andExpect(status().isOk) - .andExpect(jsonPath("$.authorTrigram", equalTo(pnoValue.authorTrigram))) .andExpect(jsonPath("$.note", equalTo(pnoValue.note))) } diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaLogbookReportRepositoryITests.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaLogbookReportRepositoryITests.kt index 8cf9980a8c..f96f4b239f 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaLogbookReportRepositoryITests.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaLogbookReportRepositoryITests.kt @@ -1126,18 +1126,18 @@ class JpaLogbookReportRepositoryITests : AbstractDBTests() { assertThat((currentCorReport.message as PNO).note).isNull() // When - jpaLogbookReportRepository.updatePriorNotificationAuthorTrigramAndNote( + jpaLogbookReportRepository.updatePriorNotificationNote( reportId = "FAKE_OPERATION_109_COR", operationDate = ZonedDateTime.now().minusMinutes(15), - authorTrigram = "ABC", note = "A wonderful note", - updatedBy = "bob@example.org", + updatedBy = "editor@example.org", ) // Then val updatedCorReport = jpaLogbookReportRepository.findById(2109) + assertThat((updatedCorReport.message as PNO).authorTrigram).isNull() assertThat((updatedCorReport.message as PNO).note).isEqualTo("A wonderful note") - assertThat((updatedCorReport.message as PNO).updatedBy).isEqualTo("bob@example.org") + assertThat((updatedCorReport.message as PNO).updatedBy).isEqualTo("editor@example.org") assertThat((updatedCorReport.message as PNO).isBeingSent).isEqualTo(false) assertThat((updatedCorReport.message as PNO).isVerified).isEqualTo(false) assertThat((updatedCorReport.message as PNO).isSent).isEqualTo(false) diff --git a/frontend/cypress/e2e/side_window/logbook_prior_notification_form/behavior.spec.ts b/frontend/cypress/e2e/side_window/logbook_prior_notification_form/behavior.spec.ts index 1cb9c93ab4..957dae9abc 100644 --- a/frontend/cypress/e2e/side_window/logbook_prior_notification_form/behavior.spec.ts +++ b/frontend/cypress/e2e/side_window/logbook_prior_notification_form/behavior.spec.ts @@ -16,7 +16,6 @@ context('Side Window > Logbook Prior Notification Form > Behavior', () => { cy.get('.Component-Banner').contains(`Le préavis est en cours de diffusion.`) cy.get('textarea[name=note]').should('have.attr', 'readonly') - cy.get('input[name=authorTrigram]').should('have.attr', 'readonly') cy.contains('button', 'Télécharger').should('be.disabled') cy.contains('button', 'Diffuser').should('be.disabled') @@ -39,7 +38,6 @@ context('Side Window > Logbook Prior Notification Form > Behavior', () => { const operationDate = dayjs().subtract(6, 'hours').toISOString() cy.request('PUT', `/bff/v1/prior_notifications/logbook/FAKE_OPERATION_116?operationDate=${operationDate}`, { body: { - authorTrigram: null, note: null } }) diff --git a/frontend/cypress/e2e/side_window/logbook_prior_notification_form/form.spec.ts b/frontend/cypress/e2e/side_window/logbook_prior_notification_form/form.spec.ts index 98ce990c93..fd3f29fe47 100644 --- a/frontend/cypress/e2e/side_window/logbook_prior_notification_form/form.spec.ts +++ b/frontend/cypress/e2e/side_window/logbook_prior_notification_form/form.spec.ts @@ -10,7 +10,6 @@ context('Side Window > Logbook Prior Notification Form > Form', () => { const operationDate = dayjs().subtract(6, 'hours').toISOString() cy.request('PUT', `/bff/v1/prior_notifications/logbook/FAKE_OPERATION_115?operationDate=${operationDate}`, { body: { - authorTrigram: null, note: null } }) @@ -23,7 +22,6 @@ context('Side Window > Logbook Prior Notification Form > Form', () => { ) cy.get('[name="note"]').should('have.value', '') - cy.get('[name="authorTrigram"]').should('have.value', '') // When cy.fill("Points d'attention identifiés par le CNSP", "Un point d'attention.") @@ -38,12 +36,10 @@ context('Side Window > Logbook Prior Notification Form > Form', () => { editSideWindowPriorNotification(`MER À BOIRE`, 'FAKE_OPERATION_115') cy.get('[name="note"]').should('have.value', "Un point d'attention.") - cy.get('[name="authorTrigram"]').should('have.value', 'ABC') // Reset cy.request('PUT', `/bff/v1/prior_notifications/logbook/FAKE_OPERATION_115?operationDate=${operationDate}`, { body: { - authorTrigram: null, note: null } }) diff --git a/frontend/cypress/e2e/side_window/logbook_prior_notification_form/utils.ts b/frontend/cypress/e2e/side_window/logbook_prior_notification_form/utils.ts index db2c31ae71..9f08bfa8e9 100644 --- a/frontend/cypress/e2e/side_window/logbook_prior_notification_form/utils.ts +++ b/frontend/cypress/e2e/side_window/logbook_prior_notification_form/utils.ts @@ -178,7 +178,7 @@ export function getPriorNotificationFakeResponse({ isDeleted: false, isSentByFailoverSoftware: false, message: { - authorTrigram: 'ABC', + authorTrigram: null, catchOnboard: [ { conversionFactor: null, @@ -235,7 +235,7 @@ export function getPriorNotificationFakeResponse({ riskFactor: 3.2, statisticalRectangle: null, tripStartDate, - updatedBy: null + updatedBy: 'editor@example.org' }, messageType: Logbook.MessageType.PNO, operationDateTime: updatedAt, @@ -272,11 +272,9 @@ export function getPriorNotificationFakeResponse({ return { ...commonData, asLogbookForm: { - authorTrigram: 'ABC', note: null }, asManualDraft: { - authorTrigram: 'ABC', didNotFishAfterZeroNotice: false, expectedArrivalDate, expectedLandingDate: expectedArrivalDate, @@ -303,7 +301,6 @@ export function getPriorNotificationFakeResponse({ asLogbookForm: null, asManualDraft: null, asManualForm: { - authorTrigram: 'ABC', didNotFishAfterZeroNotice: false, expectedArrivalDate, expectedLandingDate: expectedArrivalDate, diff --git a/frontend/cypress/e2e/side_window/manual_prior_notification_form/behavior.spec.ts b/frontend/cypress/e2e/side_window/manual_prior_notification_form/behavior.spec.ts index c040033eee..25ddeecffe 100644 --- a/frontend/cypress/e2e/side_window/manual_prior_notification_form/behavior.spec.ts +++ b/frontend/cypress/e2e/side_window/manual_prior_notification_form/behavior.spec.ts @@ -122,7 +122,6 @@ context('Side Window > Manual Prior Notification Form > Behavior', () => { cy.get('.Component-Banner').contains(`Le préavis est en cours de diffusion.`) cy.get('textarea[name=note]').should('have.attr', 'readonly') - cy.get('input[name=authorTrigram]').should('have.attr', 'readonly') cy.contains('button', 'Enregistrer').should('be.disabled') cy.contains('button', 'Diffuser').should('be.disabled') @@ -134,7 +133,6 @@ context('Side Window > Manual Prior Notification Form > Behavior', () => { cy.get('.Component-Banner').contains(`Le préavis est en cours d’envoi aux unités qui l’ont demandé.`) cy.get('textarea[name=note]').should('have.attr', 'readonly') - cy.get('input[name=authorTrigram]').should('have.attr', 'readonly') cy.contains('button', 'Enregistrer').should('be.disabled') cy.contains('button', 'Diffuser').should('be.disabled') diff --git a/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts b/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts index ef86ac7769..0f12145e81 100644 --- a/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts +++ b/frontend/cypress/e2e/side_window/manual_prior_notification_form/form.spec.ts @@ -103,7 +103,6 @@ context('Side Window > Manual Prior Notification Form > Form', () => { weight: 200.0 }) assert.deepInclude(createdPriorNotification, { - authorTrigram: 'BOB', didNotFishAfterZeroNotice: false, expectedArrivalDate: arrivalDateAsString, expectedLandingDate: landingDateAsString, @@ -334,7 +333,6 @@ context('Side Window > Manual Prior Notification Form > Form', () => { weight: 5000.0 }) assert.deepInclude(createdPriorNotification, { - authorTrigram: 'BOB', didNotFishAfterZeroNotice: false, expectedArrivalDate: arrivalDateAsString, // Should be the same as the arrival date since we checked "équivalentes à celles de l'arrivée au port" @@ -556,7 +554,6 @@ context('Side Window > Manual Prior Notification Form > Form', () => { weight: 50.0 }) assert.deepInclude(createdPriorNotification, { - authorTrigram: 'BOB', didNotFishAfterZeroNotice: false, expectedArrivalDate: arrivalDateAsString, expectedLandingDate: arrivalDateAsString, // Checked "équivalentes à celles de l'arrivée au port" @@ -602,7 +599,6 @@ context('Side Window > Manual Prior Notification Form > Form', () => { weight: 50.0 }) assert.deepInclude(firstUpdatedPriorNotification, { - authorTrigram: 'BOB', didNotFishAfterZeroNotice: false, expectedArrivalDate: arrivalDateAsString, expectedLandingDate: arrivalDateAsString, // Checked "équivalentes à celles de l'arrivée au port" @@ -643,7 +639,6 @@ context('Side Window > Manual Prior Notification Form > Form', () => { weight: 50.0 }) assert.deepInclude(secondUpdatedPriorNotification, { - authorTrigram: 'BOB', didNotFishAfterZeroNotice: false, expectedArrivalDate: arrivalDateAsString, expectedLandingDate: arrivalDateAsString, // Checked "équivalentes à celles de l'arrivée au port" diff --git a/frontend/cypress/e2e/side_window/reporting_list/actions.spec.ts b/frontend/cypress/e2e/side_window/reporting_list/actions.spec.ts index 73a8395482..904fe3afbb 100644 --- a/frontend/cypress/e2e/side_window/reporting_list/actions.spec.ts +++ b/frontend/cypress/e2e/side_window/reporting_list/actions.spec.ts @@ -154,7 +154,6 @@ context('Side Window > Reporting List > Actions', () => { // Then cy.wait('@updateReporting').then(({ request, response }) => { expect(request.body.type).contains('OBSERVATION') - expect(request.body.authorTrigram).contains('LTH') expect(response && response.statusCode).equal(200) cy.getDataCy('ReportingList-reporting').should('have.length', numberOfReportings - 1) diff --git a/frontend/src/features/Logbook/Logbook.types.ts b/frontend/src/features/Logbook/Logbook.types.ts index 28e9058727..6b1d5e49c5 100644 --- a/frontend/src/features/Logbook/Logbook.types.ts +++ b/frontend/src/features/Logbook/Logbook.types.ts @@ -163,6 +163,11 @@ export namespace Logbook { } export interface PnoMessageValue { + /** + * @deprecated + * Kept because some historical messages used a manually entered trigram to identify the author of the message. + * It's now automated via `createdBy` and `updatedBy` fields. + */ authorTrigram: string | undefined catchOnboard: Catch[] | undefined catchToLand: Catch[] | undefined diff --git a/frontend/src/features/PriorNotification/PriorNotification.types.ts b/frontend/src/features/PriorNotification/PriorNotification.types.ts index a1349808b9..1d78bd6b0d 100644 --- a/frontend/src/features/PriorNotification/PriorNotification.types.ts +++ b/frontend/src/features/PriorNotification/PriorNotification.types.ts @@ -77,7 +77,6 @@ export namespace PriorNotification { ) export type ManualDraft = { - authorTrigram: string didNotFishAfterZeroNotice: boolean expectedArrivalDate: string | undefined expectedLandingDate: string | undefined @@ -94,12 +93,10 @@ export namespace PriorNotification { } export type LogbookForm = { - authorTrigram: string | undefined note: string | undefined } export type ManualForm = { - authorTrigram: string didNotFishAfterZeroNotice: boolean expectedArrivalDate: string expectedLandingDate: string diff --git a/frontend/src/features/PriorNotification/components/LogbookPriorNotificationForm/Form.tsx b/frontend/src/features/PriorNotification/components/LogbookPriorNotificationForm/Form.tsx index 107f0caf5c..e958be0aeb 100644 --- a/frontend/src/features/PriorNotification/components/LogbookPriorNotificationForm/Form.tsx +++ b/frontend/src/features/PriorNotification/components/LogbookPriorNotificationForm/Form.tsx @@ -12,7 +12,6 @@ import { customDayjs, FormikEffect, FormikTextarea, - FormikTextInput, Icon, LinkButton, THEME @@ -96,8 +95,6 @@ export function Form({ detail, initialFormValues }: FormProps) { {isSuperUser && ( <> - -
p.theme.color.slateGray}; font-style: italic; diff --git a/frontend/src/features/PriorNotification/components/ManualPriorNotificationForm/Form.tsx b/frontend/src/features/PriorNotification/components/ManualPriorNotificationForm/Form.tsx index 8898277c61..154cb39350 100644 --- a/frontend/src/features/PriorNotification/components/ManualPriorNotificationForm/Form.tsx +++ b/frontend/src/features/PriorNotification/components/ManualPriorNotificationForm/Form.tsx @@ -13,7 +13,6 @@ import { FormikMultiSelect, FormikSelect, FormikTextarea, - FormikTextInput, getOptionsFromLabelledEnum, LinkButton } from '@mtes-mct/monitor-ui' @@ -157,8 +156,6 @@ export function Form({ isNewPriorNotification, isReadOnly }: FormProps) { Ouvrir un signalement sur le navire )} - - ) } @@ -169,10 +166,6 @@ const StyledFormikMultiRadio = styled(FormikMultiRadio)` } ` -const AuthorTrigramInput = styled(FormikTextInput)` - width: 120px; -` - const FieldGroup = styled.div.attrs({ className: 'FieldGroup' })` display: flex; flex-direction: column; diff --git a/frontend/src/features/PriorNotification/components/ManualPriorNotificationForm/constants.ts b/frontend/src/features/PriorNotification/components/ManualPriorNotificationForm/constants.ts index e29d906e6a..b5742abeff 100644 --- a/frontend/src/features/PriorNotification/components/ManualPriorNotificationForm/constants.ts +++ b/frontend/src/features/PriorNotification/components/ManualPriorNotificationForm/constants.ts @@ -18,7 +18,6 @@ const FISHING_CATCH_VALIDATION_SCHEMA: ObjectSchema = object({ - authorTrigram: string().trim().required('Veuillez indiquer votre trigramme.'), didNotFishAfterZeroNotice: boolean().required(), expectedArrivalDate: string().required("Veuillez indiquer la date d'arrivée estimée."), expectedLandingDate: string().when('$isExpectedLandingDateSameAsExpectedArrivalDate', { @@ -49,7 +48,6 @@ export const FORM_VALIDATION_SCHEMA: ObjectSchema