-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sort FAO areas by usage in prior notification form select
- Loading branch information
1 parent
206cb9d
commit 7514fd2
Showing
23 changed files
with
223 additions
and
176 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...rfish/domain/entities/fao_area/FAOArea.kt → ...rfish/domain/entities/fao_area/FaoArea.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,5 +1,5 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.entities.fao_area | ||
|
||
data class FAOArea( | ||
data class FaoArea( | ||
val faoCode: String, | ||
) |
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
9 changes: 0 additions & 9 deletions
9
backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/repositories/FAOAreasRepository.kt
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/repositories/FaoAreaRepository.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,12 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.repositories | ||
|
||
import fr.gouv.cnsp.monitorfish.domain.entities.fao_area.FaoArea | ||
import org.locationtech.jts.geom.Point | ||
|
||
interface FaoAreaRepository { | ||
fun findAll(): List<FaoArea> | ||
|
||
fun findAllSortedByUsage(): List<FaoArea> | ||
|
||
fun findByIncluding(point: Point): List<FaoArea> | ||
} |
10 changes: 5 additions & 5 deletions
10
...o_areas/ComputeFAOAreasFromCoordinates.kt → ...o_areas/ComputeFaoAreasFromCoordinates.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
6 changes: 3 additions & 3 deletions
6
...domain/use_cases/fao_areas/GetFAOAreas.kt → ...domain/use_cases/fao_areas/GetFaoAreas.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
7 changes: 3 additions & 4 deletions
7
...cture/database/entities/FAOAreasEntity.kt → ...ucture/database/entities/FaoAreaEntity.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,20 +1,19 @@ | ||
package fr.gouv.cnsp.monitorfish.infrastructure.database.entities | ||
|
||
import fr.gouv.cnsp.monitorfish.domain.entities.fao_area.FAOArea | ||
import fr.gouv.cnsp.monitorfish.domain.entities.fao_area.FaoArea | ||
import jakarta.persistence.Column | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.Id | ||
import jakarta.persistence.Table | ||
|
||
@Entity | ||
@Table(name = "fao_areas") | ||
data class FAOAreasEntity( | ||
data class FaoAreaEntity( | ||
@Id | ||
@Column(name = "f_code") | ||
val faoCode: String, | ||
) { | ||
|
||
fun toFAOArea() = FAOArea( | ||
fun toFaoArea() = FaoArea( | ||
faoCode = faoCode, | ||
) | ||
} |
25 changes: 0 additions & 25 deletions
25
...in/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaFAOAreasRepository.kt
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
...lin/fr/gouv/cnsp/monitorfish/infrastructure/database/repositories/JpaFaoAreaRepository.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,31 @@ | ||
package fr.gouv.cnsp.monitorfish.infrastructure.database.repositories | ||
|
||
import fr.gouv.cnsp.monitorfish.domain.entities.fao_area.FaoArea | ||
import fr.gouv.cnsp.monitorfish.domain.repositories.FaoAreaRepository | ||
import fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.interfaces.DBFaoAreaRepository | ||
import org.locationtech.jts.geom.Point | ||
import org.springframework.cache.annotation.Cacheable | ||
import org.springframework.stereotype.Repository | ||
|
||
@Repository | ||
class JpaFaoAreaRepository(private val dbFAOAreaRepository: DBFaoAreaRepository) : FaoAreaRepository { | ||
@Cacheable(value = ["fao_areas"]) | ||
override fun findAll(): List<FaoArea> { | ||
return dbFAOAreaRepository.findAll().map { | ||
it.toFaoArea() | ||
} | ||
} | ||
|
||
@Cacheable(value = ["fao_areas_sorted_by_usage"]) | ||
override fun findAllSortedByUsage(): List<FaoArea> { | ||
return dbFAOAreaRepository.findAllSortedByUsage().map { | ||
it.toFaoArea() | ||
} | ||
} | ||
|
||
override fun findByIncluding(point: Point): List<FaoArea> { | ||
return dbFAOAreaRepository.findByIncluding(point).map { | ||
it.toFaoArea() | ||
} | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
.../cnsp/monitorfish/infrastructure/database/repositories/interfaces/DBFAOAreasRepository.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.