From 2216df28a72e03763bdb9811fe3cd184a9946cc0 Mon Sep 17 00:00:00 2001 From: lwih Date: Wed, 5 Jun 2024 17:46:02 +0200 Subject: [PATCH] fix(bff): harmonize missionId type #181 --- .../main/resources/graphql/action.graphqls | 38 +++++++++---------- .../main/resources/graphql/controls.graphqls | 4 +- .../src/main/resources/graphql/crew.graphqls | 2 +- .../resources/graphql/infraction.graphqls | 4 +- .../main/resources/graphql/mission.graphqls | 2 +- .../src/pam/mission/crew/mission-crew.tsx | 2 +- .../mission-distance-consumption.test.tsx | 6 +-- .../mission-distance-consumption.tsx | 2 +- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/backend/src/main/resources/graphql/action.graphqls b/backend/src/main/resources/graphql/action.graphqls index 3f3f2d8af..7df4ecfaa 100644 --- a/backend/src/main/resources/graphql/action.graphqls +++ b/backend/src/main/resources/graphql/action.graphqls @@ -42,7 +42,7 @@ type Action { input ActionStatusInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String status: ActionStatusType! reason: ActionStatusReason @@ -51,7 +51,7 @@ input ActionStatusInput { input ActionControlInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String endDateTimeUtc: String controlMethod: ControlMethod! @@ -66,14 +66,14 @@ input ActionControlInput { input ActionFreeNoteInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String! observations: String } input ActionRescueInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String longitude: Float @@ -95,7 +95,7 @@ input ActionRescueInput { input ActionNauticalEventInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -103,7 +103,7 @@ input ActionNauticalEventInput { input ActionVigimerInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -111,7 +111,7 @@ input ActionVigimerInput { input ActionAntiPollutionInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -124,7 +124,7 @@ input ActionAntiPollutionInput { input ActionBAAEMPermanenceInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -132,7 +132,7 @@ input ActionBAAEMPermanenceInput { input ActionPublicOrderInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -140,7 +140,7 @@ input ActionPublicOrderInput { input ActionRepresentationInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -148,7 +148,7 @@ input ActionRepresentationInput { input ActionIllegalImmigrationInput { id: String - missionId: Int! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -198,7 +198,7 @@ type NavActionFreeNote { type NavActionRescue { id: String! - missionId: String + missionId: ID startDateTimeUtc: String! endDateTimeUtc: String longitude: Float @@ -221,7 +221,7 @@ type NavActionRescue { type NavActionNauticalEvent { id: String! - missionId: String! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -229,7 +229,7 @@ type NavActionNauticalEvent { type NavActionVigimer { id: String! - missionId: String! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -237,7 +237,7 @@ type NavActionVigimer { type NavActionAntiPollution { id: String! - missionId: String! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -250,7 +250,7 @@ type NavActionAntiPollution { type NavActionBAAEMPermanence { id: String! - missionId: String! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -258,7 +258,7 @@ type NavActionBAAEMPermanence { type NavActionPublicOrder { id: String! - missionId: String! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -266,7 +266,7 @@ type NavActionPublicOrder { type NavActionRepresentation { id: String! - missionId: String! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String @@ -274,7 +274,7 @@ type NavActionRepresentation { type NavActionIllegalImmigration { id: String! - missionId: String! + missionId: ID! startDateTimeUtc: String! endDateTimeUtc: String observations: String diff --git a/backend/src/main/resources/graphql/controls.graphqls b/backend/src/main/resources/graphql/controls.graphqls index 195f0c048..91513ac9b 100644 --- a/backend/src/main/resources/graphql/controls.graphqls +++ b/backend/src/main/resources/graphql/controls.graphqls @@ -73,7 +73,7 @@ type ControlGensDeMer { input ControlNavigationInput { id: String - missionId: String! + missionId: ID! actionControlId: String! amountOfControls: Int! unitShouldConfirm: Boolean @@ -83,7 +83,7 @@ input ControlNavigationInput { input ControlSecurityInput { id: String - missionId: String! + missionId: ID! actionControlId: String! amountOfControls: Int! unitShouldConfirm: Boolean diff --git a/backend/src/main/resources/graphql/crew.graphqls b/backend/src/main/resources/graphql/crew.graphqls index 0d2135f91..f13292b0e 100644 --- a/backend/src/main/resources/graphql/crew.graphqls +++ b/backend/src/main/resources/graphql/crew.graphqls @@ -38,7 +38,7 @@ type MissionCrew { input MissionCrewInput { id: ID agent: AgentInput - missionId: Int! + missionId: ID! comment: String role: AgentRoleInput } diff --git a/backend/src/main/resources/graphql/infraction.graphqls b/backend/src/main/resources/graphql/infraction.graphqls index 840bcc428..71177fd88 100644 --- a/backend/src/main/resources/graphql/infraction.graphqls +++ b/backend/src/main/resources/graphql/infraction.graphqls @@ -60,7 +60,7 @@ enum FishInfractionType { input InfractionInput { id: String - missionId: String! + missionId: ID! actionId: String! controlId: String controlType: String! @@ -71,7 +71,7 @@ input InfractionInput { input InfractionWithNewTargetInput { id: String - missionId: String! + missionId: ID! actionId: String! controlId: String controlType: String! diff --git a/backend/src/main/resources/graphql/mission.graphqls b/backend/src/main/resources/graphql/mission.graphqls index 061f259d8..43ecf632c 100644 --- a/backend/src/main/resources/graphql/mission.graphqls +++ b/backend/src/main/resources/graphql/mission.graphqls @@ -68,7 +68,7 @@ type MissionGeneralInfo { input MissionGeneralInfoInput { id: String - missionId: String! + missionId: ID! distanceInNauticalMiles: Float consumedGOInLiters: Float consumedFuelInLiters: Float diff --git a/frontend/src/pam/mission/crew/mission-crew.tsx b/frontend/src/pam/mission/crew/mission-crew.tsx index 4db3114e0..1a907783d 100644 --- a/frontend/src/pam/mission/crew/mission-crew.tsx +++ b/frontend/src/pam/mission/crew/mission-crew.tsx @@ -85,7 +85,7 @@ const MissionCrew: React.FC = () => { const handleSubmitForm = async (data: AddOrUpdateMissionCrewInput) => { if (!missionId) return - const crew = { ...data, missionId: Number(missionId) } + const crew = { ...data, missionId: missionId } await addOrUpdateCrew({ variables: { crew } }) setOpenCrewForm(false) } diff --git a/frontend/src/pam/mission/general-info/mission-distance-consumption.test.tsx b/frontend/src/pam/mission/general-info/mission-distance-consumption.test.tsx index cb422ae31..296403448 100644 --- a/frontend/src/pam/mission/general-info/mission-distance-consumption.test.tsx +++ b/frontend/src/pam/mission/general-info/mission-distance-consumption.test.tsx @@ -40,7 +40,7 @@ describe('MissionDistanceAndConsumption', () => { it('should be called when changing distanceInNauticalMiles', async () => { render() const field = screen.getByRole('distanceInNauticalMiles') - const value = '2' + const value = 2 fireEvent.change(field, { target: { value } }) fireEvent.blur(field) expect(mutateMock).toHaveBeenCalledWith({ @@ -58,7 +58,7 @@ describe('MissionDistanceAndConsumption', () => { it('should be called when changing consumedGOInLiters', async () => { render() const field = screen.getByRole('consumedGOInLiters') - const value = '2' + const value = 2 fireEvent.change(field, { target: { value } }) fireEvent.blur(field) expect(mutateMock).toHaveBeenCalledWith({ @@ -76,7 +76,7 @@ describe('MissionDistanceAndConsumption', () => { it('should be called when changing consumedFuelInLiters', async () => { render() const field = screen.getByRole('consumedFuelInLiters') - const value = '2' + const value = 2 fireEvent.change(field, { target: { value } }) fireEvent.blur(field) expect(mutateMock).toHaveBeenCalledWith({ diff --git a/frontend/src/pam/mission/general-info/mission-distance-consumption.tsx b/frontend/src/pam/mission/general-info/mission-distance-consumption.tsx index 10c247c09..8457dcadf 100644 --- a/frontend/src/pam/mission/general-info/mission-distance-consumption.tsx +++ b/frontend/src/pam/mission/general-info/mission-distance-consumption.tsx @@ -22,7 +22,7 @@ const MissionDistanceAndConsumption: React.FC { - const updatedValue = value !== undefined && value !== null ? value?.toString() : undefined + const updatedValue = value !== undefined && value !== null ? value : undefined setFormData({ ...formData, [field]: updatedValue