Skip to content

Commit

Permalink
review: ivan's review. Renaming props
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeperrault authored and maximeperraultdev committed Oct 25, 2024
1 parent 0c6f79b commit 32604d6
Show file tree
Hide file tree
Showing 41 changed files with 240 additions and 236 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ data class DashboardEntity(
val updatedAt: ZonedDateTime?,
val inseeCode: String?,
val seaFront: String?,
val amps: List<Int>,
val controlUnits: List<Int>,
val regulatoryAreas: List<Int>,
val reportings: List<Int>,
val vigilanceAreas: List<Int>,
val ampIds: List<Int>,
val controlUnitIds: List<Int>,
val regulatoryAreaIds: List<Int>,
val reportingIds: List<Int>,
val vigilanceAreaIds: List<Int>,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package fr.gouv.cacem.monitorenv.domain.entities.dashboard

data class ExtractedAreaEntity(
val inseeCode: String?,
val reportings: List<Int>,
val regulatoryAreas: List<Int>,
val amps: List<Int>,
val vigilanceAreas: List<Int>,
val reportingIds: List<Int>,
val regulatoryAreaIds: List<Int>,
val ampIds: List<Int>,
val vigilanceAreaIds: List<Int>,
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ interface IAMPRepository {

fun count(): Long

fun findAllIdByGeometry(geometry: Geometry): List<Int>
fun findAllIdsByGeometry(geometry: Geometry): List<Int>
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ interface IRegulatoryAreaRepository {

fun count(): Long

fun findAllIdByGeometry(geometry: Geometry): List<Int>
fun findAllIdsByGeometry(geometry: Geometry): List<Int>
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ interface IReportingRepository {

fun save(reporting: ReportingEntity): ReportingDTO

fun findAllIdByGeometry(geometry: Geometry): List<Int>
fun findAllIdsByGeometry(geometry: Geometry): List<Int>
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ interface IVigilanceAreaRepository {

fun archiveOutdatedVigilanceAreas(): Int

fun findAllIdByGeometry(geometry: Geometry): List<Int>
fun findAllIdsByGeometry(geometry: Geometry): List<Int>
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ class ExtractArea(
) {
fun execute(geometry: Geometry): ExtractedAreaEntity {
val inseeCode = departmentAreaRepository.findDepartmentFromGeometry(geometry = geometry)
val reportings = reportingRepository.findAllIdByGeometry(geometry = geometry)
val regulatoryAreas = regulatoryAreaRepository.findAllIdByGeometry(geometry = geometry)
val amps = ampRepository.findAllIdByGeometry(geometry = geometry)
val vigilanceAreas = vigilanceAreaRepository.findAllIdByGeometry(geometry = geometry)
val reportings = reportingRepository.findAllIdsByGeometry(geometry = geometry)
val regulatoryAreas = regulatoryAreaRepository.findAllIdsByGeometry(geometry = geometry)
val amps = ampRepository.findAllIdsByGeometry(geometry = geometry)
val vigilanceAreas = vigilanceAreaRepository.findAllIdsByGeometry(geometry = geometry)

return ExtractedAreaEntity(
inseeCode = inseeCode,
reportings = reportings,
regulatoryAreas = regulatoryAreas,
amps = amps,
vigilanceAreas = vigilanceAreas,
reportingIds = reportings,
regulatoryAreaIds = regulatoryAreas,
ampIds = amps,
vigilanceAreaIds = vigilanceAreas,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class DashboardDataInput(
val updatedAt: ZonedDateTime?,
val comments: String?,
val inseeCode: String?,
val amps: List<Int>,
val controlUnits: List<Int>,
val regulatoryAreas: List<Int>,
val reportings: List<Int>,
val vigilanceAreas: List<Int>,
val ampIds: List<Int>,
val controlUnitIds: List<Int>,
val regulatoryAreaIds: List<Int>,
val reportingIds: List<Int>,
val vigilanceAreaIds: List<Int>,
) {
fun toDashboardEntity(): DashboardEntity {
return DashboardEntity(
Expand All @@ -28,11 +28,11 @@ class DashboardDataInput(
createdAt = createdAt,
updatedAt = updatedAt,
inseeCode = inseeCode,
amps = amps,
controlUnits = controlUnits,
reportings = reportings,
regulatoryAreas = regulatoryAreas,
vigilanceAreas = vigilanceAreas,
ampIds = ampIds,
controlUnitIds = controlUnitIds,
reportingIds = reportingIds,
regulatoryAreaIds = regulatoryAreaIds,
vigilanceAreaIds = vigilanceAreaIds,
seaFront = null,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class DashboardDataOutput(
val createdAt: ZonedDateTime?,
val updatedAt: ZonedDateTime?,
val inseeCode: String?,
val amps: List<Int>,
val controlUnits: List<Int>,
val regulatoryAreas: List<Int>,
val reportings: List<Int>,
val vigilanceAreas: List<Int>,
val ampIds: List<Int>,
val controlUnitIds: List<Int>,
val regulatoryAreaIds: List<Int>,
val reportingIds: List<Int>,
val vigilanceAreaIds: List<Int>,
) {
companion object {
fun fromDashboardEntity(dashboardEntity: DashboardEntity): DashboardDataOutput {
Expand All @@ -29,11 +29,11 @@ class DashboardDataOutput(
createdAt = dashboardEntity.createdAt,
updatedAt = dashboardEntity.updatedAt,
inseeCode = dashboardEntity.inseeCode,
amps = dashboardEntity.amps,
controlUnits = dashboardEntity.controlUnits,
regulatoryAreas = dashboardEntity.regulatoryAreas,
reportings = dashboardEntity.reportings,
vigilanceAreas = dashboardEntity.vigilanceAreas,
ampIds = dashboardEntity.ampIds,
controlUnitIds = dashboardEntity.controlUnitIds,
regulatoryAreaIds = dashboardEntity.regulatoryAreaIds,
reportingIds = dashboardEntity.reportingIds,
vigilanceAreaIds = dashboardEntity.vigilanceAreaIds,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package fr.gouv.cacem.monitorenv.infrastructure.api.adapters.bff.outputs.dashboa
import fr.gouv.cacem.monitorenv.domain.entities.dashboard.DashboardEntity
import org.locationtech.jts.geom.Geometry
import java.time.ZonedDateTime
import java.util.*
import java.util.UUID

class DashboardsDataOutput(
val id: UUID?,
Expand All @@ -13,12 +13,12 @@ class DashboardsDataOutput(
val createdAt: ZonedDateTime?,
val updatedAt: ZonedDateTime?,
val inseeCode: String?,
val amps: List<Int>,
val controlUnits: List<Int>,
val regulatoryAreas: List<Int>,
val reportings: List<Int>,
val ampIds: List<Int>,
val controlUnitIds: List<Int>,
val regulatoryAreaIds: List<Int>,
val reportingIds: List<Int>,
val vigilanceAreaIds: List<Int>,
val seaFront: String?,
val vigilanceAreas: List<Int>,
) {
companion object {
fun fromDashboardEntity(dashboardEntity: DashboardEntity): DashboardsDataOutput {
Expand All @@ -30,12 +30,12 @@ class DashboardsDataOutput(
createdAt = dashboardEntity.createdAt,
updatedAt = dashboardEntity.updatedAt,
inseeCode = dashboardEntity.inseeCode,
amps = dashboardEntity.amps,
controlUnits = dashboardEntity.controlUnits,
regulatoryAreas = dashboardEntity.regulatoryAreas,
reportings = dashboardEntity.reportings,
ampIds = dashboardEntity.ampIds,
controlUnitIds = dashboardEntity.controlUnitIds,
regulatoryAreaIds = dashboardEntity.regulatoryAreaIds,
reportingIds = dashboardEntity.reportingIds,
seaFront = dashboardEntity.seaFront,
vigilanceAreas = dashboardEntity.vigilanceAreas,
vigilanceAreaIds = dashboardEntity.vigilanceAreaIds,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import fr.gouv.cacem.monitorenv.domain.entities.dashboard.ExtractedAreaEntity

class ExtractedAreaDataOutput(
val inseeCode: String?,
val reportings: List<Int>,
val regulatoryAreas: List<Int>,
val amps: List<Int>,
val vigilanceAreas: List<Int>,
val reportingIds: List<Int>,
val regulatoryAreaIds: List<Int>,
val ampIds: List<Int>,
val vigilanceAreaIds: List<Int>,
) {
companion object {
fun fromExtractAreaEntity(extractedAreaEntity: ExtractedAreaEntity): ExtractedAreaDataOutput {
return ExtractedAreaDataOutput(
inseeCode = extractedAreaEntity.inseeCode,
reportings = extractedAreaEntity.reportings,
regulatoryAreas = extractedAreaEntity.regulatoryAreas,
amps = extractedAreaEntity.amps,
vigilanceAreas = extractedAreaEntity.vigilanceAreas,
reportingIds = extractedAreaEntity.reportingIds,
regulatoryAreaIds = extractedAreaEntity.regulatoryAreaIds,
ampIds = extractedAreaEntity.ampIds,
vigilanceAreaIds = extractedAreaEntity.vigilanceAreaIds,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ data class DashboardModel(
createdAt = createdAt,
updatedAt = updatedAt,
inseeCode = inseeCode,
amps = amps,
controlUnits = controlUnits,
regulatoryAreas = regulatoryAreas,
reportings = reportings,
vigilanceAreas = vigilanceAreas,
ampIds = amps,
controlUnitIds = controlUnits,
regulatoryAreaIds = regulatoryAreas,
reportingIds = reportings,
vigilanceAreaIds = vigilanceAreas,
seaFront = seaFront,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class JpaAMPRepository(private val dbAMPRepository: IDBAMPRepository) :
return dbAMPRepository.count()
}

override fun findAllIdByGeometry(geometry: Geometry): List<Int> {
return dbAMPRepository.findAllIdByGeom(geometry)
override fun findAllIdsByGeometry(geometry: Geometry): List<Int> {
return dbAMPRepository.findAllIdsByGeom(geometry)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class JpaDashboardRepository(
dashboard: DashboardEntity,
dashboardDatasToSave: MutableList<DashboardDatasModel>,
) {
dashboard.regulatoryAreas.forEach {
dashboard.regulatoryAreaIds.forEach {
dashboardDatasToSave.add(
DashboardDatasModel(
id = null,
Expand All @@ -67,7 +67,7 @@ class JpaDashboardRepository(
dashboard: DashboardEntity,
dashboardDatasToSave: MutableList<DashboardDatasModel>,
) {
dashboard.vigilanceAreas.forEach {
dashboard.vigilanceAreaIds.forEach {
dashboardDatasToSave.add(
DashboardDatasModel(
id = null,
Expand All @@ -87,7 +87,7 @@ class JpaDashboardRepository(
dashboard: DashboardEntity,
dashboardDatasToSave: MutableList<DashboardDatasModel>,
) {
dashboard.reportings.forEach {
dashboard.reportingIds.forEach {
dashboardDatasToSave.add(
DashboardDatasModel(
id = null,
Expand Down Expand Up @@ -127,7 +127,7 @@ class JpaDashboardRepository(
dashboard: DashboardEntity,
dashboardDatasToSave: MutableList<DashboardDatasModel>,
) {
dashboard.amps.forEach {
dashboard.ampIds.forEach {
dashboardDatasToSave.add(
DashboardDatasModel(
id = null,
Expand All @@ -147,7 +147,7 @@ class JpaDashboardRepository(
dashboard: DashboardEntity,
dashboardDatasToSave: MutableList<DashboardDatasModel>,
) {
dashboard.controlUnits.forEach {
dashboard.controlUnitIds.forEach {
dashboardDatasToSave.add(
DashboardDatasModel(
id = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class JpaRegulatoryAreaRepository(private val dbRegulatoryAreaRepository: IDBReg
return dbRegulatoryAreaRepository.count()
}

override fun findAllIdByGeometry(geometry: Geometry): List<Int> {
return dbRegulatoryAreaRepository.findAllIdByGeom(geometry)
override fun findAllIdsByGeometry(geometry: Geometry): List<Int> {
return dbRegulatoryAreaRepository.findAllIdsByGeom(geometry)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ class JpaReportingRepository(
}

@Transactional
override fun findAllIdByGeometry(geometry: Geometry): List<Int> {
return dbReportingRepository.findAllByGeom(geometry = geometry)
override fun findAllIdsByGeometry(geometry: Geometry): List<Int> {
return dbReportingRepository.findAllIdsByGeom(geometry = geometry)
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class JpaVigilanceAreaRepository(
return dbVigilanceAreaRepository.findAllByIsDeletedIsFalse().map { it.toVigilanceAreaEntity() }
}

override fun findAllIdByGeometry(geometry: Geometry): List<Int> {
return dbVigilanceAreaRepository.findAllIdByGeom(geometry)
override fun findAllIdsByGeometry(geometry: Geometry): List<Int> {
return dbVigilanceAreaRepository.findAllIdsByGeom(geometry)
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ interface IDBAMPRepository : JpaRepository<AMPModel, Int> {
WHERE ST_INTERSECTS(st_setsrid(geom, 4326), st_setsrid(:geometry, 4326))
""",
)
fun findAllIdByGeom(geometry: Geometry): List<Int>
fun findAllIdsByGeom(geometry: Geometry): List<Int>
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ interface IDBRegulatoryAreaRepository : JpaRepository<RegulatoryAreaModel, Int>
WHERE ST_INTERSECTS(st_setsrid(r.geom, 4326), st_setsrid(:geometry, 4326))
""",
)
fun findAllIdByGeom(geometry: Geometry): List<Int>
fun findAllIdsByGeom(geometry: Geometry): List<Int>
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,5 @@ interface IDBReportingRepository : JpaRepository<ReportingModel, Int> {
WHERE ST_INTERSECTS(st_setsrid(r.geom, 4326), st_setsrid(:geometry, 4326))
""",
)
fun findAllByGeom(geometry: Geometry): List<Int>
fun findAllIdsByGeom(geometry: Geometry): List<Int>
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ interface IDBVigilanceAreaRepository : JpaRepository<VigilanceAreaModel, Int> {
WHERE ST_INTERSECTS(st_setsrid(vigilanceArea.geom, 4326), st_setsrid(:geometry, 4326))
""",
)
fun findAllIdByGeom(geometry: Geometry): List<Int>
fun findAllIdsByGeom(geometry: Geometry): List<Int>
}
Loading

0 comments on commit 32604d6

Please sign in to comment.