Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

375 - front ajouter une infraction pour cette cible #378

Merged
merged 33 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
59f3d39
feat(365)- display du bouton "ajouter une infraction pour cette cible…
aleckvincent Sep 30, 2024
9c5127e
feat(365)- une tuile par infraction
aleckvincent Sep 30, 2024
a3db448
feat(365)- remove useless props in test
aleckvincent Sep 30, 2024
2ba9a88
feat(365)- check with action targetType
aleckvincent Oct 1, 2024
ab47f9c
bugfix(376) - fix issue with hook useMissionTimeLine for checking isM…
aleckvincent Sep 30, 2024
55d1c4e
fix(missions): update getMissions fetch policy
lwih Sep 30, 2024
6189ae8
fix(fish): remove warning about missiong key in map
lwih Sep 30, 2024
d6ba6cf
fix(login): trim and lowercase email
lwih Sep 30, 2024
acd4a79
fix(infractions): fix infractions not being submitted
lwih Sep 30, 2024
1fb0592
fix(controls): toggle on unitHasConfirmed when required
lwih Sep 30, 2024
c717dc6
fix(controls): fix fish controls being toggled on automatically on ac…
lwih Sep 30, 2024
36e9131
Release 2.0.9
lwih Oct 1, 2024
4787459
fix issue with tests
aleckvincent Oct 1, 2024
7deab13
feat(infraction)- groupby controlled person also
xtiannyeto Oct 1, 2024
d84d4db
fix(warning): remove front dead code
xtiannyeto Jul 25, 2024
e10435d
fix(warning): remove unused import
xtiannyeto Aug 22, 2024
8f5287c
fix(build): update import
xtiannyeto Oct 2, 2024
f516445
fix(build): update import
xtiannyeto Oct 2, 2024
0f040c5
fix(build): update import
xtiannyeto Oct 2, 2024
57f85cb
fix(build): update import
xtiannyeto Oct 2, 2024
daf30d5
fix(build): update import
xtiannyeto Oct 2, 2024
0f56cbd
feat(RapportPatrouille): move docx creation into rapportnav2
lwih Oct 1, 2024
5fc2f7a
fix(crew): update Themis A
lwih Oct 2, 2024
b30778c
Release 2.1.0
lwih Oct 2, 2024
e17df4b
fix(login): fix faulty lowercase method on the email
lwih Oct 2, 2024
04fb4b1
Release 2.1.1
lwih Oct 2, 2024
4b8366f
Release 2.1.2
lwih Oct 2, 2024
bd06058
use "Personne morale" instead of "Société"
aleckvincent Oct 7, 2024
d48dba4
display identifiedControlledPerson name
aleckvincent Oct 7, 2024
d4418df
add Display button when controlType is null
aleckvincent Oct 8, 2024
198ae62
fix(rapport de patrouille): fix encoding
lwih Oct 2, 2024
ad6c6e8
feat(rapport de patrouille): add bilan opérationnel
lwih Oct 8, 2024
cca7e7e
Release 2.2.0
lwih Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ variables:
value: "postgres:15.8-alpine"
description: "Image de la base de données"
PROJECT_VERSION:
value: "2.0.8"
value: "2.2.0"
description: "Version du projet à déployer"
SERVER_ENV_INT:
value: "int-rapportnav-appli01"
Expand Down
6 changes: 4 additions & 2 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.lang.System.getenv

group = "fr.gouv.dgampa"
version = "2.0.8"
version = "2.2.0"
description = "RapportNav"

val kotlinVersion by extra("1.9.24")
Expand Down Expand Up @@ -81,7 +81,8 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
implementation("io.sentry:sentry-spring-boot-starter-jakarta:7.1.0")
implementation("io.sentry:sentry-log4j2:7.0.0")
implementation("org.apache.poi:poi:5.2.3")
// the two following apoche poi dependencies should have the same version
implementation("org.apache.poi:poi:5.3.0")
implementation("org.apache.poi:poi-ooxml:5.3.0")
implementation("org.apache.commons:commons-text:1.12.0")
implementation("org.jodconverter:jodconverter-local-lo:4.4.7")
Expand All @@ -93,6 +94,7 @@ dependencies {
testImplementation("org.testcontainers:junit-jupiter")
testImplementation("org.testcontainers:postgresql")
testImplementation("org.springframework.security:spring-security-test:6.3.2")
testImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0")
}

buildscript {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control

import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.infraction.InfractionEntity
import java.util.*

abstract class BaseControlEntity {
abstract var id: UUID
abstract val actionControlId: String
open val unitShouldConfirm: Boolean? = null
open var unitHasConfirmed: Boolean? = null
open val infractions: List<InfractionEntity>? = null
open val observations: String? = null

abstract fun shouldToggleOnUnitHasConfirmed(): Boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@ import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.infraction.Infracti
import java.util.*

data class ControlAdministrativeEntity(
var id: UUID,
override var id: UUID,
val missionId: Int,
val actionControlId: String,
override val actionControlId: String,
val amountOfControls: Int,
val unitShouldConfirm: Boolean? = null,
val unitHasConfirmed: Boolean? = null,
override val unitShouldConfirm: Boolean? = null,
override var unitHasConfirmed: Boolean? = null,
val compliantOperatingPermit: ControlResult? = null,
val upToDateNavigationPermit: ControlResult? = null,
val compliantSecurityDocuments: ControlResult? = null,
val observations: String? = null,
val infractions: List<InfractionEntity>? = null
)
override val observations: String? = null,
override val infractions: List<InfractionEntity>? = null
) : BaseControlEntity() {
override fun shouldToggleOnUnitHasConfirmed(): Boolean =
unitShouldConfirm == true &&
unitHasConfirmed != true &&
(compliantOperatingPermit != null ||
upToDateNavigationPermit != null ||
compliantSecurityDocuments != null ||
infractions?.isNotEmpty() == true ||
observations != null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@ import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.infraction.Infracti
import java.util.*

data class ControlGensDeMerEntity(
var id: UUID,
override var id: UUID,
val missionId: Int,
val actionControlId: String,
override val actionControlId: String,
val amountOfControls: Int,
val unitShouldConfirm: Boolean? = null,
val unitHasConfirmed: Boolean? = null,
override val unitShouldConfirm: Boolean? = null,
override var unitHasConfirmed: Boolean? = null,
val staffOutnumbered: ControlResult? = null,
val upToDateMedicalCheck: ControlResult? = null,
val knowledgeOfFrenchLawAndLanguage: ControlResult? = null,
val observations: String? = null,
val infractions: List<InfractionEntity>? = null
) {

override val observations: String? = null,
override val infractions: List<InfractionEntity>? = null
) : BaseControlEntity() {
override fun shouldToggleOnUnitHasConfirmed(): Boolean =
unitShouldConfirm == true &&
unitHasConfirmed != true &&
(staffOutnumbered != null ||
upToDateMedicalCheck != null ||
knowledgeOfFrenchLawAndLanguage != null ||
infractions?.isNotEmpty() == true ||
observations != null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.infraction.Infracti
import java.util.*

data class ControlNavigationEntity(
var id: UUID,
override var id: UUID,
val missionId: Int,
val actionControlId: String,
override val actionControlId: String,
val amountOfControls: Int,
val unitShouldConfirm: Boolean? = null,
val unitHasConfirmed: Boolean? = null,
val observations: String? = null,
val infractions: List<InfractionEntity>? = null
) {

override val unitShouldConfirm: Boolean? = null,
override var unitHasConfirmed: Boolean? = null,
override val observations: String? = null,
override val infractions: List<InfractionEntity>? = null
) : BaseControlEntity() {
override fun shouldToggleOnUnitHasConfirmed(): Boolean =
unitShouldConfirm == true &&
unitHasConfirmed != true &&
(
infractions?.isNotEmpty() == true ||
observations != null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.infraction.Infracti
import java.util.*

data class ControlSecurityEntity(
var id: UUID,
override var id: UUID,
val missionId: Int,
val actionControlId: String,
override val actionControlId: String,
val amountOfControls: Int,
val unitShouldConfirm: Boolean? = null,
val unitHasConfirmed: Boolean? = null,
val observations: String? = null,
val infractions: List<InfractionEntity>? = null
) {

override val unitShouldConfirm: Boolean? = null,
override var unitHasConfirmed: Boolean? = null,
override val observations: String? = null,
override val infractions: List<InfractionEntity>? = null
) : BaseControlEntity() {
override fun shouldToggleOnUnitHasConfirmed(): Boolean =
unitShouldConfirm == true &&
unitHasConfirmed != true &&
(
infractions?.isNotEmpty() == true ||
observations != null
)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class GetEnvMissionById(
observations = "Observation test",
isSeafarersControl = false, // Adjust based on your API response
isAdministrativeControl = false, // Adjust based on your API response
controlPlans = null,
infractions = listOf(
InfractionEntity(
id = "91200795-2823-46b3-8814-a5b3bca29a47",
Expand All @@ -91,8 +92,8 @@ class GetEnvMissionById(
controlPlans = listOf(controlTheme1),
geom = createMockMultiPoint(listOf(Coordinate(-8.52318191, 48.30305604))),
actionNumberOfControls = 5,
actionTargetType = ActionTargetTypeEnum.VEHICLE,
vehicleType = VehicleTypeEnum.VESSEL,
actionTargetType = ActionTargetTypeEnum.INDIVIDUAL,
vehicleType = null,
observations = "blablabla",
isSeafarersControl = true,
isAdministrativeControl = true,
Expand Down Expand Up @@ -121,7 +122,7 @@ class GetEnvMissionById(
controlPlans = listOf(controlTheme1),
actionNumberOfControls = 10,
geom = createMockMultiPoint(listOf(Coordinate(-8.52318191, 48.30305604))),
actionTargetType = null,
actionTargetType = ActionTargetTypeEnum.COMPANY,
vehicleType = null,
observations = null,
observationsByUnit = "dummy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class GetEnvMissions(
missionSource = MissionSourceEnum.MONITORENV,
hasMissionOrder = false,
isUnderJdp = false,
isGeometryComputedFromControls = false
isGeometryComputedFromControls = false,
observationsByUnit = "lorem ipsum",
openBy = "Dummy service"
)
val mission3 = EnvMission(
id = 12,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package fr.gouv.dgampa.rapportnav.domain.use_cases.mission.control

import fr.gouv.dgampa.rapportnav.config.UseCase
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlAdministrativeEntity
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlGensDeMerEntity
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlNavigationEntity
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlSecurityEntity
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.*
import fr.gouv.dgampa.rapportnav.domain.repositories.mission.control.IControlAdministrativeRepository
import fr.gouv.dgampa.rapportnav.domain.repositories.mission.control.IControlGensDeMerRepository
import fr.gouv.dgampa.rapportnav.domain.repositories.mission.control.IControlNavigationRepository
Expand All @@ -19,56 +16,54 @@ class AddOrUpdateControl(
private val getControlByActionId: GetControlByActionId,
) {


fun addOrUpdateControlAdministrative(control: ControlAdministrativeEntity): ControlAdministrativeEntity {
val existingControl = getControlByActionId.getControlAdministrative(control.actionControlId)
var controlToSave: ControlAdministrativeEntity?
private inline fun <T : BaseControlEntity> addOrUpdateControl(
control: T,
getExistingControl: (String) -> T?,
saveControl: (T) -> T
): T {
val existingControl = getExistingControl(control.actionControlId)
val controlToSave: BaseControlEntity = control
if (existingControl != null) {
controlToSave = control
controlToSave.id = existingControl.id
} else {
controlToSave = control
}
val savedData = controlAdministrativeRepo.save(controlToSave).toControlAdministrativeEntity()
return savedData

if (controlToSave.shouldToggleOnUnitHasConfirmed()) {
controlToSave.unitHasConfirmed = true
}

return saveControl(controlToSave as T)
}


fun addOrUpdateControlAdministrative(control: ControlAdministrativeEntity): ControlAdministrativeEntity {
return addOrUpdateControl(
control = control,
getExistingControl = { getControlByActionId.getControlAdministrative(it) },
saveControl = { controlAdministrativeRepo.save(it).toControlAdministrativeEntity() }
)
}

fun addOrUpdateControlSecurity(control: ControlSecurityEntity): ControlSecurityEntity {
val existingControl = getControlByActionId.getControlSecurity(control.actionControlId)
var controlToSave: ControlSecurityEntity?
if (existingControl != null) {
controlToSave = control
controlToSave.id = existingControl.id
} else {
controlToSave = control
}
val savedData = controlSecurityRepo.save(controlToSave).toControlSecurityEntity()
return savedData
return addOrUpdateControl(
control = control,
getExistingControl = { getControlByActionId.getControlSecurity(it) },
saveControl = { controlSecurityRepo.save(it).toControlSecurityEntity() }
)
}

fun addOrUpdateControlNavigation(control: ControlNavigationEntity): ControlNavigationEntity {
val existingControl = getControlByActionId.getControlNavigation(control.actionControlId)
var controlToSave: ControlNavigationEntity?
if (existingControl != null) {
controlToSave = control
controlToSave.id = existingControl.id
} else {
controlToSave = control
}
val savedData = controlNavigationRepo.save(controlToSave).toControlNavigationEntity()
return savedData
return addOrUpdateControl(
control = control,
getExistingControl = { getControlByActionId.getControlNavigation(it) },
saveControl = { controlNavigationRepo.save(it).toControlNavigationEntity() }
)
}

fun addOrUpdateControlGensDeMer(control: ControlGensDeMerEntity): ControlGensDeMerEntity {
val existingControl = getControlByActionId.getControlGensDeMer(control.actionControlId)
var controlToSave: ControlGensDeMerEntity?
if (existingControl != null) {
controlToSave = control
controlToSave.id = existingControl.id
} else {
controlToSave = control
}
val savedData = controlGensDeMerRepo.save(controlToSave).toControlGensDeMerEntity()
return savedData
return addOrUpdateControl(
control = control,
getExistingControl = { getControlByActionId.getControlGensDeMer(it) },
saveControl = { controlGensDeMerRepo.save(it).toControlGensDeMerEntity() }
)
}
}
Loading
Loading