einige Ergänzungen
This commit is contained in:
+24
@@ -248,6 +248,30 @@ class HorseRepositoryImpl : HorseRepository {
|
||||
}.count()
|
||||
}
|
||||
|
||||
override suspend fun countOepsRegistered(activeOnly: Boolean): Long = DatabaseFactory.dbQuery {
|
||||
val query = HorseTable.selectAll().where {
|
||||
HorseTable.oepsNummer.isNotNull() and (HorseTable.oepsNummer neq "")
|
||||
}
|
||||
|
||||
if (activeOnly) {
|
||||
query.andWhere { HorseTable.istAktiv eq true }
|
||||
} else {
|
||||
query
|
||||
}.count()
|
||||
}
|
||||
|
||||
override suspend fun countFeiRegistered(activeOnly: Boolean): Long = DatabaseFactory.dbQuery {
|
||||
val query = HorseTable.selectAll().where {
|
||||
HorseTable.feiNummer.isNotNull() and (HorseTable.feiNummer neq "")
|
||||
}
|
||||
|
||||
if (activeOnly) {
|
||||
query.andWhere { HorseTable.istAktiv eq true }
|
||||
} else {
|
||||
query
|
||||
}.count()
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a database row to a DomPferd domain object.
|
||||
*/
|
||||
|
||||
+8
-5
@@ -57,11 +57,14 @@ object HorseTable : UUIDTable("horses") {
|
||||
// Indexes for performance
|
||||
index(false, pferdeName)
|
||||
index(false, besitzerId)
|
||||
index(false, lebensnummer)
|
||||
index(false, chipNummer)
|
||||
index(false, passNummer)
|
||||
index(false, oepsNummer)
|
||||
index(false, feiNummer)
|
||||
index(false, istAktiv)
|
||||
|
||||
// Unique constraints for identification numbers
|
||||
// These ensure database-level uniqueness even under concurrent access
|
||||
uniqueIndex(lebensnummer)
|
||||
uniqueIndex(chipNummer)
|
||||
uniqueIndex(passNummer)
|
||||
uniqueIndex(oepsNummer)
|
||||
uniqueIndex(feiNummer)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user