(fix) Tabellendefinitionen und Modelldefinitionen für Server-Modul
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package at.mocode.model
|
||||
|
||||
import at.mocode.model.domaene.DomLizenz
|
||||
import com.benasher44.uuid.Uuid
|
||||
|
||||
interface DomLizenzRepository {
|
||||
suspend fun findAll(): List<DomLizenz>
|
||||
suspend fun findById(id: Uuid): DomLizenz?
|
||||
suspend fun findByPersonId(personId: Uuid): List<DomLizenz>
|
||||
suspend fun findByLizenzTypGlobalId(lizenzTypGlobalId: Uuid): List<DomLizenz>
|
||||
suspend fun findActiveByPersonId(personId: Uuid): List<DomLizenz>
|
||||
suspend fun findByValidityYear(year: Int): List<DomLizenz>
|
||||
suspend fun create(domLizenz: DomLizenz): DomLizenz
|
||||
suspend fun update(id: Uuid, domLizenz: DomLizenz): DomLizenz?
|
||||
suspend fun delete(id: Uuid): Boolean
|
||||
suspend fun search(query: String): List<DomLizenz>
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package at.mocode.model
|
||||
|
||||
import at.mocode.model.domaene.DomPferd
|
||||
import com.benasher44.uuid.Uuid
|
||||
|
||||
interface DomPferdRepository {
|
||||
suspend fun findAll(): List<DomPferd>
|
||||
suspend fun findById(id: Uuid): DomPferd?
|
||||
suspend fun findByOepsSatzNr(oepsSatzNr: String): DomPferd?
|
||||
suspend fun findByName(name: String): List<DomPferd>
|
||||
suspend fun findByLebensnummer(lebensnummer: String): DomPferd?
|
||||
suspend fun findByBesitzerId(besitzerId: Uuid): List<DomPferd>
|
||||
suspend fun findByVerantwortlichePersonId(personId: Uuid): List<DomPferd>
|
||||
suspend fun findByHeimatVereinId(vereinId: Uuid): List<DomPferd>
|
||||
suspend fun findByRasse(rasse: String): List<DomPferd>
|
||||
suspend fun findByGeburtsjahr(geburtsjahr: Int): List<DomPferd>
|
||||
suspend fun findActiveHorses(): List<DomPferd>
|
||||
suspend fun create(domPferd: DomPferd): DomPferd
|
||||
suspend fun update(id: Uuid, domPferd: DomPferd): DomPferd?
|
||||
suspend fun delete(id: Uuid): Boolean
|
||||
suspend fun search(query: String): List<DomPferd>
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package at.mocode.model
|
||||
|
||||
import at.mocode.model.domaene.DomLizenz
|
||||
import at.mocode.tables.DomLizenzTable
|
||||
import com.benasher44.uuid.Uuid
|
||||
import com.benasher44.uuid.uuidFrom
|
||||
import kotlinx.datetime.Clock
|
||||
import org.jetbrains.exposed.sql.*
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
|
||||
class PostgresDomLizenzRepository : DomLizenzRepository {
|
||||
|
||||
override suspend fun findAll(): List<DomLizenz> = transaction {
|
||||
DomLizenzTable.selectAll().map { rowToDomLizenz(it) }
|
||||
}
|
||||
|
||||
override suspend fun findById(id: Uuid): DomLizenz? = transaction {
|
||||
DomLizenzTable.select { DomLizenzTable.lizenzId eq id }
|
||||
.map { rowToDomLizenz(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
|
||||
override suspend fun findByPersonId(personId: Uuid): List<DomLizenz> = transaction {
|
||||
DomLizenzTable.select { DomLizenzTable.personId eq personId }
|
||||
.map { rowToDomLizenz(it) }
|
||||
}
|
||||
|
||||
override suspend fun findByLizenzTypGlobalId(lizenzTypGlobalId: Uuid): List<DomLizenz> = transaction {
|
||||
DomLizenzTable.select { DomLizenzTable.lizenzTypGlobalId eq lizenzTypGlobalId }
|
||||
.map { rowToDomLizenz(it) }
|
||||
}
|
||||
|
||||
override suspend fun findActiveByPersonId(personId: Uuid): List<DomLizenz> = transaction {
|
||||
DomLizenzTable.select {
|
||||
(DomLizenzTable.personId eq personId) and (DomLizenzTable.istAktivBezahltOeps eq true)
|
||||
}.map { rowToDomLizenz(it) }
|
||||
}
|
||||
|
||||
override suspend fun findByValidityYear(year: Int): List<DomLizenz> = transaction {
|
||||
DomLizenzTable.select { DomLizenzTable.gueltigBisJahr eq year }
|
||||
.map { rowToDomLizenz(it) }
|
||||
}
|
||||
|
||||
override suspend fun create(domLizenz: DomLizenz): DomLizenz = transaction {
|
||||
val now = Clock.System.now()
|
||||
DomLizenzTable.insert {
|
||||
it[lizenzId] = domLizenz.lizenzId
|
||||
it[personId] = domLizenz.personId
|
||||
it[lizenzTypGlobalId] = domLizenz.lizenzTypGlobalId
|
||||
it[gueltigBisJahr] = domLizenz.gueltigBisJahr
|
||||
it[ausgestelltAm] = domLizenz.ausgestelltAm
|
||||
it[istAktivBezahltOeps] = domLizenz.istAktivBezahltOeps
|
||||
it[notiz] = domLizenz.notiz
|
||||
it[createdAt] = domLizenz.createdAt
|
||||
it[updatedAt] = now
|
||||
}
|
||||
domLizenz.copy(updatedAt = now)
|
||||
}
|
||||
|
||||
override suspend fun update(id: Uuid, domLizenz: DomLizenz): DomLizenz? = transaction {
|
||||
val now = Clock.System.now()
|
||||
val updateCount = DomLizenzTable.update({ DomLizenzTable.lizenzId eq id }) {
|
||||
it[personId] = domLizenz.personId
|
||||
it[lizenzTypGlobalId] = domLizenz.lizenzTypGlobalId
|
||||
it[gueltigBisJahr] = domLizenz.gueltigBisJahr
|
||||
it[ausgestelltAm] = domLizenz.ausgestelltAm
|
||||
it[istAktivBezahltOeps] = domLizenz.istAktivBezahltOeps
|
||||
it[notiz] = domLizenz.notiz
|
||||
it[updatedAt] = now
|
||||
}
|
||||
if (updateCount > 0) {
|
||||
domLizenz.copy(lizenzId = id, updatedAt = now)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun delete(id: Uuid): Boolean = transaction {
|
||||
DomLizenzTable.deleteWhere { lizenzId eq id } > 0
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<DomLizenz> = transaction {
|
||||
DomLizenzTable.select {
|
||||
DomLizenzTable.notiz like "%$query%"
|
||||
}.map { rowToDomLizenz(it) }
|
||||
}
|
||||
|
||||
private fun rowToDomLizenz(row: ResultRow): DomLizenz {
|
||||
return DomLizenz(
|
||||
lizenzId = row[DomLizenzTable.lizenzId],
|
||||
personId = row[DomLizenzTable.personId],
|
||||
lizenzTypGlobalId = row[DomLizenzTable.lizenzTypGlobalId],
|
||||
gueltigBisJahr = row[DomLizenzTable.gueltigBisJahr],
|
||||
ausgestelltAm = row[DomLizenzTable.ausgestelltAm],
|
||||
istAktivBezahltOeps = row[DomLizenzTable.istAktivBezahltOeps],
|
||||
notiz = row[DomLizenzTable.notiz],
|
||||
createdAt = row[DomLizenzTable.createdAt],
|
||||
updatedAt = row[DomLizenzTable.updatedAt]
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package at.mocode.model
|
||||
|
||||
import at.mocode.model.domaene.DomPferd
|
||||
import at.mocode.tables.DomPferdTable
|
||||
import com.benasher44.uuid.Uuid
|
||||
import kotlinx.datetime.Clock
|
||||
import org.jetbrains.exposed.sql.*
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.like
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
|
||||
class PostgresDomPferdRepository : DomPferdRepository {
|
||||
|
||||
override suspend fun findAll(): List<DomPferd> = transaction {
|
||||
DomPferdTable.selectAll().map { rowToDomPferd(it) }
|
||||
}
|
||||
|
||||
override suspend fun findById(id: Uuid): DomPferd? = transaction {
|
||||
DomPferdTable.select { DomPferdTable.pferdId eq id }
|
||||
.map { rowToDomPferd(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
|
||||
override suspend fun findByOepsSatzNr(oepsSatzNr: String): DomPferd? = transaction {
|
||||
DomPferdTable.select { DomPferdTable.oepsSatzNrPferd eq oepsSatzNr }
|
||||
.map { rowToDomPferd(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
|
||||
override suspend fun findByName(name: String): List<DomPferd> = transaction {
|
||||
DomPferdTable.select { DomPferdTable.name like "%$name%" }
|
||||
.map { rowToDomPferd(it) }
|
||||
}
|
||||
|
||||
override suspend fun findByLebensnummer(lebensnummer: String): DomPferd? = transaction {
|
||||
DomPferdTable.select { DomPferdTable.lebensnummer eq lebensnummer }
|
||||
.map { rowToDomPferd(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
|
||||
override suspend fun findByBesitzerId(besitzerId: Uuid): List<DomPferd> = transaction {
|
||||
DomPferdTable.select { DomPferdTable.besitzerPersonId eq besitzerId }
|
||||
.map { rowToDomPferd(it) }
|
||||
}
|
||||
|
||||
override suspend fun findByVerantwortlichePersonId(personId: Uuid): List<DomPferd> = transaction {
|
||||
DomPferdTable.select { DomPferdTable.verantwortlichePersonId eq personId }
|
||||
.map { rowToDomPferd(it) }
|
||||
}
|
||||
|
||||
override suspend fun findByHeimatVereinId(vereinId: Uuid): List<DomPferd> = transaction {
|
||||
DomPferdTable.select { DomPferdTable.heimatVereinId eq vereinId }
|
||||
.map { rowToDomPferd(it) }
|
||||
}
|
||||
|
||||
override suspend fun findByRasse(rasse: String): List<DomPferd> = transaction {
|
||||
DomPferdTable.select { DomPferdTable.rasse like "%$rasse%" }
|
||||
.map { rowToDomPferd(it) }
|
||||
}
|
||||
|
||||
override suspend fun findByGeburtsjahr(geburtsjahr: Int): List<DomPferd> = transaction {
|
||||
DomPferdTable.select { DomPferdTable.geburtsjahr eq geburtsjahr }
|
||||
.map { rowToDomPferd(it) }
|
||||
}
|
||||
|
||||
override suspend fun findActiveHorses(): List<DomPferd> = transaction {
|
||||
DomPferdTable.select { DomPferdTable.istAktiv eq true }
|
||||
.map { rowToDomPferd(it) }
|
||||
}
|
||||
|
||||
override suspend fun create(domPferd: DomPferd): DomPferd = transaction {
|
||||
val now = Clock.System.now()
|
||||
DomPferdTable.insert {
|
||||
it[pferdId] = domPferd.pferdId
|
||||
it[oepsSatzNrPferd] = domPferd.oepsSatzNrPferd
|
||||
it[oepsKopfNr] = domPferd.oepsKopfNr
|
||||
it[name] = domPferd.name
|
||||
it[lebensnummer] = domPferd.lebensnummer
|
||||
it[feiPassNr] = domPferd.feiPassNr
|
||||
it[geburtsjahr] = domPferd.geburtsjahr
|
||||
it[geschlecht] = domPferd.geschlecht
|
||||
it[farbe] = domPferd.farbe
|
||||
it[rasse] = domPferd.rasse
|
||||
it[abstammungVaterName] = domPferd.abstammungVaterName
|
||||
it[abstammungMutterName] = domPferd.abstammungMutterName
|
||||
it[abstammungMutterVaterName] = domPferd.abstammungMutterVaterName
|
||||
it[abstammungZusatzInfo] = domPferd.abstammungZusatzInfo
|
||||
it[besitzerPersonId] = domPferd.besitzerPersonId
|
||||
it[verantwortlichePersonId] = domPferd.verantwortlichePersonId
|
||||
it[heimatVereinId] = domPferd.heimatVereinId
|
||||
it[letzteZahlungPferdegebuehrJahrOeps] = domPferd.letzteZahlungPferdegebuehrJahrOeps
|
||||
it[stockmassCm] = domPferd.stockmassCm
|
||||
it[datenQuelle] = domPferd.datenQuelle
|
||||
it[istAktiv] = domPferd.istAktiv
|
||||
it[notizenIntern] = domPferd.notizenIntern
|
||||
it[createdAt] = domPferd.createdAt
|
||||
it[updatedAt] = now
|
||||
}
|
||||
domPferd.copy(updatedAt = now)
|
||||
}
|
||||
|
||||
override suspend fun update(id: Uuid, domPferd: DomPferd): DomPferd? = transaction {
|
||||
val now = Clock.System.now()
|
||||
val updateCount = DomPferdTable.update({ DomPferdTable.pferdId eq id }) {
|
||||
it[oepsSatzNrPferd] = domPferd.oepsSatzNrPferd
|
||||
it[oepsKopfNr] = domPferd.oepsKopfNr
|
||||
it[name] = domPferd.name
|
||||
it[lebensnummer] = domPferd.lebensnummer
|
||||
it[feiPassNr] = domPferd.feiPassNr
|
||||
it[geburtsjahr] = domPferd.geburtsjahr
|
||||
it[geschlecht] = domPferd.geschlecht
|
||||
it[farbe] = domPferd.farbe
|
||||
it[rasse] = domPferd.rasse
|
||||
it[abstammungVaterName] = domPferd.abstammungVaterName
|
||||
it[abstammungMutterName] = domPferd.abstammungMutterName
|
||||
it[abstammungMutterVaterName] = domPferd.abstammungMutterVaterName
|
||||
it[abstammungZusatzInfo] = domPferd.abstammungZusatzInfo
|
||||
it[besitzerPersonId] = domPferd.besitzerPersonId
|
||||
it[verantwortlichePersonId] = domPferd.verantwortlichePersonId
|
||||
it[heimatVereinId] = domPferd.heimatVereinId
|
||||
it[letzteZahlungPferdegebuehrJahrOeps] = domPferd.letzteZahlungPferdegebuehrJahrOeps
|
||||
it[stockmassCm] = domPferd.stockmassCm
|
||||
it[datenQuelle] = domPferd.datenQuelle
|
||||
it[istAktiv] = domPferd.istAktiv
|
||||
it[notizenIntern] = domPferd.notizenIntern
|
||||
it[updatedAt] = now
|
||||
}
|
||||
if (updateCount > 0) {
|
||||
domPferd.copy(pferdId = id, updatedAt = now)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun delete(id: Uuid): Boolean = transaction {
|
||||
DomPferdTable.deleteWhere { pferdId eq id } > 0
|
||||
}
|
||||
|
||||
override suspend fun search(query: String): List<DomPferd> = transaction {
|
||||
DomPferdTable.select {
|
||||
(DomPferdTable.name like "%$query%") or
|
||||
(DomPferdTable.lebensnummer like "%$query%") or
|
||||
(DomPferdTable.rasse like "%$query%") or
|
||||
(DomPferdTable.notizenIntern like "%$query%")
|
||||
}.map { rowToDomPferd(it) }
|
||||
}
|
||||
|
||||
private fun rowToDomPferd(row: ResultRow): DomPferd {
|
||||
return DomPferd(
|
||||
pferdId = row[DomPferdTable.pferdId],
|
||||
oepsSatzNrPferd = row[DomPferdTable.oepsSatzNrPferd],
|
||||
oepsKopfNr = row[DomPferdTable.oepsKopfNr],
|
||||
name = row[DomPferdTable.name],
|
||||
lebensnummer = row[DomPferdTable.lebensnummer],
|
||||
feiPassNr = row[DomPferdTable.feiPassNr],
|
||||
geburtsjahr = row[DomPferdTable.geburtsjahr],
|
||||
geschlecht = row[DomPferdTable.geschlecht],
|
||||
farbe = row[DomPferdTable.farbe],
|
||||
rasse = row[DomPferdTable.rasse],
|
||||
abstammungVaterName = row[DomPferdTable.abstammungVaterName],
|
||||
abstammungMutterName = row[DomPferdTable.abstammungMutterName],
|
||||
abstammungMutterVaterName = row[DomPferdTable.abstammungMutterVaterName],
|
||||
abstammungZusatzInfo = row[DomPferdTable.abstammungZusatzInfo],
|
||||
besitzerPersonId = row[DomPferdTable.besitzerPersonId],
|
||||
verantwortlichePersonId = row[DomPferdTable.verantwortlichePersonId],
|
||||
heimatVereinId = row[DomPferdTable.heimatVereinId],
|
||||
letzteZahlungPferdegebuehrJahrOeps = row[DomPferdTable.letzteZahlungPferdegebuehrJahrOeps],
|
||||
stockmassCm = row[DomPferdTable.stockmassCm],
|
||||
datenQuelle = row[DomPferdTable.datenQuelle],
|
||||
istAktiv = row[DomPferdTable.istAktiv],
|
||||
notizenIntern = row[DomPferdTable.notizenIntern],
|
||||
createdAt = row[DomPferdTable.createdAt],
|
||||
updatedAt = row[DomPferdTable.updatedAt]
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package at.mocode.plugins
|
||||
|
||||
import at.mocode.routes.artikelRoutes
|
||||
import at.mocode.routes.domLizenzRoutes
|
||||
import at.mocode.routes.personRoutes
|
||||
import at.mocode.routes.vereinRoutes
|
||||
import io.ktor.server.application.Application
|
||||
@@ -37,5 +38,6 @@ fun Application.configureRouting() {
|
||||
personRoutes()
|
||||
vereinRoutes()
|
||||
artikelRoutes()
|
||||
domLizenzRoutes()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
package at.mocode.routes
|
||||
|
||||
import at.mocode.model.DomLizenzRepository
|
||||
import at.mocode.model.PostgresDomLizenzRepository
|
||||
import at.mocode.model.domaene.DomLizenz
|
||||
import com.benasher44.uuid.uuidFrom
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.request.*
|
||||
import io.ktor.server.response.*
|
||||
import io.ktor.server.routing.*
|
||||
|
||||
fun Route.domLizenzRoutes() {
|
||||
val domLizenzRepository: DomLizenzRepository = PostgresDomLizenzRepository()
|
||||
|
||||
route("/api/dom-lizenzen") {
|
||||
// GET /api/dom-lizenzen - Get all licenses
|
||||
get {
|
||||
try {
|
||||
val lizenzen = domLizenzRepository.findAll()
|
||||
call.respond(HttpStatusCode.OK, lizenzen)
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
}
|
||||
}
|
||||
|
||||
// GET /api/dom-lizenzen/{id} - Get license by ID
|
||||
get("/{id}") {
|
||||
try {
|
||||
val id = call.parameters["id"] ?: return@get call.respond(
|
||||
HttpStatusCode.BadRequest,
|
||||
mapOf("error" to "Missing license ID")
|
||||
)
|
||||
val uuid = uuidFrom(id)
|
||||
val lizenz = domLizenzRepository.findById(uuid)
|
||||
if (lizenz != null) {
|
||||
call.respond(HttpStatusCode.OK, lizenz)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "License not found"))
|
||||
}
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
}
|
||||
}
|
||||
|
||||
// GET /api/dom-lizenzen/person/{personId} - Get licenses by person ID
|
||||
get("/person/{personId}") {
|
||||
try {
|
||||
val personId = call.parameters["personId"] ?: return@get call.respond(
|
||||
HttpStatusCode.BadRequest,
|
||||
mapOf("error" to "Missing person ID")
|
||||
)
|
||||
val uuid = uuidFrom(personId)
|
||||
val lizenzen = domLizenzRepository.findByPersonId(uuid)
|
||||
call.respond(HttpStatusCode.OK, lizenzen)
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
}
|
||||
}
|
||||
|
||||
// GET /api/dom-lizenzen/person/{personId}/active - Get active licenses by person ID
|
||||
get("/person/{personId}/active") {
|
||||
try {
|
||||
val personId = call.parameters["personId"] ?: return@get call.respond(
|
||||
HttpStatusCode.BadRequest,
|
||||
mapOf("error" to "Missing person ID")
|
||||
)
|
||||
val uuid = uuidFrom(personId)
|
||||
val lizenzen = domLizenzRepository.findActiveByPersonId(uuid)
|
||||
call.respond(HttpStatusCode.OK, lizenzen)
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
}
|
||||
}
|
||||
|
||||
// GET /api/dom-lizenzen/lizenz-typ/{lizenzTypGlobalId} - Get licenses by license type
|
||||
get("/lizenz-typ/{lizenzTypGlobalId}") {
|
||||
try {
|
||||
val lizenzTypGlobalId = call.parameters["lizenzTypGlobalId"] ?: return@get call.respond(
|
||||
HttpStatusCode.BadRequest,
|
||||
mapOf("error" to "Missing license type ID")
|
||||
)
|
||||
val uuid = uuidFrom(lizenzTypGlobalId)
|
||||
val lizenzen = domLizenzRepository.findByLizenzTypGlobalId(uuid)
|
||||
call.respond(HttpStatusCode.OK, lizenzen)
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
}
|
||||
}
|
||||
|
||||
// GET /api/dom-lizenzen/validity-year/{year} - Get licenses by validity year
|
||||
get("/validity-year/{year}") {
|
||||
try {
|
||||
val year = call.parameters["year"]?.toIntOrNull() ?: return@get call.respond(
|
||||
HttpStatusCode.BadRequest,
|
||||
mapOf("error" to "Invalid year format")
|
||||
)
|
||||
val lizenzen = domLizenzRepository.findByValidityYear(year)
|
||||
call.respond(HttpStatusCode.OK, lizenzen)
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
}
|
||||
}
|
||||
|
||||
// GET /api/dom-lizenzen/search?q={query} - Search licenses
|
||||
get("/search") {
|
||||
try {
|
||||
val query = call.request.queryParameters["q"] ?: return@get call.respond(
|
||||
HttpStatusCode.BadRequest,
|
||||
mapOf("error" to "Missing search query parameter 'q'")
|
||||
)
|
||||
val lizenzen = domLizenzRepository.search(query)
|
||||
call.respond(HttpStatusCode.OK, lizenzen)
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
}
|
||||
}
|
||||
|
||||
// POST /api/dom-lizenzen - Create new license
|
||||
post {
|
||||
try {
|
||||
val lizenz = call.receive<DomLizenz>()
|
||||
val createdLizenz = domLizenzRepository.create(lizenz)
|
||||
call.respond(HttpStatusCode.Created, createdLizenz)
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to e.message))
|
||||
}
|
||||
}
|
||||
|
||||
// PUT /api/dom-lizenzen/{id} - Update license
|
||||
put("/{id}") {
|
||||
try {
|
||||
val id = call.parameters["id"] ?: return@put call.respond(
|
||||
HttpStatusCode.BadRequest,
|
||||
mapOf("error" to "Missing license ID")
|
||||
)
|
||||
val uuid = uuidFrom(id)
|
||||
val lizenz = call.receive<DomLizenz>()
|
||||
val updatedLizenz = domLizenzRepository.update(uuid, lizenz)
|
||||
if (updatedLizenz != null) {
|
||||
call.respond(HttpStatusCode.OK, updatedLizenz)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "License not found"))
|
||||
}
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to e.message))
|
||||
}
|
||||
}
|
||||
|
||||
// DELETE /api/dom-lizenzen/{id} - Delete license
|
||||
delete("/{id}") {
|
||||
try {
|
||||
val id = call.parameters["id"] ?: return@delete call.respond(
|
||||
HttpStatusCode.BadRequest,
|
||||
mapOf("error" to "Missing license ID")
|
||||
)
|
||||
val uuid = uuidFrom(id)
|
||||
val deleted = domLizenzRepository.delete(uuid)
|
||||
if (deleted) {
|
||||
call.respond(HttpStatusCode.NoContent)
|
||||
} else {
|
||||
call.respond(HttpStatusCode.NotFound, mapOf("error" to "License not found"))
|
||||
}
|
||||
} catch (_: IllegalArgumentException) {
|
||||
call.respond(HttpStatusCode.BadRequest, mapOf("error" to "Invalid UUID format"))
|
||||
} catch (e: Exception) {
|
||||
call.respond(HttpStatusCode.InternalServerError, mapOf("error" to e.message))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package at.mocode.tables
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.time
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object AbteilungTable : Table("abteilungen") {
|
||||
val id = uuid("id")
|
||||
val bewerbId = uuid("bewerb_id") // FK to Bewerb when implemented
|
||||
val abteilungsKennzeichen = varchar("abteilungs_kennzeichen", 50)
|
||||
val bezeichnungIntern = varchar("bezeichnung_intern", 255).nullable()
|
||||
val bezeichnungAufStartliste = varchar("bezeichnung_auf_startliste", 255).nullable()
|
||||
|
||||
// Teilungskriterien
|
||||
val teilungsKriteriumLizenz = varchar("teilungs_kriterium_lizenz", 255).nullable()
|
||||
val teilungsKriteriumPferdealter = varchar("teilungs_kriterium_pferdealter", 255).nullable()
|
||||
val teilungsKriteriumAltersklasseReiter = varchar("teilungs_kriterium_altersklasse_reiter", 255).nullable()
|
||||
val teilungsKriteriumAnzahlMin = integer("teilungs_kriterium_anzahl_min").nullable()
|
||||
val teilungsKriteriumAnzahlMax = integer("teilungs_kriterium_anzahl_max").nullable()
|
||||
val teilungsKriteriumFreiText = text("teilungs_kriterium_frei_text").nullable()
|
||||
|
||||
// Überschreibungen vom Hauptbewerb
|
||||
val startgeld = decimal("startgeld", 10, 2).nullable()
|
||||
val platzId = uuid("platz_id").nullable() // FK to Platz when implemented
|
||||
val datum = date("datum").nullable()
|
||||
val beginnzeitTypE = varchar("beginnzeit_typ", 50).default("ANSCHLIESSEND")
|
||||
val beginnzeitFix = time("beginnzeit_fix").nullable()
|
||||
val beginnNachAbteilungId = uuid("beginn_nach_abteilung_id").nullable()
|
||||
val beginnzeitCa = time("beginnzeit_ca").nullable()
|
||||
val dauerProStartGeschaetztSek = integer("dauer_pro_start_geschaetzt_sek").nullable()
|
||||
val umbauzeitNachAbteilungMin = integer("umbauzeit_nach_abteilung_min").nullable()
|
||||
val besichtigungszeitVorAbteilungMin = integer("besichtigungszeit_vor_abteilung_min").nullable()
|
||||
val stechzeitZusaetzlichMin = integer("stechzeit_zusaetzlich_min").nullable()
|
||||
|
||||
val anzahlStarter = integer("anzahl_starter").default(0)
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, bewerbId)
|
||||
index(false, platzId)
|
||||
index(false, istAktiv)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package at.mocode.tables
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.time
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object BewerbTable : Table("bewerbe") {
|
||||
val id = uuid("id")
|
||||
val turnierId = uuid("turnier_id").references(TurniereTable.id)
|
||||
|
||||
// Allgemeine Infos
|
||||
val nummer = varchar("nummer", 50)
|
||||
val bezeichnungOffiziell = varchar("bezeichnung_offiziell", 500)
|
||||
val internerName = varchar("interner_name", 255).nullable()
|
||||
val sparteE = varchar("sparte", 50)
|
||||
val klasse = varchar("klasse", 100).nullable()
|
||||
val kategorieOetoDesBewerbs = varchar("kategorie_oeto_des_bewerbs", 255).nullable()
|
||||
val teilnahmebedingungenText = text("teilnahmebedingungen_text").nullable()
|
||||
|
||||
// Detail-Informationen
|
||||
val maxPferdeProReiter = integer("max_pferde_pro_reiter").nullable()
|
||||
val pferdealterAnforderung = varchar("pferdealter_anforderung", 255).nullable()
|
||||
val zusatzTextZeile1 = varchar("zusatz_text_zeile1", 255).nullable()
|
||||
val zusatzTextZeile2 = varchar("zusatz_text_zeile2", 255).nullable()
|
||||
val zusatzTextZeile3 = varchar("zusatz_text_zeile3", 255).nullable()
|
||||
val logoBewerbUrl = varchar("logo_bewerb_url", 500).nullable()
|
||||
val parcoursskizzeUrl = varchar("parcoursskizze_url", 500).nullable()
|
||||
|
||||
// Bewertung & Aufgabe
|
||||
val pruefungsArtDetailName = varchar("pruefungs_art_detail_name", 255).nullable()
|
||||
val pruefungsaufgabeId = uuid("pruefungsaufgabe_id").nullable() // FK to Pruefungsaufgabe when implemented
|
||||
val richtverfahrenId = uuid("richtverfahren_id").nullable() // FK to Richtverfahren when implemented
|
||||
val anzahlRichterGeplant = integer("anzahl_richter_geplant").default(1)
|
||||
val paraGradeAnforderung = varchar("para_grade_anforderung", 255).nullable()
|
||||
val istManuellKalkuliert = bool("ist_manuell_kalkuliert").default(false)
|
||||
|
||||
// Geldpreis/Dotierung
|
||||
val istDotiert = bool("ist_dotiert").default(false)
|
||||
val startgeldStandard = decimal("startgeld_standard", 10, 2).nullable()
|
||||
val startgeldKaderreiter = decimal("startgeld_kaderreiter", 10, 2).nullable()
|
||||
val auszahlungsModusGeldpreis = varchar("auszahlungs_modus_geldpreis", 255).nullable()
|
||||
val hatGeldpreisFuerKaderreiter = bool("hat_geldpreis_fuer_kaderreiter").default(false)
|
||||
val geldpreisVorlageId = uuid("geldpreis_vorlage_id").nullable()
|
||||
|
||||
// Ort/Zeit (Default-Werte)
|
||||
val standardPlatzId = uuid("standard_platz_id").nullable().references(PlaetzeTable.id)
|
||||
val standardDatum = date("standard_datum").nullable()
|
||||
val standardBeginnzeitTypE = varchar("standard_beginnzeit_typ", 50).default("ANSCHLIESSEND")
|
||||
val standardBeginnzeitFix = time("standard_beginnzeit_fix").nullable()
|
||||
val standardBeginnNachBewerbId = uuid("standard_beginn_nach_bewerb_id").nullable()
|
||||
val standardBeginnzeitCa = time("standard_beginnzeit_ca").nullable()
|
||||
val standardDauerProStartGeschaetztSek = integer("standard_dauer_pro_start_geschaetzt_sek").default(120)
|
||||
val standardUmbauzeitNachBewerbMin = integer("standard_umbauzeit_nach_bewerb_min").default(10)
|
||||
val standardBesichtigungszeitVorBewerbMin = integer("standard_besichtigungszeit_vor_bewerb_min").default(10)
|
||||
val standardStechzeitZusaetzlichMin = integer("standard_stechzeit_zusaetzlich_min").default(0)
|
||||
|
||||
// ÖTO/ZNS Spezifika
|
||||
val oepsBewerbsartCodeZns = varchar("oeps_bewerbsart_code_zns", 100).nullable()
|
||||
val oepsAltersklasseCodeZns = varchar("oeps_altersklasse_code_zns", 100).nullable()
|
||||
val oepsPferderassenCodeZns = varchar("oeps_pferderassen_code_zns", 100).nullable()
|
||||
|
||||
// Steuerung
|
||||
val notizenIntern = text("notizen_intern").nullable()
|
||||
val istStartlisteFinal = bool("ist_startliste_final").default(false)
|
||||
val istErgebnislisteFinal = bool("ist_ergebnisliste_final").default(false)
|
||||
val erfordertAbteilungsAuswahlFuerNennung = bool("erfordert_abteilungs_auswahl_fuer_nennung").default(true)
|
||||
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, turnierId)
|
||||
index(false, nummer)
|
||||
index(false, sparteE)
|
||||
index(false, standardPlatzId)
|
||||
index(false, istStartlisteFinal)
|
||||
index(false, istErgebnislisteFinal)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package at.mocode.tables
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
|
||||
object DotierungsAbstufungTable : Table("dotierungs_abstufungen") {
|
||||
val id = uuid("id")
|
||||
val platz = integer("platz")
|
||||
val betrag = decimal("betrag", 10, 2)
|
||||
val beschreibung = varchar("beschreibung", 255).nullable()
|
||||
|
||||
// Foreign key to link to Bewerb or Abteilung
|
||||
val bewerbId = uuid("bewerb_id").nullable() // FK to Bewerb when implemented
|
||||
val abteilungId = uuid("abteilung_id").nullable() // FK to Abteilung when implemented
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, platz)
|
||||
index(false, bewerbId)
|
||||
index(false, abteilungId)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package at.mocode.tables
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
|
||||
object MeisterschaftReferenzTable : Table("meisterschaft_referenzen") {
|
||||
val id = uuid("id")
|
||||
val meisterschaftId = uuid("meisterschaft_id") // FK to Meisterschaft when implemented
|
||||
val name = varchar("name", 255)
|
||||
val betrifftBewerbNummern = text("betrifft_bewerb_nummern") // JSON array as text
|
||||
val berechnungsstrategie = varchar("berechnungsstrategie", 255).nullable()
|
||||
val reglementUrl = varchar("reglement_url", 500).nullable()
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, meisterschaftId)
|
||||
index(false, name)
|
||||
}
|
||||
}
|
||||
|
||||
object CupReferenzTable : Table("cup_referenzen") {
|
||||
val id = uuid("id")
|
||||
val cupId = uuid("cup_id") // FK to Cup when implemented
|
||||
val name = varchar("name", 255)
|
||||
val betrifftBewerbNummern = text("betrifft_bewerb_nummern") // JSON array as text
|
||||
val berechnungsstrategie = varchar("berechnungsstrategie", 255).nullable()
|
||||
val reglementUrl = varchar("reglement_url", 500).nullable()
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, cupId)
|
||||
index(false, name)
|
||||
}
|
||||
}
|
||||
|
||||
object SonderpruefungReferenzTable : Table("sonderpruefung_referenzen") {
|
||||
val id = uuid("id")
|
||||
val cupId = uuid("cup_id") // FK to Cup when implemented
|
||||
val name = varchar("name", 255)
|
||||
val betrifftBewerbNummern = text("betrifft_bewerb_nummern") // JSON array as text
|
||||
val berechnungsstrategie = varchar("berechnungsstrategie", 255).nullable()
|
||||
val reglementUrl = varchar("reglement_url", 500).nullable()
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, cupId)
|
||||
index(false, name)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package at.mocode.tables
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object PruefungsaufgabeTable : Table("pruefungsaufgaben") {
|
||||
val id = uuid("id")
|
||||
val kuerzel = varchar("kuerzel", 100)
|
||||
val nameLang = varchar("name_lang", 500)
|
||||
val kategorieText = varchar("kategorie_text", 255).nullable()
|
||||
val sparteE = varchar("sparte", 50)
|
||||
val nation = varchar("nation", 50).default("NATIONAL")
|
||||
val richtverfahrenModusDefault = varchar("richtverfahren_modus_default", 50).nullable()
|
||||
val viereckGroesseDefault = varchar("viereck_groesse_default", 50).nullable()
|
||||
val schwierigkeitsgradText = varchar("schwierigkeitsgrad_text", 100).nullable()
|
||||
val aufgabenNummerInSammlung = varchar("aufgaben_nummer_in_sammlung", 100).nullable()
|
||||
val jahrgangVersion = varchar("jahrgang_version", 100).nullable()
|
||||
val pdfUrlExtern = varchar("pdf_url_extern", 500).nullable()
|
||||
val pdfDateinameIntern = varchar("pdf_dateiname_intern", 255).nullable()
|
||||
val anmerkungen = text("anmerkungen").nullable()
|
||||
val dauerGeschaetztMinuten = double("dauer_geschaetzt_minuten").nullable()
|
||||
val anzahlMaxPunkteProRichter = double("anzahl_max_punkte_pro_richter").nullable()
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, kuerzel)
|
||||
index(false, sparteE)
|
||||
index(false, nation)
|
||||
index(false, istAktiv)
|
||||
index(false, schwierigkeitsgradText)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package at.mocode.tables
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object RichtverfahrenTable : Table("richtverfahren") {
|
||||
val id = uuid("id")
|
||||
val code = varchar("code", 100)
|
||||
val bezeichnung = varchar("bezeichnung", 500)
|
||||
val sparteE = varchar("sparte", 50)
|
||||
val basisRegelnBeschreibungKurz = text("basis_regeln_beschreibung_kurz").nullable()
|
||||
val oetoParagraphVerweis = varchar("oeto_paragraph_verweis", 255).nullable()
|
||||
val hatStechen = bool("hat_stechen").default(false)
|
||||
val artDesStechens = varchar("art_des_stechens", 255).nullable()
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, code)
|
||||
index(false, sparteE)
|
||||
index(false, istAktiv)
|
||||
index(false, hatStechen)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package at.mocode.tables.domaene
|
||||
|
||||
import at.mocode.tables.PersonenTable
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object DomLizenzTable : Table("dom_lizenzen") {
|
||||
val lizenzId = uuid("lizenz_id")
|
||||
val personId = uuid("person_id").references(PersonenTable.id)
|
||||
val lizenzTypGlobalId = uuid("lizenz_typ_global_id") // FK to LizenzTypGlobal when implemented
|
||||
val gueltigBisJahr = integer("gueltig_bis_jahr").nullable()
|
||||
val ausgestelltAm = date("ausgestellt_am").nullable()
|
||||
val istAktivBezahltOeps = bool("ist_aktiv_bezahlt_oeps").default(false)
|
||||
val notiz = text("notiz").nullable()
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(lizenzId)
|
||||
|
||||
init {
|
||||
index(false, personId)
|
||||
index(false, lizenzTypGlobalId)
|
||||
index(false, gueltigBisJahr)
|
||||
index(false, istAktivBezahltOeps)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package at.mocode.tables.domaene
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object DomPersonTable : Table("dom_personen") {
|
||||
val personId = uuid("person_id")
|
||||
val oepsSatzNr = varchar("oeps_satz_nr", 10).nullable().uniqueIndex()
|
||||
val nachname = varchar("nachname", 255)
|
||||
val vorname = varchar("vorname", 255)
|
||||
val titel = varchar("titel", 100).nullable()
|
||||
val geburtsdatum = date("geburtsdatum").nullable()
|
||||
val geschlechtE = varchar("geschlecht", 20).nullable()
|
||||
val nationalitaetLandId = uuid("nationalitaet_land_id").nullable() // FK to LandDefinition when implemented
|
||||
val feiId = varchar("fei_id", 50).nullable()
|
||||
val telefon = varchar("telefon", 50).nullable()
|
||||
val email = varchar("email", 255).nullable()
|
||||
|
||||
// Adresse
|
||||
val strasse = varchar("strasse", 255).nullable()
|
||||
val plz = varchar("plz", 20).nullable()
|
||||
val ort = varchar("ort", 255).nullable()
|
||||
val adresszusatzZusatzinfo = varchar("adresszusatz_zusatzinfo", 255).nullable()
|
||||
|
||||
val stammVereinId = uuid("stamm_verein_id").nullable() // FK to DomVerein when implemented
|
||||
val mitgliedsNummerBeiStammVerein = varchar("mitglieds_nummer_bei_stamm_verein", 50).nullable()
|
||||
|
||||
val istGesperrt = bool("ist_gesperrt").default(false)
|
||||
val sperrGrund = varchar("sperr_grund", 500).nullable()
|
||||
|
||||
val altersklasseOepsCodeRaw = varchar("altersklasse_oeps_code_raw", 10).nullable()
|
||||
val istJungerReiterOepsFlag = bool("ist_junger_reiter_oeps_flag").default(false)
|
||||
val kaderStatusOepsRaw = varchar("kader_status_oeps_raw", 10).nullable()
|
||||
|
||||
val datenQuelle = varchar("daten_quelle", 50).default("MANUELL")
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val notizenIntern = text("notizen_intern").nullable()
|
||||
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(personId)
|
||||
|
||||
init {
|
||||
index(false, nachname)
|
||||
index(false, vorname)
|
||||
index(false, oepsSatzNr)
|
||||
index(false, feiId)
|
||||
index(false, stammVereinId)
|
||||
index(false, istGesperrt)
|
||||
index(false, istAktiv)
|
||||
index(false, datenQuelle)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package at.mocode.tables.domaene
|
||||
|
||||
import at.mocode.enums.DatenQuelleE
|
||||
import at.mocode.enums.PferdeGeschlechtE
|
||||
import at.mocode.tables.PersonenTable
|
||||
import at.mocode.tables.VereineTable
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object DomPferdTable : Table("dom_pferde") {
|
||||
val pferdId = uuid("pferd_id")
|
||||
val oepsSatzNrPferd = varchar("oeps_satz_nr_pferd", 15).uniqueIndex().nullable()
|
||||
val oepsKopfNr = varchar("oeps_kopf_nr", 10).nullable()
|
||||
val name = varchar("name", 255)
|
||||
val lebensnummer = varchar("lebensnummer", 20).nullable()
|
||||
val feiPassNr = varchar("fei_pass_nr", 20).nullable()
|
||||
val geburtsjahr = integer("geburtsjahr").nullable()
|
||||
val geschlecht = enumerationByName("geschlecht", 20, PferdeGeschlechtE::class).nullable()
|
||||
val farbe = varchar("farbe", 50).nullable()
|
||||
val rasse = varchar("rasse", 100).nullable()
|
||||
val abstammungVaterName = varchar("abstammung_vater_name", 255).nullable()
|
||||
val abstammungMutterName = varchar("abstammung_mutter_name", 255).nullable()
|
||||
val abstammungMutterVaterName = varchar("abstammung_mutter_vater_name", 255).nullable()
|
||||
val abstammungZusatzInfo = text("abstammung_zusatz_info").nullable()
|
||||
val besitzerPersonId = uuid("besitzer_person_id").references(PersonenTable.id).nullable()
|
||||
val verantwortlichePersonId = uuid("verantwortliche_person_id").references(PersonenTable.id).nullable()
|
||||
val heimatVereinId = uuid("heimat_verein_id").references(VereineTable.id).nullable()
|
||||
val letzteZahlungPferdegebuehrJahrOeps = integer("letzte_zahlung_pferdegebuehr_jahr_oeps").nullable()
|
||||
val stockmassCm = integer("stockmass_cm").nullable()
|
||||
val datenQuelle = enumerationByName("daten_quelle", 20, DatenQuelleE::class).default(DatenQuelleE.MANUELL)
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val notizenIntern = text("notizen_intern").nullable()
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(pferdId)
|
||||
|
||||
init {
|
||||
index(false, name)
|
||||
index(false, oepsSatzNrPferd)
|
||||
index(false, lebensnummer)
|
||||
index(false, besitzerPersonId)
|
||||
index(false, verantwortlichePersonId)
|
||||
index(false, heimatVereinId)
|
||||
index(false, rasse)
|
||||
index(false, geburtsjahr)
|
||||
index(false, istAktiv)
|
||||
index(false, datenQuelle)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package at.mocode.tables.domaene
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object DomQualifikationTable : Table("dom_qualifikationen") {
|
||||
val qualifikationId = uuid("qualifikation_id")
|
||||
val personId = uuid("person_id") // FK to DomPerson when implemented
|
||||
val qualTypId = uuid("qual_typ_id") // FK to QualifikationsTyp when implemented
|
||||
val bemerkung = text("bemerkung").nullable()
|
||||
val gueltigVon = date("gueltig_von").nullable()
|
||||
val gueltigBis = date("gueltig_bis").nullable()
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(qualifikationId)
|
||||
|
||||
init {
|
||||
index(false, personId)
|
||||
index(false, qualTypId)
|
||||
index(false, istAktiv)
|
||||
index(false, gueltigVon)
|
||||
index(false, gueltigBis)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package at.mocode.tables.domaene
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object DomVereinTable : Table("dom_vereine") {
|
||||
val vereinId = uuid("verein_id")
|
||||
val oepsVereinsNr = varchar("oeps_vereins_nr", 10).nullable().uniqueIndex()
|
||||
val name = varchar("name", 255)
|
||||
val kuerzel = varchar("kuerzel", 50).nullable()
|
||||
|
||||
val adresseStrasse = varchar("adresse_strasse", 255).nullable()
|
||||
val plz = varchar("plz", 20).nullable()
|
||||
val ort = varchar("ort", 255).nullable()
|
||||
|
||||
val bundeslandId = uuid("bundesland_id").nullable() // FK to BundeslandDefinition when implemented
|
||||
val landId = uuid("land_id") // FK to LandDefinition when implemented
|
||||
|
||||
val emailAllgemein = varchar("email_allgemein", 255).nullable()
|
||||
val telefonAllgemein = varchar("telefon_allgemein", 50).nullable()
|
||||
val webseiteUrl = varchar("webseite_url", 500).nullable()
|
||||
|
||||
val datenQuelle = varchar("daten_quelle", 50).default("OEPS_ZNS")
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val notizenIntern = text("notizen_intern").nullable()
|
||||
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(vereinId)
|
||||
|
||||
init {
|
||||
index(false, name)
|
||||
index(false, oepsVereinsNr)
|
||||
index(false, bundeslandId)
|
||||
index(false, landId)
|
||||
index(false, istAktiv)
|
||||
index(false, datenQuelle)
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package at.mocode.tables.oeto_verwaltung
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object AltersklasseDefinitionTable : Table("altersklasse_definitionen") {
|
||||
val altersklasseId = uuid("altersklasse_id")
|
||||
val altersklasseCode = varchar("altersklasse_code", 50).uniqueIndex()
|
||||
val bezeichnung = varchar("bezeichnung", 255)
|
||||
val minAlter = integer("min_alter").nullable()
|
||||
val maxAlter = integer("max_alter").nullable()
|
||||
val stichtagRegelText = varchar("stichtag_regel_text", 500).default("31.12. des laufenden Kalenderjahres")
|
||||
val sparteFilter = varchar("sparte_filter", 50).nullable()
|
||||
val geschlechtFilter = char("geschlecht_filter").nullable()
|
||||
val oetoRegelReferenzId = uuid("oeto_regel_referenz_id").nullable() // FK to OETORegelReferenz when implemented
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(altersklasseId)
|
||||
|
||||
init {
|
||||
index(false, altersklasseCode)
|
||||
index(false, sparteFilter)
|
||||
index(false, geschlechtFilter)
|
||||
index(false, istAktiv)
|
||||
index(false, minAlter)
|
||||
index(false, maxAlter)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package at.mocode.tables.oeto_verwaltung
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object LizenzTypGlobalTable : Table("lizenz_typ_global") {
|
||||
val lizenzTypGlobalId = uuid("lizenz_typ_global_id")
|
||||
val lizenzTypCode = varchar("lizenz_typ_code", 50).uniqueIndex()
|
||||
val bezeichnung = varchar("bezeichnung", 255)
|
||||
val lizenzKategorieE = varchar("lizenz_kategorie", 50)
|
||||
val lizenzTypE = varchar("lizenz_typ", 50)
|
||||
val sparteE = varchar("sparte", 50).nullable()
|
||||
val beschreibung = text("beschreibung").nullable()
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(lizenzTypGlobalId)
|
||||
|
||||
init {
|
||||
index(false, lizenzTypCode)
|
||||
index(false, lizenzKategorieE)
|
||||
index(false, lizenzTypE)
|
||||
index(false, sparteE)
|
||||
index(false, istAktiv)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package at.mocode.tables.oeto_verwaltung
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
// OETO Administration models tables
|
||||
object OETORegelReferenzTable : Table("oeto_regel_referenzen") {
|
||||
val oetoRegelReferenzId = uuid("oeto_regel_referenz_id")
|
||||
val regelCode = varchar("regel_code", 50).uniqueIndex()
|
||||
val paragraphNummer = varchar("paragraph_nummer", 20).nullable()
|
||||
val titel = varchar("titel", 255)
|
||||
val beschreibung = text("beschreibung").nullable()
|
||||
val regelwerkVersion = varchar("regelwerk_version", 50).nullable()
|
||||
val gueltigVon = timestamp("gueltig_von").nullable()
|
||||
val gueltigBis = timestamp("gueltig_bis").nullable()
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(oetoRegelReferenzId)
|
||||
|
||||
init {
|
||||
index(false, regelCode)
|
||||
index(false, paragraphNummer)
|
||||
index(false, istAktiv)
|
||||
}
|
||||
}
|
||||
|
||||
object QualifikationsTypTable : Table("qualifikations_typen") {
|
||||
val qualTypId = uuid("qual_typ_id")
|
||||
val qualTypCode = varchar("qual_typ_code", 50).uniqueIndex()
|
||||
val bezeichnung = varchar("bezeichnung", 255)
|
||||
val kategorie = varchar("kategorie", 100).nullable()
|
||||
val sparteE = varchar("sparte", 50).nullable()
|
||||
val beschreibung = text("beschreibung").nullable()
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(qualTypId)
|
||||
|
||||
init {
|
||||
index(false, qualTypCode)
|
||||
index(false, kategorie)
|
||||
index(false, sparteE)
|
||||
index(false, istAktiv)
|
||||
}
|
||||
}
|
||||
|
||||
object SportlicheStammdatenTable : Table("sportliche_stammdaten") {
|
||||
val id = uuid("id")
|
||||
val stammdatenTyp = varchar("stammdaten_typ", 100)
|
||||
val code = varchar("code", 50)
|
||||
val bezeichnung = varchar("bezeichnung", 255)
|
||||
val sparteE = varchar("sparte", 50).nullable()
|
||||
val kategorie = varchar("kategorie", 100).nullable()
|
||||
val beschreibung = text("beschreibung").nullable()
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, stammdatenTyp)
|
||||
index(false, code)
|
||||
index(false, sparteE)
|
||||
index(false, kategorie)
|
||||
index(false, istAktiv)
|
||||
}
|
||||
}
|
||||
|
||||
// Additional missing tables for stammdaten models
|
||||
object LizenzInfoTable : Table("lizenz_infos") {
|
||||
val id = uuid("id")
|
||||
val personId = uuid("person_id") // FK to Person when implemented
|
||||
val lizenzTyp = varchar("lizenz_typ", 100)
|
||||
val lizenzNummer = varchar("lizenz_nummer", 50).nullable()
|
||||
val ausstellungsdatum = timestamp("ausstellungsdatum").nullable()
|
||||
val gueltigBis = timestamp("gueltig_bis").nullable()
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, personId)
|
||||
index(false, lizenzTyp)
|
||||
index(false, lizenzNummer)
|
||||
index(false, istAktiv)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package at.mocode.tables.stammdaten
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
object BundeslandDefinitionTable : Table("bundesland_definitionen") {
|
||||
val bundeslandId = uuid("bundesland_id")
|
||||
val bundeslandCode = varchar("bundesland_code", 10).uniqueIndex()
|
||||
val name = varchar("name", 255)
|
||||
val kuerzel = varchar("kuerzel", 10).nullable()
|
||||
val landId = uuid("land_id") // FK to LandDefinition when implemented
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(bundeslandId)
|
||||
|
||||
init {
|
||||
index(false, bundeslandCode)
|
||||
index(false, name)
|
||||
index(false, landId)
|
||||
index(false, istAktiv)
|
||||
}
|
||||
}
|
||||
|
||||
object LandDefinitionTable : Table("land_definitionen") {
|
||||
val landId = uuid("land_id")
|
||||
val landCode = varchar("land_code", 10).uniqueIndex()
|
||||
val name = varchar("name", 255)
|
||||
val nameEnglisch = varchar("name_englisch", 255).nullable()
|
||||
val iso2Code = varchar("iso2_code", 2).nullable()
|
||||
val iso3Code = varchar("iso3_code", 3).nullable()
|
||||
val istEuMitglied = bool("ist_eu_mitglied").default(false)
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(landId)
|
||||
|
||||
init {
|
||||
index(false, landCode)
|
||||
index(false, name)
|
||||
index(false, iso2Code)
|
||||
index(false, iso3Code)
|
||||
index(false, istEuMitglied)
|
||||
index(false, istAktiv)
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
package at.mocode.tables
|
||||
|
||||
package at.mocode.tables.stammdaten
|
||||
|
||||
import at.mocode.enums.LizenzTypE
|
||||
import at.mocode.enums.SparteE
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package at.mocode.tables
|
||||
package at.mocode.tables.stammdaten
|
||||
|
||||
import at.mocode.enums.GeschlechtE
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package at.mocode.tables
|
||||
package at.mocode.tables.stammdaten
|
||||
|
||||
import at.mocode.enums.GeschlechtPferdE
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package at.mocode.tables
|
||||
package at.mocode.tables.stammdaten
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
@@ -0,0 +1,103 @@
|
||||
package at.mocode.tables.veranstaltung
|
||||
|
||||
import at.mocode.tables.AbteilungTable
|
||||
import at.mocode.tables.PlaetzeTable
|
||||
import at.mocode.tables.TurniereTable
|
||||
import at.mocode.tables.VeranstaltungenTable
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.time
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
// Event models tables
|
||||
object PruefungAbteilungTable : Table("pruefung_abteilungen") {
|
||||
val id = uuid("id")
|
||||
val pruefungId = uuid("pruefung_id") // FK to Pruefung when implemented
|
||||
val abteilungId = uuid("abteilung_id").references(AbteilungTable.id)
|
||||
val reihenfolge = integer("reihenfolge").default(1)
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, pruefungId)
|
||||
index(false, abteilungId)
|
||||
index(false, reihenfolge)
|
||||
}
|
||||
}
|
||||
|
||||
object PruefungOEPSTable : Table("pruefung_oeps") {
|
||||
val id = uuid("id")
|
||||
val pruefungId = uuid("pruefung_id") // FK to Pruefung when implemented
|
||||
val oepsCode = varchar("oeps_code", 50)
|
||||
val oepsBezeichnung = varchar("oeps_bezeichnung", 255)
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, pruefungId)
|
||||
index(false, oepsCode)
|
||||
}
|
||||
}
|
||||
|
||||
object TurnierHatPlatzTable : Table("turnier_hat_platz") {
|
||||
val id = uuid("id")
|
||||
val turnierId = uuid("turnier_id").references(TurniereTable.id)
|
||||
val platzId = uuid("platz_id").references(PlaetzeTable.id)
|
||||
val istHauptplatz = bool("ist_hauptplatz").default(false)
|
||||
val verfuegbarVon = date("verfuegbar_von").nullable()
|
||||
val verfuegbarBis = date("verfuegbar_bis").nullable()
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, turnierId)
|
||||
index(false, platzId)
|
||||
index(false, istHauptplatz)
|
||||
}
|
||||
}
|
||||
|
||||
object TurnierOEPSTable : Table("turnier_oeps") {
|
||||
val id = uuid("id")
|
||||
val turnierId = uuid("turnier_id").references(TurniereTable.id)
|
||||
val oepsTurnierNr = varchar("oeps_turnier_nr", 50)
|
||||
val oepsKategorie = varchar("oeps_kategorie", 100)
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, turnierId)
|
||||
index(false, oepsTurnierNr)
|
||||
index(false, oepsKategorie)
|
||||
}
|
||||
}
|
||||
|
||||
object VeranstaltungsRahmenTable : Table("veranstaltungs_rahmen") {
|
||||
val id = uuid("id")
|
||||
val veranstaltungId = uuid("veranstaltung_id").references(VeranstaltungenTable.id)
|
||||
val rahmenTyp = varchar("rahmen_typ", 100)
|
||||
val bezeichnung = varchar("bezeichnung", 255)
|
||||
val beschreibung = text("beschreibung").nullable()
|
||||
val reihenfolge = integer("reihenfolge").default(1)
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, veranstaltungId)
|
||||
index(false, rahmenTyp)
|
||||
index(false, reihenfolge)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package at.mocode.tables.veranstaltung.cup
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.date
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
// Cup/Series models tables
|
||||
object MCSWertungspruefungTable : Table("mcs_wertungspruefungen") {
|
||||
val id = uuid("id")
|
||||
val meisterschaftCupSerieId = uuid("meisterschaft_cup_serie_id") // FK to Meisterschaft_Cup_Serie
|
||||
val bewerbId = uuid("bewerb_id") // FK to Bewerb when implemented
|
||||
val gewichtungsFaktor = double("gewichtungs_faktor").default(1.0)
|
||||
val mindestTeilnehmerAnzahl = integer("mindest_teilnehmer_anzahl").nullable()
|
||||
val istPflichtpruefung = bool("ist_pflichtpruefung").default(false)
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, meisterschaftCupSerieId)
|
||||
index(false, bewerbId)
|
||||
index(false, istPflichtpruefung)
|
||||
index(false, istAktiv)
|
||||
}
|
||||
}
|
||||
|
||||
object MeisterschaftCupSerieTable : Table("meisterschaft_cup_serien") {
|
||||
val id = uuid("id")
|
||||
val name = varchar("name", 255)
|
||||
val kuerzel = varchar("kuerzel", 50).nullable()
|
||||
val cupSerieTypE = varchar("cup_serie_typ", 50)
|
||||
val saison = varchar("saison", 20) // e.g., "2024", "2024/25"
|
||||
val sparteE = varchar("sparte", 50)
|
||||
val beschreibung = text("beschreibung").nullable()
|
||||
val reglementUrl = varchar("reglement_url", 500).nullable()
|
||||
val anmeldeschluss = date("anmeldeschluss").nullable()
|
||||
val istAktiv = bool("ist_aktiv").default(true)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, name)
|
||||
index(false, cupSerieTypE)
|
||||
index(false, saison)
|
||||
index(false, sparteE)
|
||||
index(false, istAktiv)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package at.mocode.tables.veranstaltung.spezifika
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
// Spezifika models tables
|
||||
object DressurPruefungSpezifikaTable : Table("dressur_pruefung_spezifika") {
|
||||
val id = uuid("id")
|
||||
val bewerbId = uuid("bewerb_id") // FK to Bewerb when implemented
|
||||
val pruefungsaufgabeId = uuid("pruefungsaufgabe_id") // FK to Pruefungsaufgabe when implemented
|
||||
val viereckGroesse = varchar("viereck_groesse", 50).nullable()
|
||||
val richtverfahrenModus = varchar("richtverfahren_modus", 50).nullable()
|
||||
val anzahlRichter = integer("anzahl_richter").default(1)
|
||||
val maxPunkteProRichter = double("max_punkte_pro_richter").nullable()
|
||||
val istKuerPruefung = bool("ist_kuer_pruefung").default(false)
|
||||
val musikErlaubt = bool("musik_erlaubt").default(false)
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, bewerbId)
|
||||
index(false, pruefungsaufgabeId)
|
||||
index(false, istKuerPruefung)
|
||||
}
|
||||
}
|
||||
|
||||
object SpringPruefungSpezifikaTable : Table("spring_pruefung_spezifika") {
|
||||
val id = uuid("id")
|
||||
val bewerbId = uuid("bewerb_id") // FK to Bewerb when implemented
|
||||
val hoehe = integer("hoehe").nullable() // in cm
|
||||
val anzahlHindernisse = integer("anzahl_hindernisse").nullable()
|
||||
val parcourslange = integer("parcourslange").nullable() // in Metern
|
||||
val erlaubteZeit = integer("erlaubte_zeit").nullable() // in Sekunden
|
||||
val hatStechen = bool("hat_stechen").default(false)
|
||||
val stechhoehe = integer("stechhoehe").nullable() // in cm
|
||||
val artDesStechens = varchar("art_des_stechens", 100).nullable()
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, bewerbId)
|
||||
index(false, hoehe)
|
||||
index(false, hatStechen)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package at.mocode.tables.zns_staging
|
||||
|
||||
import org.jetbrains.exposed.sql.Table
|
||||
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp
|
||||
|
||||
// ZNS Staging models tables
|
||||
object PersonZNSStagingTable : Table("person_zns_staging") {
|
||||
val id = uuid("id")
|
||||
val oepsSatzNrPerson = varchar("oeps_satz_nr_person", 10).nullable()
|
||||
val familiennameRoh = varchar("familienname_roh", 255)
|
||||
val vornameRoh = varchar("vorname_roh", 255)
|
||||
val geburtsdatumTextRoh = varchar("geburtsdatum_text_roh", 20).nullable()
|
||||
val geschlechtCodeRoh = varchar("geschlecht_code_roh", 5).nullable()
|
||||
val nationalitaetCodeRoh = varchar("nationalitaet_code_roh", 10).nullable()
|
||||
val feiIdPersonRoh = varchar("fei_id_person_roh", 50).nullable()
|
||||
val telefonRoh = varchar("telefon_roh", 50).nullable()
|
||||
val vereinsnameOepsRoh = varchar("vereinsname_oeps_roh", 255).nullable()
|
||||
val bundeslandCodeOepsRoh = varchar("bundesland_code_oeps_roh", 10).nullable()
|
||||
val mitgliedNrVereinRoh = varchar("mitglied_nr_verein_roh", 50).nullable()
|
||||
val sperrlisteFlagOepsRoh = varchar("sperrliste_flag_oeps_roh", 5).nullable()
|
||||
val qualifikationenRawOepsRoh = text("qualifikationen_raw_oeps_roh").nullable()
|
||||
val istVerarbeitet = bool("ist_verarbeitet").default(false)
|
||||
val verarbeitungsFehler = text("verarbeitungs_fehler").nullable()
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, oepsSatzNrPerson)
|
||||
index(false, istVerarbeitet)
|
||||
index(false, familiennameRoh)
|
||||
index(false, vornameRoh)
|
||||
}
|
||||
}
|
||||
|
||||
object PferdZNSStagingTable : Table("pferd_zns_staging") {
|
||||
val id = uuid("id")
|
||||
val oepsSatzNrPferd = varchar("oeps_satz_nr_pferd", 10).nullable()
|
||||
val pferdnameRoh = varchar("pferdname_roh", 255)
|
||||
val geburtsdatumTextRoh = varchar("geburtsdatum_text_roh", 20).nullable()
|
||||
val geschlechtCodeRoh = varchar("geschlecht_code_roh", 5).nullable()
|
||||
val rasseCodeRoh = varchar("rasse_code_roh", 10).nullable()
|
||||
val feiIdPferdRoh = varchar("fei_id_pferd_roh", 50).nullable()
|
||||
val besitzerNameRoh = varchar("besitzer_name_roh", 255).nullable()
|
||||
val istVerarbeitet = bool("ist_verarbeitet").default(false)
|
||||
val verarbeitungsFehler = text("verarbeitungs_fehler").nullable()
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, oepsSatzNrPferd)
|
||||
index(false, istVerarbeitet)
|
||||
index(false, pferdnameRoh)
|
||||
}
|
||||
}
|
||||
|
||||
object VereinZNSStagingTable : Table("verein_zns_staging") {
|
||||
val id = uuid("id")
|
||||
val oepsVereinsNr = varchar("oeps_vereins_nr", 10).nullable()
|
||||
val vereinsnameRoh = varchar("vereinsname_roh", 255)
|
||||
val bundeslandCodeRoh = varchar("bundesland_code_roh", 10).nullable()
|
||||
val istVerarbeitet = bool("ist_verarbeitet").default(false)
|
||||
val verarbeitungsFehler = text("verarbeitungs_fehler").nullable()
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
init {
|
||||
index(false, oepsVereinsNr)
|
||||
index(false, istVerarbeitet)
|
||||
index(false, vereinsnameRoh)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user