Refactor domain models and repositories: align imports, improve formatting consistency, remove unused imports, and harmonize implementation for better ZNS import compatibility.
This commit is contained in:
+39
-32
@@ -16,38 +16,45 @@ import kotlin.uuid.Uuid
|
||||
* Hinweis: Implementiert nur die für den ZNS-Import notwendigen Methoden.
|
||||
*/
|
||||
class BundeslandExposedRepository : BundeslandRepository {
|
||||
private fun rowToDom(row: ResultRow) = BundeslandDefinition(
|
||||
bundeslandId = row[BundeslaenderTable.id],
|
||||
landId = row[BundeslaenderTable.landId],
|
||||
bundeslandNr = row[BundeslaenderTable.bundeslandNr],
|
||||
oepsCode = row[BundeslaenderTable.oepsCode],
|
||||
iso3166_2_Code = row[BundeslaenderTable.iso3166_2_Code],
|
||||
name = row[BundeslaenderTable.name],
|
||||
kuerzel = row[BundeslaenderTable.kuerzel],
|
||||
wappenUrl = row[BundeslaenderTable.wappenUrl],
|
||||
istAktiv = row[BundeslaenderTable.istAktiv],
|
||||
sortierReihenfolge = row[BundeslaenderTable.sortierReihenfolge],
|
||||
createdAt = row[BundeslaenderTable.createdAt],
|
||||
updatedAt = row[BundeslaenderTable.updatedAt]
|
||||
)
|
||||
private fun rowToDom(row: ResultRow) = BundeslandDefinition(
|
||||
bundeslandId = row[BundeslaenderTable.id],
|
||||
landId = row[BundeslaenderTable.landId],
|
||||
bundeslandNr = row[BundeslaenderTable.bundeslandNr],
|
||||
oepsCode = row[BundeslaenderTable.oepsCode],
|
||||
iso3166_2_Code = row[BundeslaenderTable.iso3166_2_Code],
|
||||
name = row[BundeslaenderTable.name],
|
||||
kuerzel = row[BundeslaenderTable.kuerzel],
|
||||
wappenUrl = row[BundeslaenderTable.wappenUrl],
|
||||
istAktiv = row[BundeslaenderTable.istAktiv],
|
||||
sortierReihenfolge = row[BundeslaenderTable.sortierReihenfolge],
|
||||
createdAt = row[BundeslaenderTable.createdAt],
|
||||
updatedAt = row[BundeslaenderTable.updatedAt]
|
||||
)
|
||||
|
||||
override suspend fun findByNr(nr: Int): BundeslandDefinition? = DatabaseFactory.dbQuery {
|
||||
BundeslaenderTable.selectAll().where { BundeslaenderTable.bundeslandNr eq nr }
|
||||
.map(::rowToDom)
|
||||
.singleOrNull()
|
||||
}
|
||||
override suspend fun findByNr(nr: Int): BundeslandDefinition? = DatabaseFactory.dbQuery {
|
||||
BundeslaenderTable.selectAll().where { BundeslaenderTable.bundeslandNr eq nr }
|
||||
.map(::rowToDom)
|
||||
.singleOrNull()
|
||||
}
|
||||
|
||||
// Dummy-Implementierungen für das Interface, da derzeit nicht vom ZNS-Import benötigt
|
||||
override suspend fun findById(id: Uuid): BundeslandDefinition? = null
|
||||
override suspend fun findByOepsCode(oepsCode: String, landId: Uuid): BundeslandDefinition? = null
|
||||
override suspend fun findByIso3166_2_Code(iso3166_2_Code: String): BundeslandDefinition? = null
|
||||
override suspend fun findByCountry(landId: Uuid, activeOnly: Boolean, orderBySortierung: Boolean): List<BundeslandDefinition> = emptyList()
|
||||
override suspend fun findByName(searchTerm: String, landId: Uuid?, limit: Int): List<BundeslandDefinition> = emptyList()
|
||||
override suspend fun findAllActive(orderBySortierung: Boolean): List<BundeslandDefinition> = emptyList()
|
||||
override suspend fun save(bundesland: BundeslandDefinition): BundeslandDefinition = bundesland
|
||||
override suspend fun upsertByLandIdAndKuerzel(bundesland: BundeslandDefinition): BundeslandDefinition = bundesland
|
||||
override suspend fun delete(id: Uuid): Boolean = false
|
||||
override suspend fun existsByOepsCode(oepsCode: String, landId: Uuid): Boolean = false
|
||||
override suspend fun existsByIso3166_2_Code(iso3166_2_Code: String): Boolean = false
|
||||
override suspend fun countActiveByCountry(landId: Uuid): Long = 0L
|
||||
// Dummy-Implementierungen für das Interface, da derzeit nicht vom ZNS-Import benötigt
|
||||
override suspend fun findById(id: Uuid): BundeslandDefinition? = null
|
||||
override suspend fun findByOepsCode(oepsCode: String, landId: Uuid): BundeslandDefinition? = null
|
||||
override suspend fun findByIso3166_2_Code(iso3166_2_Code: String): BundeslandDefinition? = null
|
||||
override suspend fun findByCountry(
|
||||
landId: Uuid,
|
||||
activeOnly: Boolean,
|
||||
orderBySortierung: Boolean
|
||||
): List<BundeslandDefinition> = emptyList()
|
||||
|
||||
override suspend fun findByName(searchTerm: String, landId: Uuid?, limit: Int): List<BundeslandDefinition> =
|
||||
emptyList()
|
||||
|
||||
override suspend fun findAllActive(orderBySortierung: Boolean): List<BundeslandDefinition> = emptyList()
|
||||
override suspend fun save(bundesland: BundeslandDefinition): BundeslandDefinition = bundesland
|
||||
override suspend fun upsertByLandIdAndKuerzel(bundesland: BundeslandDefinition): BundeslandDefinition = bundesland
|
||||
override suspend fun delete(id: Uuid): Boolean = false
|
||||
override suspend fun existsByOepsCode(oepsCode: String, landId: Uuid): Boolean = false
|
||||
override suspend fun existsByIso3166_2_Code(iso3166_2_Code: String): Boolean = false
|
||||
override suspend fun countActiveByCountry(landId: Uuid): Long = 0L
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class ReiterExposedRepository : ReiterRepository {
|
||||
private fun loadLizenzen(reiterId: Uuid): List<ReiterLizenz> {
|
||||
return ReiterLizenzenZuordnungTable.selectAll().where { ReiterLizenzenZuordnungTable.reiterId eq reiterId }
|
||||
.map {
|
||||
at.mocode.masterdata.domain.model.ReiterLizenz(
|
||||
ReiterLizenz(
|
||||
lizenzId = it[ReiterLizenzenZuordnungTable.id],
|
||||
lizenzTyp = it[ReiterLizenzenZuordnungTable.lizenzTyp],
|
||||
kuerzel = it[ReiterLizenzenZuordnungTable.kuerzel],
|
||||
|
||||
-1
@@ -2,7 +2,6 @@
|
||||
|
||||
package at.mocode.masterdata.infrastructure.persistence.reiter
|
||||
|
||||
import at.mocode.masterdata.infrastructure.persistence.BundeslaenderTable
|
||||
import org.jetbrains.exposed.v1.core.Table
|
||||
import org.jetbrains.exposed.v1.datetime.CurrentTimestamp
|
||||
import org.jetbrains.exposed.v1.datetime.date
|
||||
|
||||
Reference in New Issue
Block a user