-
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.
Refactor CreateOrUpdateMissionWithAttachedReporting
- Loading branch information
1 parent
9d0c622
commit 97e6e7d
Showing
38 changed files
with
248 additions
and
383 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+17 Bytes
backend/.gradle/8.4/dependencies-accessors/dependencies-accessors.lock
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
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,2 @@ | ||
#Wed Oct 18 10:21:17 CEST 2023 | ||
gradle.version=8.4 |
Binary file not shown.
Binary file not shown.
Empty file.
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
14 changes: 14 additions & 0 deletions
14
.../src/main/kotlin/fr/gouv/cacem/monitorenv/domain/use_cases/missions/GetFullMissionById.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,14 @@ | ||
@file:Suppress("ktlint:standard:package-name") | ||
|
||
package fr.gouv.cacem.monitorenv.domain.use_cases.missions | ||
|
||
import fr.gouv.cacem.monitorenv.config.UseCase | ||
import fr.gouv.cacem.monitorenv.domain.repositories.IMissionRepository | ||
import fr.gouv.cacem.monitorenv.domain.use_cases.missions.dtos.MissionDTO | ||
|
||
@UseCase | ||
class GetFullMissionById(private val missionRepository: IMissionRepository) { | ||
fun execute(missionId: Int): MissionDTO { | ||
return missionRepository.findFullMissionById(missionId) | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...end/src/main/kotlin/fr/gouv/cacem/monitorenv/domain/use_cases/missions/GetFullMissions.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,49 @@ | ||
@file:Suppress("ktlint:standard:package-name") | ||
|
||
package fr.gouv.cacem.monitorenv.domain.use_cases.missions | ||
|
||
import fr.gouv.cacem.monitorenv.config.UseCase | ||
import fr.gouv.cacem.monitorenv.domain.entities.mission.MissionSourceEnum | ||
import fr.gouv.cacem.monitorenv.domain.repositories.IMissionRepository | ||
import fr.gouv.cacem.monitorenv.domain.use_cases.missions.dtos.MissionDTO | ||
import org.slf4j.LoggerFactory | ||
import org.springframework.data.domain.PageRequest | ||
import org.springframework.data.domain.Pageable | ||
import java.time.ZonedDateTime | ||
|
||
@UseCase | ||
class GetFullMissions(private val missionRepository: IMissionRepository) { | ||
private val logger = LoggerFactory.getLogger(GetFullMissions::class.java) | ||
|
||
fun execute( | ||
startedAfterDateTime: ZonedDateTime?, | ||
startedBeforeDateTime: ZonedDateTime?, | ||
missionSources: List<MissionSourceEnum>?, | ||
missionTypes: List<String>?, | ||
missionStatuses: List<String>?, | ||
pageNumber: Int?, | ||
pageSize: Int?, | ||
seaFronts: List<String>?, | ||
): List<MissionDTO> { | ||
val missions = missionRepository.findAllFullMissions( | ||
startedAfter = startedAfterDateTime?.toInstant() ?: ZonedDateTime.now().minusDays(30).toInstant(), | ||
startedBefore = startedBeforeDateTime?.toInstant(), | ||
missionSources = missionSources ?: listOf(MissionSourceEnum.MONITORENV, MissionSourceEnum.MONITORFISH), | ||
missionTypes = missionTypes, | ||
missionStatuses = missionStatuses, | ||
seaFronts = seaFronts, | ||
pageable = if (pageNumber != null && pageSize != null) { | ||
PageRequest.of( | ||
pageNumber, | ||
pageSize, | ||
) | ||
} else { | ||
Pageable.unpaged() | ||
}, | ||
) | ||
|
||
logger.info("Found ${missions.size} mission(s)") | ||
|
||
return missions | ||
} | ||
} |
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.