-
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.
[Reporting] Create specific output for getAllReportings
- Loading branch information
1 parent
7ccf8a0
commit d1e2eb2
Showing
15 changed files
with
111 additions
and
65 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
4 changes: 2 additions & 2 deletions
4
...in/kotlin/fr/gouv/cacem/monitorenv/domain/use_cases/reportings/dtos/ReportingSourceDTO.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,11 +1,11 @@ | ||
package fr.gouv.cacem.monitorenv.domain.use_cases.reportings.dtos | ||
|
||
import fr.gouv.cacem.monitorenv.domain.entities.controlUnit.ControlUnitEntity | ||
import fr.gouv.cacem.monitorenv.domain.entities.reporting.ReportingSourceEntity | ||
import fr.gouv.cacem.monitorenv.domain.entities.semaphore.SemaphoreEntity | ||
import fr.gouv.cacem.monitorenv.domain.use_cases.controlUnit.dtos.FullControlUnitDTO | ||
|
||
data class ReportingSourceDTO( | ||
val reportingSource: ReportingSourceEntity, | ||
val semaphore: SemaphoreEntity?, | ||
val controlUnit: FullControlUnitDTO?, | ||
val controlUnit: ControlUnitEntity?, | ||
) |
34 changes: 34 additions & 0 deletions
34
...rc/main/kotlin/fr/gouv/cacem/monitorenv/domain/use_cases/reportings/dtos/ReportingsDTO.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,34 @@ | ||
package fr.gouv.cacem.monitorenv.domain.use_cases.reportings.dtos | ||
|
||
import fr.gouv.cacem.monitorenv.domain.entities.mission.MissionEntity | ||
import fr.gouv.cacem.monitorenv.domain.entities.mission.envAction.ActionTypeEnum | ||
import fr.gouv.cacem.monitorenv.domain.entities.reporting.ControlStatusEnum | ||
import fr.gouv.cacem.monitorenv.domain.entities.reporting.ReportingEntity | ||
|
||
data class ReportingsDTO( | ||
val reporting: ReportingEntity, | ||
val reportingSources: List<ReportingSourceDTO>, | ||
val attachedMission: MissionEntity? = null, | ||
) { | ||
val controlStatus: ControlStatusEnum? | ||
get() = | ||
when { | ||
this.reporting.attachedEnvActionId != null && | ||
this.attachedMission?.envActions | ||
?.find { it.id == this.reporting.attachedEnvActionId } | ||
?.actionType == ActionTypeEnum.SURVEILLANCE -> | ||
ControlStatusEnum.SURVEILLANCE_DONE | ||
|
||
this.reporting.attachedEnvActionId != null && | ||
this.attachedMission?.envActions | ||
?.find { it.id == this.reporting.attachedEnvActionId } | ||
?.actionType == ActionTypeEnum.CONTROL -> | ||
ControlStatusEnum.CONTROL_DONE | ||
|
||
this.reporting.attachedEnvActionId == null && | ||
this.reporting.isControlRequired == true -> | ||
ControlStatusEnum.CONTROL_TO_BE_DONE | ||
|
||
else -> 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
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.