-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save work on Controls and EnvControls
- Loading branch information
Showing
38 changed files
with
498 additions
and
115 deletions.
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
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
17 changes: 17 additions & 0 deletions
17
...dgampa/rapportnav/domain/use_cases/missions/control/GetControlAdministrativeByActionId.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,17 @@ | ||
package fr.gouv.dgampa.rapportnav.domain.use_cases.missions.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.repositories.mission.control.IControlAdministrativeRepository | ||
import java.util.* | ||
|
||
@UseCase | ||
class GetControlAdministrativeByActionId(private val repository: IControlAdministrativeRepository) { | ||
fun execute(actionControlId: UUID): ControlAdministrativeEntity? { | ||
if (this.repository.existsByActionControlId(actionControlId = actionControlId)) { | ||
return this.repository.findByActionControlId(actionControlId = actionControlId).toControlAdministrativeEntity() | ||
} | ||
|
||
return 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
47 changes: 47 additions & 0 deletions
47
backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/infrastructure/bff/ActionEnvController.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,47 @@ | ||
package fr.gouv.dgampa.rapportnav.infrastructure.bff | ||
|
||
import fr.gouv.dgampa.rapportnav.domain.use_cases.missions.control.GetControlAdministrativeByActionId | ||
import fr.gouv.dgampa.rapportnav.infrastructure.bff.model.control.ControlAdministrative | ||
import fr.gouv.dgampa.rapportnav.infrastructure.bff.model.control.EnvActionData | ||
import org.springframework.graphql.data.method.annotation.SchemaMapping | ||
import org.springframework.stereotype.Controller | ||
|
||
|
||
@Controller | ||
class ActionEnvController( | ||
private val getControlAdministrativeByActionId: GetControlAdministrativeByActionId, | ||
) { | ||
|
||
// @MutationMapping | ||
// fun addOrUpdateControl(@Argument controlAction: ActionControlInput): NavActionControl { | ||
// val data = controlAction.toActionControl() | ||
// val aa = addOrUpdateControl.execute(data) | ||
// return aa.toNavActionControl() | ||
// } | ||
// | ||
// @MutationMapping | ||
// fun deleteControl(@Argument id: UUID): Boolean { | ||
// val savedData = deleteControl.execute(id) | ||
// return savedData | ||
// } | ||
|
||
@SchemaMapping(typeName = "EnvActionData", field = "controlAdministrative") | ||
fun getControlAdministrative(action: EnvActionData): ControlAdministrative? { | ||
if (action.id == null) { | ||
return null | ||
} | ||
val cc = getControlAdministrativeByActionId.execute(actionControlId = action.id)?.toControlAdministrative() | ||
return cc | ||
|
||
} | ||
@SchemaMapping(typeName = "EnvActionData", field = "amountOfControlsToComplete") | ||
fun getEnvAmountOfControlsToComplete(action: EnvActionData): Int? { | ||
return listOf( | ||
action.isAdministrativeControl, | ||
action.isComplianceWithWaterRegulationsControl, | ||
action.isSafetyEquipmentAndStandardsComplianceControl, | ||
action.isSeafarersControl | ||
).count { it == true } | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
...end/src/main/kotlin/fr/gouv/dgampa/rapportnav/infrastructure/bff/adapters/MissionInput.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
2 changes: 1 addition & 1 deletion
2
...ucture/bff/adapters/ActionControlInput.kt → ...bff/adapters/action/ActionControlInput.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
2 changes: 1 addition & 1 deletion
2
...nfrastructure/bff/adapters/ActionInput.kt → ...ucture/bff/adapters/action/ActionInput.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
2 changes: 1 addition & 1 deletion
2
...ructure/bff/adapters/ActionStatusInput.kt → .../bff/adapters/action/ActionStatusInput.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
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
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
Oops, something went wrong.