-
Notifications
You must be signed in to change notification settings - Fork 1
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
Mission General Information ULAM #529
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
4c27f5f
feat(user): api get user infos
xtiannyeto e51de9d
feat(user): front user infos
xtiannyeto 04fd1d2
feat(userInfos): Page title
xtiannyeto ad9797c
Merge branch 'main' into feature/user-informations-display
xtiannyeto f5ce9bf
set MissionCrew#role as nullable and add rest controllers for crew
aleckvincent 36140ec
improve add and delete crew for ulam
aleckvincent c813ed9
combine initial and extended form (missionGeneralInfo)
aleckvincent 1f260cb
impprove creteUpdate mission
aleckvincent 5d9e5cb
add patchObservationByUnit
aleckvincent 449c1b2
improve GeneralInfo ui
aleckvincent 38009bb
fix issue with agent can't be selected in FormikMultiSelect
aleckvincent fc3b7f8
add hook for handleSubmit
aleckvincent e1882b9
improve check role crew
aleckvincent 520daf3
add missings fields in entity and model GeneralInfo
aleckvincent 628714a
refactoring MissionGeneralInfoForm
aleckvincent b5c85dd
add missing fields
aleckvincent 6b3c497
add missionId in test
aleckvincent 601a498
fix(mission-general): update form handling
xtiannyeto 6f05b02
fix(general-infos): enableReinitialize set true
xtiannyeto a21bebb
add administration fetching from env
aleckvincent b3d7baa
add InterMinisterialService model
aleckvincent 24ebcc3
add MissionGeneralInfoRestController
aleckvincent b681523
feat(front): general information resources, service
xtiannyeto 825c68e
add administrations service fetching
aleckvincent cbe478f
add mutation update generalinfo
aleckvincent 6af4163
add patch env mission for ulam
aleckvincent 836ffac
remove useless methods
aleckvincent 08f231a
remove useless update mission
aleckvincent e5e39e6
remove console.log
aleckvincent 67c5763
add Get annotation
aleckvincent 2e86917
fix tests issues
aleckvincent a32fca9
add updateMission (for missionTypes)
aleckvincent 3299bcf
add mock
aleckvincent 15007d2
Release 2.5.4
aleckvincent 6926fbe
add package lock
aleckvincent 85f7a5d
fix issue on test
aleckvincent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ enum class MissionSourceEnum { | |
POSEIDON_CACEM, | ||
POSEIDON_CNSP, | ||
RAPPORTNAV, | ||
RAPPORT_NAV | ||
} |
15 changes: 14 additions & 1 deletion
15
...v/dgampa/rapportnav/domain/entities/mission/env/controlResources/ControlResourceEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.entities.mission.env.controlResources | ||
|
||
import fr.gouv.dgampa.rapportnav.infrastructure.api.bff.model.v2.env.ControlUnitResourceEnv | ||
|
||
data class ControlResourceEntity( | ||
val id: Int, | ||
val name: String, | ||
) | ||
) { | ||
companion object { | ||
fun fromControlUnitResourceEnv( | ||
resourceEnv: ControlUnitResourceEnv | ||
): ControlResourceEntity { | ||
return ControlResourceEntity( | ||
id = resourceEnv.id, | ||
name = resourceEnv.name | ||
) | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...ampa/rapportnav/domain/entities/mission/env/controlResources/ControlUnitResourceEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.entities.mission.env.controlResources | ||
|
||
class ControlUnitResourceEntity { | ||
} |
29 changes: 29 additions & 0 deletions
29
...dgampa/rapportnav/domain/entities/mission/env/controlResources/ControlUnitResourceType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.entities.mission.env.controlResources | ||
|
||
enum class ControlUnitResourceType(val label: String) { | ||
AIRPLANE("Avion"), | ||
BARGE("Barge"), | ||
CAR("Voiture"), | ||
DRONE("Drône"), | ||
EQUESTRIAN("Équestre"), | ||
FAST_BOAT("Vedette"), | ||
FRIGATE("Frégate"), | ||
HELICOPTER("Hélicoptère"), | ||
HYDROGRAPHIC_SHIP("Bâtiment hydrographique"), | ||
KAYAK("Kayak"), | ||
LIGHT_FAST_BOAT("Vedette légère"), | ||
MINE_DIVER("Plongeur démineur"), | ||
MOTORCYCLE("Moto"), | ||
NET_LIFTER("Remonte-filets"), | ||
NO_RESOURCE("Aucun moyen"), | ||
OTHER("Autre"), | ||
PATROL_BOAT("Patrouilleur"), | ||
PEDESTRIAN("Piéton"), | ||
PIROGUE("Pirogue"), | ||
RIGID_HULL("Coque rigide"), | ||
SEA_SCOOTER("Scooter de mer"), | ||
SEMI_RIGID("Semi-rigide"), | ||
SUPPORT_SHIP("Bâtiment de soutien"), | ||
TRAINING_SHIP("Bâtiment-école"), | ||
TUGBOAT("Remorqueur"), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...gampa/rapportnav/domain/entities/mission/nav/generalInfo/InterMinisterialServiceEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.generalInfo | ||
|
||
data class InterMinisterialServiceEntity( | ||
var id: Int? = null, | ||
var administrationId: Int, | ||
var controlUnitId: Int, | ||
var missionGeneralInfo: MissionGeneralInfoEntity? = null | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...n/kotlin/fr/gouv/dgampa/rapportnav/domain/entities/mission/v2/env/AdministrationEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.entities.mission.v2.env | ||
|
||
data class AdministrationEntity( | ||
val id: Int? = null, | ||
val isArchived: Boolean, | ||
val name: String, | ||
) |
10 changes: 10 additions & 0 deletions
10
...n/kotlin/fr/gouv/dgampa/rapportnav/domain/repositories/v2/IEnvAdministrationRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.repositories.v2 | ||
|
||
import fr.gouv.dgampa.rapportnav.infrastructure.monitorenv.v2.outputs.FullAdministrationDataOutput | ||
|
||
interface IEnvAdministrationRepository { | ||
|
||
fun findById(administrationId: Int): FullAdministrationDataOutput? | ||
|
||
fun findAll(): List<FullAdministrationDataOutput>? | ||
} |
10 changes: 10 additions & 0 deletions
10
...in/fr/gouv/dgampa/rapportnav/domain/repositories/v2/IInterMinisterialServiceRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.repositories.v2 | ||
|
||
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.generalInfo.InterMinisterialServiceEntity | ||
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.generalInfo.MissionGeneralInfoEntity | ||
import fr.gouv.dgampa.rapportnav.infrastructure.database.model.mission.generalInfo.InterMinisterialServiceModel | ||
|
||
interface IInterMinisterialServiceRepository { | ||
|
||
fun save(service: InterMinisterialServiceEntity, generalInfo: MissionGeneralInfoEntity): InterMinisterialServiceModel | ||
} |
8 changes: 8 additions & 0 deletions
8
...apportnav/domain/repositories/v2/controlUnitResource/IEnvControlUnitResourceRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.repositories.v2.controlUnitResource | ||
|
||
import fr.gouv.dgampa.rapportnav.infrastructure.api.bff.model.v2.env.ControlUnitResourceEnv | ||
|
||
interface IEnvControlUnitResourceRepository { | ||
|
||
fun findAll(): List<ControlUnitResourceEnv>? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
.../gouv/dgampa/rapportnav/domain/use_cases/mission/v2/AddOrUpdateInterMinisterialService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.use_cases.mission.v2 | ||
|
||
import fr.gouv.dgampa.rapportnav.config.UseCase | ||
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.generalInfo.InterMinisterialServiceEntity | ||
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.generalInfo.MissionGeneralInfoEntity | ||
import fr.gouv.dgampa.rapportnav.domain.repositories.v2.IInterMinisterialServiceRepository | ||
|
||
@UseCase | ||
class AddOrUpdateInterMinisterialService( | ||
private val repository: IInterMinisterialServiceRepository | ||
) { | ||
|
||
fun execute(generalInfoEntity: MissionGeneralInfoEntity): List<InterMinisterialServiceEntity> { | ||
val interMinisterialServices = mutableListOf<InterMinisterialServiceEntity>() | ||
generalInfoEntity.interMinisterialServices?.forEach { serviceEntity: InterMinisterialServiceEntity -> | ||
val result = repository.save(serviceEntity, generalInfoEntity) | ||
interMinisterialServices.add(result.toInterMinisterialServiceEntity()) | ||
} | ||
|
||
return interMinisterialServices | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/v2/CreateOrUpdateGeneralInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.use_cases.mission.v2 | ||
|
||
import fr.gouv.dgampa.rapportnav.config.UseCase | ||
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.generalInfo.InterMinisterialServiceEntity | ||
import fr.gouv.dgampa.rapportnav.domain.entities.mission.v2.MissionGeneralInfoEntity2 | ||
import fr.gouv.dgampa.rapportnav.domain.repositories.mission.generalInfo.IMissionGeneralInfoRepository | ||
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.CreateOrUpdateEnvMission | ||
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.PatchEnvMission | ||
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.crew.AddOrUpdateMissionCrew | ||
import fr.gouv.dgampa.rapportnav.domain.use_cases.user.GetControlUnitsForUser | ||
import fr.gouv.dgampa.rapportnav.infrastructure.api.bff.adapters.MissionEnvInput | ||
import fr.gouv.dgampa.rapportnav.infrastructure.api.bff.model.v2.generalInfo.MissionGeneralInfo2 | ||
|
||
@UseCase | ||
class CreateOrUpdateGeneralInfo( | ||
private val repository: IMissionGeneralInfoRepository, | ||
private val addOrUpdateInterMinisterialService: AddOrUpdateInterMinisterialService, | ||
private val addOrUpdateMissionCrew: AddOrUpdateMissionCrew, | ||
private val patchEnvMission: PatchEnvMission, | ||
private val createOrUpdateEnvMission: CreateOrUpdateEnvMission, | ||
private val getControlUnitsForUser: GetControlUnitsForUser | ||
) { | ||
|
||
fun execute(generalInfo2: MissionGeneralInfo2): MissionGeneralInfoEntity2 { | ||
|
||
val entity = generalInfo2.toMissionGeneralInfoEntity() | ||
val generalInfoModel = repository.save(entity) | ||
var interMinisterialServices = listOf<InterMinisterialServiceEntity>() | ||
|
||
if (entity.interMinisterialServices?.isNotEmpty() == true) { | ||
interMinisterialServices = addOrUpdateInterMinisterialService.execute(entity) | ||
} | ||
|
||
generalInfo2.crew?.forEach { crew -> | ||
addOrUpdateMissionCrew.addOrUpdateMissionCrew(crew.toMissionCrewEntity()) | ||
} | ||
|
||
patchEnvMission.execute(MissionEnvInput( | ||
startDateTimeUtc = generalInfo2.startDateTimeUtc, | ||
endDateTimeUtc = generalInfo2.endDateTimeUtc, | ||
missionId = generalInfo2.missionId, | ||
observationsByUnit = generalInfo2.observations | ||
)) | ||
|
||
val controlUnits = getControlUnitsForUser.execute() | ||
|
||
createOrUpdateEnvMission.execute(generalInfo2, controlUnits) // TODO: to be replaced by patchEnvMission (for missionTypes) | ||
|
||
val generalInfoEntity = generalInfoModel.toMissionGeneralInfoEntity(interMinisterialServices) | ||
|
||
return MissionGeneralInfoEntity2( | ||
data = generalInfoEntity | ||
) | ||
|
||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...uv/dgampa/rapportnav/domain/use_cases/mission/v2/administrations/GetAdministrationById.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.use_cases.mission.v2.administrations | ||
|
||
import fr.gouv.dgampa.rapportnav.config.UseCase | ||
import fr.gouv.dgampa.rapportnav.domain.repositories.v2.IEnvAdministrationRepository | ||
import fr.gouv.dgampa.rapportnav.infrastructure.api.bff.model.v2.env.FullAdministration | ||
import org.slf4j.LoggerFactory | ||
|
||
@UseCase | ||
class GetAdministrationById(private val administrationRepository: IEnvAdministrationRepository) { | ||
aleckvincent marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
private val logger = LoggerFactory.getLogger(GetAdministrationById::class.java) | ||
|
||
fun execute(administrationId: Int): FullAdministration? { | ||
val dataOutput = administrationRepository.findById(administrationId) | ||
|
||
if (dataOutput !== null) { | ||
return FullAdministration.fromFullAdministrationDataOutput(dataOutput) | ||
} | ||
|
||
logger.info("Administration by id : $administrationId return empty result") | ||
|
||
return null | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
.../gouv/dgampa/rapportnav/domain/use_cases/mission/v2/administrations/GetAdministrations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.use_cases.mission.v2.administrations | ||
|
||
import fr.gouv.dgampa.rapportnav.config.UseCase | ||
import fr.gouv.dgampa.rapportnav.domain.repositories.v2.IEnvAdministrationRepository | ||
import fr.gouv.dgampa.rapportnav.infrastructure.api.bff.model.v2.env.FullAdministration | ||
import org.slf4j.LoggerFactory | ||
|
||
@UseCase | ||
class GetAdministrations(private val administrationRepository: IEnvAdministrationRepository) { | ||
|
||
private val logger = LoggerFactory.getLogger(GetAdministrations::class.java) | ||
|
||
fun execute(): List<FullAdministration>? { | ||
val dataOutputs = administrationRepository.findAll() | ||
logger.info("Found ${dataOutputs?.size} administrations from env.") | ||
|
||
return dataOutputs?.map { FullAdministration.fromFullAdministrationDataOutput(it) } | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pourquoi CreateOrUPdate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On crée chez Env et on Update (missionTypes cf: mon msg dans mattermost)