chore: remove deprecated horses, clubs, officials, and persons services
- Deleted obsolete modules related to horses, clubs, officials, and persons services, including their configurations, build files, and database provisioning scripts. - Cleaned up associated references in the project structure (e.g., `settings.gradle.kts`). - Removed unused database tables and Spring beans related to these domains. Signed-off-by: Stefan Mogeritsch <stefan.mo.co@gmail.com>
This commit is contained in:
+2
-15
@@ -1,7 +1,5 @@
|
||||
package at.mocode.masterdata.service
|
||||
|
||||
import at.mocode.core.utils.config.AppConfig
|
||||
import at.mocode.core.utils.database.DatabaseFactory
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.runApplication
|
||||
|
||||
@@ -14,17 +12,6 @@ import org.springframework.boot.runApplication
|
||||
class MasterdataServiceApplication
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
// 1. Lade die Konfiguration explizit, genau einmal beim Start.
|
||||
val appConfig = AppConfig.load()
|
||||
println("Konfiguration für Umgebung '${appConfig.environment}' geladen.")
|
||||
|
||||
// 2. Initialisiere die Datenbank mit der geladenen Konfiguration.
|
||||
// Flyway-Migrationen werden hier automatisch ausgeführt.
|
||||
DatabaseFactory.init(appConfig.database)
|
||||
println("Datenbank initialisiert und migriert.")
|
||||
|
||||
// 3. Starte die Spring Boot / Ktor Anwendung.
|
||||
// Der appConfig-Wert kann hier an die Anwendung übergeben werden,
|
||||
// um ihn später per Dependency Injection zu nutzen.
|
||||
runApplication<MasterdataServiceApplication>(*args)
|
||||
// Starte die Spring Boot Anwendung.
|
||||
runApplication<MasterdataServiceApplication>(*args)
|
||||
}
|
||||
|
||||
+129
-109
@@ -17,103 +17,123 @@ import org.springframework.context.annotation.Profile
|
||||
@Configuration
|
||||
class MasterdataConfiguration {
|
||||
|
||||
// Repository Implementations
|
||||
@Bean
|
||||
fun landRepository(): LandRepository {
|
||||
return LandRepositoryImpl()
|
||||
}
|
||||
// Repository Implementations
|
||||
@Bean
|
||||
fun landRepository(): LandRepository {
|
||||
return LandRepositoryImpl()
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun bundeslandRepository(): BundeslandRepository {
|
||||
return BundeslandRepositoryImpl()
|
||||
}
|
||||
@Bean
|
||||
fun bundeslandRepository(): BundeslandRepository {
|
||||
return BundeslandRepositoryImpl()
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun altersklasseRepository(): AltersklasseRepository {
|
||||
return AltersklasseRepositoryImpl()
|
||||
}
|
||||
@Bean
|
||||
fun altersklasseRepository(): AltersklasseRepository {
|
||||
return AltersklasseRepositoryImpl()
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun platzRepository(): PlatzRepository {
|
||||
return PlatzRepositoryImpl()
|
||||
}
|
||||
@Bean
|
||||
fun platzRepository(): PlatzRepository {
|
||||
return PlatzRepositoryImpl()
|
||||
}
|
||||
|
||||
// Use Cases - Country/Land
|
||||
@Bean
|
||||
fun getCountryUseCase(landRepository: LandRepository): GetCountryUseCase {
|
||||
return GetCountryUseCase(landRepository)
|
||||
}
|
||||
@Bean
|
||||
fun reiterRepository(): ReiterRepository {
|
||||
return ExposedReiterRepository()
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun createCountryUseCase(landRepository: LandRepository): CreateCountryUseCase {
|
||||
return CreateCountryUseCase(landRepository)
|
||||
}
|
||||
@Bean
|
||||
fun vereinRepository(): VereinRepository {
|
||||
return ExposedVereinRepository()
|
||||
}
|
||||
|
||||
// Use Cases - Federal State/Bundesland
|
||||
@Bean
|
||||
fun getBundeslandUseCase(bundeslandRepository: BundeslandRepository): GetBundeslandUseCase {
|
||||
return GetBundeslandUseCase(bundeslandRepository)
|
||||
}
|
||||
@Bean
|
||||
fun horseRepository(): HorseRepository {
|
||||
return HorseRepositoryImpl()
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun createBundeslandUseCase(bundeslandRepository: BundeslandRepository): CreateBundeslandUseCase {
|
||||
return CreateBundeslandUseCase(bundeslandRepository)
|
||||
}
|
||||
@Bean
|
||||
fun funktionaerRepository(): FunktionaerRepository {
|
||||
return ExposedFunktionaerRepository()
|
||||
}
|
||||
|
||||
// Use Cases - Age Class/Altersklasse
|
||||
@Bean
|
||||
fun getAltersklasseUseCase(altersklasseRepository: AltersklasseRepository): GetAltersklasseUseCase {
|
||||
return GetAltersklasseUseCase(altersklasseRepository)
|
||||
}
|
||||
// Use Cases - Country/Land
|
||||
@Bean
|
||||
fun getCountryUseCase(landRepository: LandRepository): GetCountryUseCase {
|
||||
return GetCountryUseCase(landRepository)
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun createAltersklasseUseCase(altersklasseRepository: AltersklasseRepository): CreateAltersklasseUseCase {
|
||||
return CreateAltersklasseUseCase(altersklasseRepository)
|
||||
}
|
||||
@Bean
|
||||
fun createCountryUseCase(landRepository: LandRepository): CreateCountryUseCase {
|
||||
return CreateCountryUseCase(landRepository)
|
||||
}
|
||||
|
||||
// Use Cases - Venue/Platz
|
||||
@Bean
|
||||
fun getPlatzUseCase(platzRepository: PlatzRepository): GetPlatzUseCase {
|
||||
return GetPlatzUseCase(platzRepository)
|
||||
}
|
||||
// Use Cases - Federal State/Bundesland
|
||||
@Bean
|
||||
fun getBundeslandUseCase(bundeslandRepository: BundeslandRepository): GetBundeslandUseCase {
|
||||
return GetBundeslandUseCase(bundeslandRepository)
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun createPlatzUseCase(platzRepository: PlatzRepository): CreatePlatzUseCase {
|
||||
return CreatePlatzUseCase(platzRepository)
|
||||
}
|
||||
@Bean
|
||||
fun createBundeslandUseCase(bundeslandRepository: BundeslandRepository): CreateBundeslandUseCase {
|
||||
return CreateBundeslandUseCase(bundeslandRepository)
|
||||
}
|
||||
|
||||
// API Controllers
|
||||
@Bean
|
||||
fun countryController(
|
||||
getCountryUseCase: GetCountryUseCase,
|
||||
createCountryUseCase: CreateCountryUseCase
|
||||
): CountryController {
|
||||
return CountryController(getCountryUseCase, createCountryUseCase)
|
||||
}
|
||||
// Use Cases - Age Class/Altersklasse
|
||||
@Bean
|
||||
fun getAltersklasseUseCase(altersklasseRepository: AltersklasseRepository): GetAltersklasseUseCase {
|
||||
return GetAltersklasseUseCase(altersklasseRepository)
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun bundeslandController(
|
||||
getBundeslandUseCase: GetBundeslandUseCase,
|
||||
createBundeslandUseCase: CreateBundeslandUseCase
|
||||
): BundeslandController {
|
||||
return BundeslandController(getBundeslandUseCase, createBundeslandUseCase)
|
||||
}
|
||||
@Bean
|
||||
fun createAltersklasseUseCase(altersklasseRepository: AltersklasseRepository): CreateAltersklasseUseCase {
|
||||
return CreateAltersklasseUseCase(altersklasseRepository)
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun altersklasseController(
|
||||
getAltersklasseUseCase: GetAltersklasseUseCase,
|
||||
createAltersklasseUseCase: CreateAltersklasseUseCase
|
||||
): AltersklasseController {
|
||||
return AltersklasseController(getAltersklasseUseCase, createAltersklasseUseCase)
|
||||
}
|
||||
// Use Cases - Venue/Platz
|
||||
@Bean
|
||||
fun getPlatzUseCase(platzRepository: PlatzRepository): GetPlatzUseCase {
|
||||
return GetPlatzUseCase(platzRepository)
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun platzController(
|
||||
getPlatzUseCase: GetPlatzUseCase,
|
||||
createPlatzUseCase: CreatePlatzUseCase
|
||||
): PlatzController {
|
||||
return PlatzController(getPlatzUseCase, createPlatzUseCase)
|
||||
}
|
||||
@Bean
|
||||
fun createPlatzUseCase(platzRepository: PlatzRepository): CreatePlatzUseCase {
|
||||
return CreatePlatzUseCase(platzRepository)
|
||||
}
|
||||
|
||||
// API Controllers
|
||||
@Bean
|
||||
fun countryController(
|
||||
getCountryUseCase: GetCountryUseCase,
|
||||
createCountryUseCase: CreateCountryUseCase
|
||||
): CountryController {
|
||||
return CountryController(getCountryUseCase, createCountryUseCase)
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun bundeslandController(
|
||||
getBundeslandUseCase: GetBundeslandUseCase,
|
||||
createBundeslandUseCase: CreateBundeslandUseCase
|
||||
): BundeslandController {
|
||||
return BundeslandController(getBundeslandUseCase, createBundeslandUseCase)
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun altersklasseController(
|
||||
getAltersklasseUseCase: GetAltersklasseUseCase,
|
||||
createAltersklasseUseCase: CreateAltersklasseUseCase
|
||||
): AltersklasseController {
|
||||
return AltersklasseController(getAltersklasseUseCase, createAltersklasseUseCase)
|
||||
}
|
||||
|
||||
@Bean
|
||||
fun platzController(
|
||||
getPlatzUseCase: GetPlatzUseCase,
|
||||
createPlatzUseCase: CreatePlatzUseCase
|
||||
): PlatzController {
|
||||
return PlatzController(getPlatzUseCase, createPlatzUseCase)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,33 +142,33 @@ class MasterdataConfiguration {
|
||||
@Configuration
|
||||
class DatabaseConfiguration {
|
||||
|
||||
/**
|
||||
* Development database configuration.
|
||||
*/
|
||||
@Configuration
|
||||
@Profile("dev", "development")
|
||||
class DevelopmentDatabaseConfig {
|
||||
// Development-specific database configuration
|
||||
// This would typically include H2 or local PostgreSQL setup
|
||||
}
|
||||
/**
|
||||
* Development database configuration.
|
||||
*/
|
||||
@Configuration
|
||||
@Profile("dev", "development")
|
||||
class DevelopmentDatabaseConfig {
|
||||
// Development-specific database configuration
|
||||
// This would typically include H2 or local PostgreSQL setup
|
||||
}
|
||||
|
||||
/**
|
||||
* Production database configuration.
|
||||
*/
|
||||
@Configuration
|
||||
@Profile("prod", "production")
|
||||
class ProductionDatabaseConfig {
|
||||
// Production-specific database configuration
|
||||
// This would include production PostgreSQL setup with connection pooling
|
||||
}
|
||||
/**
|
||||
* Production database configuration.
|
||||
*/
|
||||
@Configuration
|
||||
@Profile("prod", "production")
|
||||
class ProductionDatabaseConfig {
|
||||
// Production-specific database configuration
|
||||
// This would include production PostgreSQL setup with connection pooling
|
||||
}
|
||||
|
||||
/**
|
||||
* Test database configuration.
|
||||
*/
|
||||
@Configuration
|
||||
@Profile("test")
|
||||
class TestDatabaseConfig {
|
||||
// Test-specific database configuration
|
||||
// This would typically include in-memory H2 database
|
||||
}
|
||||
/**
|
||||
* Test database configuration.
|
||||
*/
|
||||
@Configuration
|
||||
@Profile("test")
|
||||
class TestDatabaseConfig {
|
||||
// Test-specific database configuration
|
||||
// This would typically include in-memory H2 database
|
||||
}
|
||||
}
|
||||
|
||||
+53
-81
@@ -1,18 +1,17 @@
|
||||
package at.mocode.masterdata.service.config
|
||||
|
||||
import at.mocode.core.utils.database.DatabaseConfig
|
||||
import at.mocode.core.utils.database.DatabaseFactory
|
||||
import at.mocode.masterdata.infrastructure.persistence.LandTable
|
||||
import at.mocode.masterdata.infrastructure.persistence.BundeslandTable
|
||||
|
||||
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 org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.Profile
|
||||
import jakarta.annotation.PostConstruct
|
||||
import jakarta.annotation.PreDestroy
|
||||
import org.jetbrains.exposed.v1.jdbc.SchemaUtils
|
||||
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.jetbrains.exposed.sql.SchemaUtils
|
||||
import org.jetbrains.exposed.sql.transactions.transaction
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.Profile
|
||||
|
||||
/**
|
||||
* Database configuration for the Masterdata Service.
|
||||
@@ -24,40 +23,33 @@ import org.jetbrains.exposed.sql.transactions.transaction
|
||||
@Profile("!test")
|
||||
class MasterdataDatabaseConfiguration {
|
||||
|
||||
private val log = LoggerFactory.getLogger(MasterdataDatabaseConfiguration::class.java)
|
||||
private val log = LoggerFactory.getLogger(MasterdataDatabaseConfiguration::class.java)
|
||||
|
||||
@PostConstruct
|
||||
fun initializeDatabase() {
|
||||
log.info("Initializing database schema for Masterdata Service...")
|
||||
@PostConstruct
|
||||
fun initializeDatabase() {
|
||||
log.info("Initializing database schema for Masterdata Service...")
|
||||
|
||||
try {
|
||||
// Database connection is already initialized by the gateway
|
||||
// Only initialize the schema for this service
|
||||
transaction {
|
||||
SchemaUtils.create(
|
||||
LandTable,
|
||||
BundeslandTable,
|
||||
AltersklasseTable,
|
||||
PlatzTable
|
||||
)
|
||||
log.info("Masterdata database schema initialized successfully")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
log.error("Failed to initialize database schema", e)
|
||||
throw e
|
||||
}
|
||||
try {
|
||||
// Database connection should be initialized by Spring Boot
|
||||
transaction {
|
||||
SchemaUtils.create(
|
||||
LandTable,
|
||||
BundeslandTable,
|
||||
AltersklasseTable,
|
||||
PlatzTable
|
||||
)
|
||||
log.info("Masterdata database schema initialized successfully")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
log.error("Failed to initialize database schema", e)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
fun closeDatabase() {
|
||||
log.info("Closing database connection for Masterdata Service...")
|
||||
try {
|
||||
DatabaseFactory.close()
|
||||
log.info("Database connection closed successfully")
|
||||
} catch (e: Exception) {
|
||||
log.error("Error closing database connection", e)
|
||||
}
|
||||
}
|
||||
@PreDestroy
|
||||
fun closeDatabase() {
|
||||
log.info("Closing Masterdata Service database configuration...")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,51 +59,31 @@ class MasterdataDatabaseConfiguration {
|
||||
@Profile("test")
|
||||
class MasterdataTestDatabaseConfiguration {
|
||||
|
||||
private val log = LoggerFactory.getLogger(MasterdataTestDatabaseConfiguration::class.java)
|
||||
private val log = LoggerFactory.getLogger(MasterdataTestDatabaseConfiguration::class.java)
|
||||
|
||||
@PostConstruct
|
||||
fun initializeTestDatabase() {
|
||||
log.info("Initializing test database connection for Masterdata Service...")
|
||||
@PostConstruct
|
||||
fun initializeTestDatabase() {
|
||||
log.info("Initializing test database schema for Masterdata Service...")
|
||||
|
||||
try {
|
||||
// Use H2 in-memory database for tests
|
||||
val testConfig = DatabaseConfig(
|
||||
jdbcUrl = "jdbc:h2:mem:masterdata_test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE",
|
||||
username = "sa",
|
||||
password = "",
|
||||
driverClassName = "org.h2.Driver",
|
||||
maxPoolSize = 5,
|
||||
minPoolSize = 1,
|
||||
autoMigrate = true
|
||||
)
|
||||
|
||||
DatabaseFactory.init(testConfig)
|
||||
log.info("Test database connection initialized successfully")
|
||||
|
||||
// Initialize database schema for tests
|
||||
transaction {
|
||||
SchemaUtils.create(
|
||||
LandTable,
|
||||
BundeslandTable,
|
||||
AltersklasseTable,
|
||||
PlatzTable
|
||||
)
|
||||
log.info("Test masterdata database schema initialized successfully")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
log.error("Failed to initialize test database connection", e)
|
||||
throw e
|
||||
}
|
||||
try {
|
||||
// Initialize database schema for tests
|
||||
transaction {
|
||||
SchemaUtils.create(
|
||||
LandTable,
|
||||
BundeslandTable,
|
||||
AltersklasseTable,
|
||||
PlatzTable
|
||||
)
|
||||
log.info("Test masterdata database schema initialized successfully")
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
log.error("Failed to initialize test database schema", e)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
fun closeTestDatabase() {
|
||||
log.info("Closing test database connection for Masterdata Service...")
|
||||
try {
|
||||
DatabaseFactory.close()
|
||||
log.info("Test database connection closed successfully")
|
||||
} catch (e: Exception) {
|
||||
log.error("Error closing test database connection", e)
|
||||
}
|
||||
}
|
||||
@PreDestroy
|
||||
fun closeTestDatabase() {
|
||||
log.info("Closing test database configuration for Masterdata Service...")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user