feat(masterdata): add controllers, services, and repositories for Reiter, Horse, and Verein domains

- Introduced entities `ReiterController`, `HorseController`, and `VereinController`, with associated REST routes.
- Implemented upsert functionality for `Reiter`, `Horse`, and `Verein` repositories.
- Added services for `Altersklasse` calculations and integrated them into the domain layer.
- Updated database schema to include `ReiterTable`, `HorseTable`, `VereinTable`, and `FunktionaerTable`.
- Refactored `masterdataApiModule` to register new domain controllers.
- Adjusted Ktor server and Spring configurations to support new domains.

Signed-off-by: Stefan Mogeritsch <stefan.mo.co@gmail.com>
This commit is contained in:
2026-03-30 13:16:55 +02:00
parent c576bbd6af
commit 0c870ba2e3
15 changed files with 533 additions and 33 deletions
@@ -1,16 +1,10 @@
package at.mocode.masterdata.service.config
import at.mocode.masterdata.api.masterdataApiModule
import at.mocode.masterdata.api.rest.AltersklasseController
import at.mocode.masterdata.api.rest.BundeslandController
import at.mocode.masterdata.api.rest.CountryController
import at.mocode.masterdata.api.rest.PlatzController
import io.ktor.server.engine.embeddedServer
import io.ktor.server.engine.EmbeddedServer
import io.ktor.server.netty.Netty
import io.ktor.server.netty.NettyApplicationEngine
import at.mocode.masterdata.api.rest.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.DisposableBean
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@@ -33,7 +27,10 @@ class KtorServerConfiguration {
countryController: CountryController,
bundeslandController: BundeslandController,
altersklasseController: AltersklasseController,
platzController: PlatzController
platzController: PlatzController,
reiterController: ReiterController,
horseController: HorseController,
vereinController: VereinController
): EmbeddedServer<NettyApplicationEngine, NettyApplicationEngine.Configuration> {
log.info("Starting Masterdata Ktor server on port {}", port)
val engine = embeddedServer(Netty, port = port) {
@@ -41,7 +38,10 @@ class KtorServerConfiguration {
countryController = countryController,
bundeslandController = bundeslandController,
altersklasseController = altersklasseController,
platzController = platzController
platzController = platzController,
reiterController = reiterController,
horseController = horseController,
vereinController = vereinController
)
}
engine.start(wait = false)
@@ -1,9 +1,9 @@
package at.mocode.masterdata.service.config
import at.mocode.masterdata.api.rest.*
import at.mocode.masterdata.application.usecase.*
import at.mocode.masterdata.domain.repository.*
import at.mocode.masterdata.infrastructure.persistence.*
import at.mocode.masterdata.api.rest.*
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Profile
@@ -134,6 +134,21 @@ class MasterdataConfiguration {
): PlatzController {
return PlatzController(getPlatzUseCase, createPlatzUseCase)
}
@Bean
fun reiterController(reiterRepository: ReiterRepository): ReiterController {
return ReiterController(reiterRepository)
}
@Bean
fun horseController(horseRepository: HorseRepository): HorseController {
return HorseController(horseRepository)
}
@Bean
fun vereinController(vereinRepository: VereinRepository): VereinController {
return VereinController(vereinRepository)
}
}
/**
@@ -1,10 +1,7 @@
package at.mocode.masterdata.service.config
import at.mocode.masterdata.infrastructure.persistence.AltersklasseTable
import at.mocode.masterdata.infrastructure.persistence.BundeslandTable
import at.mocode.masterdata.infrastructure.persistence.LandTable
import at.mocode.masterdata.infrastructure.persistence.PlatzTable
import at.mocode.masterdata.infrastructure.persistence.*
import jakarta.annotation.PostConstruct
import jakarta.annotation.PreDestroy
import org.jetbrains.exposed.v1.jdbc.SchemaUtils
@@ -36,7 +33,11 @@ class MasterdataDatabaseConfiguration {
LandTable,
BundeslandTable,
AltersklasseTable,
PlatzTable
PlatzTable,
ReiterTable,
HorseTable,
VereinTable,
FunktionaerTable
)
log.info("Masterdata database schema initialized successfully")
}
@@ -72,7 +73,11 @@ class MasterdataTestDatabaseConfiguration {
LandTable,
BundeslandTable,
AltersklasseTable,
PlatzTable
PlatzTable,
ReiterTable,
HorseTable,
VereinTable,
FunktionaerTable
)
log.info("Test masterdata database schema initialized successfully")
}