Skip to content

Commit

Permalink
review: renaming facade to sea_front
Browse files Browse the repository at this point in the history
  • Loading branch information
maximeperrault committed Oct 14, 2024
1 parent bc85bad commit 4c17803
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class DashboardEntity(
val createdAt: ZonedDateTime?,
val updatedAt: ZonedDateTime?,
val inseeCode: String?,
val facade: String?,
val seaFront: String?,
val amps: List<Int>,
val controlUnits: List<Int>,
val regulatoryAreas: List<Int>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class SaveDashboard(

fun execute(dashboard: DashboardEntity): DashboardEntity {
try {
val facade = facadeAreasRepository.findFacadeFromGeometry(dashboard.geom)
return dashboardRepository.save(dashboard.copy(facade = facade))
val seaFront = facadeAreasRepository.findFacadeFromGeometry(dashboard.geom)
return dashboardRepository.save(dashboard.copy(seaFront = seaFront))
} catch (e: Exception) {
val errorMessage = "dashboard ${dashboard.id} couldn't be saved"
logger.error(errorMessage, e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class DashboardDataInput(
reportings = reportings,
regulatoryAreas = regulatoryAreas,
vigilanceAreas = vigilanceAreas,
facade = null
seaFront = null
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ data class DashboardModel(
val comments: String?,
var createdAt: ZonedDateTime?,
var updatedAt: ZonedDateTime?,
val facade: String?,
val seaFront: String?,
@OneToMany(
mappedBy = "dashboard",
fetch = FetchType.LAZY,
Expand Down Expand Up @@ -86,7 +86,7 @@ data class DashboardModel(
regulatoryAreas = regulatoryAreas,
reportings = reportings,
vigilanceAreas = vigilanceAreas,
facade = facade
seaFront = seaFront
)
}

Expand Down Expand Up @@ -118,7 +118,7 @@ data class DashboardModel(
comments = dashboardEntity.comments,
createdAt = dashboardEntity.createdAt,
updatedAt = dashboardEntity.updatedAt,
facade = dashboardEntity.facade,
seaFront = dashboardEntity.seaFront,
dashboardDatas = mutableListOf(),
)
dashboardDatasModels.forEach {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ALTER TABLE dashboard
ADD COLUMN facade VARCHAR;
ADD COLUMN sea_front VARCHAR;

Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class SaveDashboardUTest {
private val saveDashboard = SaveDashboard(dashboardRepository, facadeAreasRepository)

@Test
fun `execute should find its facade then save dashboard and return saved dashboard`() {
fun `execute should find its sea front then save dashboard and return saved dashboard`() {
// Given
val dashboard = aDashboard()
val id = UUID.randomUUID()
val facade = "MED"
given(facadeAreasRepository.findFacadeFromGeometry(dashboard.geom)).willReturn(facade)
val dashboardWithFacade = dashboard.copy(facade = facade)
val seaFront = "MED"
given(facadeAreasRepository.findFacadeFromGeometry(dashboard.geom)).willReturn(seaFront)
val dashboardWithFacade = dashboard.copy(seaFront = seaFront)
given(dashboardRepository.save(dashboardWithFacade)).willReturn(dashboardWithFacade.copy(id = id))

// When
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DashboardFixture {
id: UUID? = null,
name: String = "",
comments: String = "",
facade: String = "",
seaFront: String = "",
geom: Geometry = WKTReader().read("MULTIPOINT ((-1.548 44.315),(-1.245 44.305))"),
amps: List<Int> = listOf(),
regulatoryAreas: List<Int> = listOf(),
Expand All @@ -33,7 +33,7 @@ class DashboardFixture {
reportings = reportings,
vigilanceAreas = vigilanceAreas,
controlUnits = controlUnits,
facade = facade
seaFront = seaFront
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class JpaDashboardRepositoryITest : AbstractDBTests() {
val dashboard =
aDashboard(
inseeCode = "94",
facade = "MED",
seaFront = "MED",
amps = listOf(1),
controlUnits = listOf(10000),
reportings = listOf(1),
Expand Down

0 comments on commit 4c17803

Please sign in to comment.