Skip to content

Commit 68bf0bc

Browse files
authored
Fiche navire - Afficher l'indication mer/port de la position VMS dans la liste des positions (#3540)
## Linked issues - Resolve #3204 ---- - [ ] Tests E2E (Cypress)
2 parents cb10faa + 995a803 commit 68bf0bc

File tree

15 files changed

+386
-47
lines changed

15 files changed

+386
-47
lines changed

backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/position/Position.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ data class Position(
2121
val positionType: PositionType,
2222
val isManual: Boolean? = null,
2323
val isFishing: Boolean? = null,
24+
val isAtPort: Boolean? = null,
2425

2526
val latitude: Double,
2627
val longitude: Double,

backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/PositionDataOutput.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ data class PositionDataOutput(
2323
val positionType: PositionType,
2424
val isManual: Boolean? = null,
2525
val isFishing: Boolean? = null,
26+
val isAtPort: Boolean? = null,
2627
) {
2728
companion object {
2829
fun fromPosition(position: Position): PositionDataOutput {
@@ -44,6 +45,7 @@ data class PositionDataOutput(
4445
positionType = position.positionType,
4546
isManual = position.isManual,
4647
isFishing = position.isFishing,
48+
isAtPort = position.isAtPort,
4749
)
4850
}
4951
}

backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/entities/PositionEntity.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ data class PositionEntity(
4242
val isManual: Boolean? = false,
4343
@Column(name = "is_fishing")
4444
val isFishing: Boolean? = false,
45+
@Column(name = "is_at_port")
46+
val isAtPort: Boolean? = null,
4547

4648
// Mandatory fields
4749
@Enumerated(EnumType.STRING)
@@ -78,6 +80,7 @@ data class PositionEntity(
7880
positionType = positionType,
7981
isManual = isManual,
8082
isFishing = isFishing,
83+
isAtPort = isAtPort,
8184
)
8285

8386
companion object {

backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBPositionRepository.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ interface DBPositionRepository : CrudRepository<PositionEntity, Long> {
2828
"p.course, " +
2929
"p.position_type, " +
3030
"p.is_manual, " +
31-
"p.is_fishing " +
31+
"p.is_fishing, " +
32+
"p.is_at_port " +
3233
"from positions p " +
3334
"where p.internal_reference_number = :internalReferenceNumber " +
3435
"and p.date_time >= :from " +
@@ -61,7 +62,8 @@ interface DBPositionRepository : CrudRepository<PositionEntity, Long> {
6162
"p.course, " +
6263
"p.position_type, " +
6364
"p.is_manual, " +
64-
"p.is_fishing " +
65+
"p.is_fishing, " +
66+
"p.is_at_port " +
6567
"from positions p " +
6668
"where p.external_reference_number = :externalReferenceNumber " +
6769
"and p.date_time >= :from " +
@@ -94,7 +96,8 @@ interface DBPositionRepository : CrudRepository<PositionEntity, Long> {
9496
"p.course, " +
9597
"p.position_type, " +
9698
"p.is_manual, " +
97-
"p.is_fishing " +
99+
"p.is_fishing, " +
100+
"p.is_at_port " +
98101
"from positions p " +
99102
"where p.ircs = :ircs " +
100103
"and p.date_time >= :from " +

backend/src/main/resources/db/testdata/V666.1__Insert_dummy_positions.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69278,3 +69278,6 @@ INSERT INTO POSITIONS (INTERNAL_REFERENCE_NUMBER, EXTERNAL_REFERENCE_NUMBER, MMS
6927869278
('U_W0NTFINDME','ABC123456',null,'TALK2ME','MALOTRU','FR','FR','DE',null,57.348,-21.219,7.5,11,(now() AT TIME ZONE 'UTC')::TIMESTAMP - interval '20 days 9 hours','VMS'),
6927969279
('U_W0NTFINDME','ABC123456',null,'TALK2ME','MALOTRU','FR','FR','DE',null,57.64,-21.117,8.6,17,(now() AT TIME ZONE 'UTC')::TIMESTAMP - interval '20 days 3 hours','VMS');
6928069280

69281+
update positions
69282+
set is_at_port = true
69283+
where INTERNAL_REFERENCE_NUMBER = 'FAK000999999' and date_time < (now() AT TIME ZONE 'UTC')::TIMESTAMP - interval '22 hours';

backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/light/VesselLightControllerITests.kt

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,62 @@ class VesselLightControllerITests {
117117
// Given
118118
val now = ZonedDateTime.now().minusDays(1)
119119
val firstPosition = Position(
120-
null, "FR224226850", "224226850", null, null, null, null, PositionType.AIS, false, false, 16.445, 48.2525, 1.8, 180.0,
121-
now.minusHours(
120+
id = null,
121+
internalReferenceNumber = "FR224226850",
122+
mmsi = "224226850",
123+
ircs = null,
124+
externalReferenceNumber = null,
125+
vesselName = null,
126+
flagState = null,
127+
positionType = PositionType.AIS,
128+
isManual = false,
129+
isFishing = false,
130+
course = 16.445,
131+
latitude = 48.2525,
132+
longitude = 1.8,
133+
speed = 180.0,
134+
isAtPort = false,
135+
dateTime = now.minusHours(
122136
4,
123137
),
124138
)
125139
val secondPosition = Position(
126-
null, "FR224226850", "224226850", null, null, null, null, PositionType.AIS, false, false, 16.445, 48.2525, 1.8, 180.0,
127-
now.minusHours(
140+
id = null,
141+
internalReferenceNumber = "FR224226850",
142+
mmsi = "224226850",
143+
ircs = null,
144+
externalReferenceNumber = null,
145+
vesselName = null,
146+
flagState = null,
147+
positionType = PositionType.AIS,
148+
isManual = false,
149+
isFishing = false,
150+
course = 16.445,
151+
latitude = 48.2525,
152+
longitude = 1.8,
153+
speed = 180.0,
154+
isAtPort = false,
155+
dateTime = now.minusHours(
128156
3,
129157
),
130158
)
131159
val thirdPosition = Position(
132-
null, "FR224226850", "224226850", null, null, null, null, PositionType.AIS, false, false, 16.445, 48.2525, 1.8, 180.0,
133-
now.minusHours(
160+
null,
161+
internalReferenceNumber = "FR224226850",
162+
mmsi = "224226850",
163+
ircs = null,
164+
externalReferenceNumber = null,
165+
vesselName = null,
166+
flagState = null,
167+
positionType = PositionType.AIS,
168+
isManual = false,
169+
isFishing = false,
170+
course = 16.445,
171+
latitude = 48.2525,
172+
longitude = 1.8,
173+
speed = 180.0,
174+
isAtPort = false,
175+
dateTime = now.minusHours(
134176
2,
135177
),
136178
)

0 commit comments

Comments
 (0)