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:
2026-03-28 16:50:49 +01:00
parent 2cb3f0b125
commit c806660685
181 changed files with 4121 additions and 8694 deletions
@@ -12,5 +12,5 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy
class PingServiceApplication
fun main(args: Array<String>) {
runApplication<PingServiceApplication>(*args)
runApplication<PingServiceApplication>(*args)
}
@@ -19,35 +19,35 @@ import java.time.Instant
@Profile("!test") // Nicht im Test-Profil laden, damit wir Mocks nutzen können
@OptIn(ExperimentalUuidApi::class)
class PingService(
private val repository: PingRepository
private val repository: PingRepository
) : PingUseCase {
private val logger = LoggerFactory.getLogger(PingService::class.java)
private val logger = LoggerFactory.getLogger(PingService::class.java)
@Transactional
override fun executePing(message: String): Ping {
logger.info("Executing ping with message: {}", message)
@Transactional
override fun executePing(message: String): Ping {
logger.info("Executing ping with message: {}", message)
// Domain Logic: Erstelle neue Entity (generiert UUID v7 automatisch)
val ping = Ping(message = message)
// Domain Logic: Erstelle neue Entity (generiert UUID v7 automatisch)
val ping = Ping(message = message)
// Persistence
return repository.save(ping)
}
// Persistence
return repository.save(ping)
}
@Transactional(readOnly = true)
override fun getPingHistory(): List<Ping> {
return repository.findAll()
}
@Transactional(readOnly = true)
override fun getPingHistory(): List<Ping> {
return repository.findAll()
}
@Transactional(readOnly = true)
override fun getPing(id: Uuid): Ping? {
return repository.findById(id)
}
@Transactional(readOnly = true)
override fun getPing(id: Uuid): Ping? {
return repository.findById(id)
}
@Transactional(readOnly = true)
override fun getPingsSince(timestamp: Long): List<Ping> {
val instant = Instant.ofEpochMilli(timestamp)
return repository.findByTimestampAfter(instant)
}
@Transactional(readOnly = true)
override fun getPingsSince(timestamp: Long): List<Ping> {
val instant = Instant.ofEpochMilli(timestamp)
return repository.findByTimestampAfter(instant)
}
}
@@ -10,8 +10,8 @@ import kotlin.uuid.Uuid
*/
@OptIn(ExperimentalUuidApi::class)
interface PingUseCase {
fun executePing(message: String): Ping
fun getPingHistory(): List<Ping>
fun getPing(id: Uuid): Ping?
fun getPingsSince(timestamp: Long): List<Ping>
fun executePing(message: String): Ping
fun getPingHistory(): List<Ping>
fun getPing(id: Uuid): Ping?
fun getPingsSince(timestamp: Long): List<Ping>
}
@@ -10,7 +10,7 @@ import java.time.Instant
*/
@OptIn(ExperimentalUuidApi::class)
data class Ping(
val id: Uuid = Uuid.generateV7(), // Kotlin 2.3.0 UUID v7
val message: String,
val timestamp: Instant = Instant.now()
val id: Uuid = Uuid.generateV7(), // Kotlin 2.3.0 UUID v7
val message: String,
val timestamp: Instant = Instant.now()
)
@@ -10,8 +10,8 @@ import java.time.Instant
*/
@OptIn(ExperimentalUuidApi::class)
interface PingRepository {
fun save(ping: Ping): Ping
fun findAll(): List<Ping>
fun findById(id: Uuid): Ping?
fun findByTimestampAfter(timestamp: Instant): List<Ping>
fun save(ping: Ping): Ping
fun findAll(): List<Ping>
fun findById(id: Uuid): Ping?
fun findByTimestampAfter(timestamp: Instant): List<Ping>
}
@@ -9,15 +9,9 @@ import java.util.UUID
@Entity
@Table(name = "ping")
class PingJpaEntity(
@Id
val id: UUID,
val message: String,
val createdAt: Instant
@Id
var id: UUID,
var message: String,
var createdAt: Instant
) {
// The default constructor for JPA
// Protected is fine for Hibernate, but the Kotlin compiler might complain about visibility.
// We can make it private or internal if needed, but protected is standard.
// To suppress the warning "effectively private", we can just leave it as is or make it public/internal.
// Let's try making it internal to satisfy Kotlin while keeping it hidden from public API.
internal constructor() : this(UUID.randomUUID(), "", Instant.now())
}
@@ -14,36 +14,36 @@ import java.time.Instant
// @Profile("!test") entfernt, damit Integrationstests den echten Adapter nutzen können.
// In Unit-Tests wird er durch Mocks (@MockBean oder @TestConfiguration) ersetzt.
class PingRepositoryAdapter(
private val jpaRepository: SpringDataPingRepository
private val jpaRepository: SpringDataPingRepository
) : PingRepository {
override fun save(ping: Ping): Ping {
val entity = ping.toEntity()
val savedEntity = jpaRepository.save(entity)
return savedEntity.toDomain()
}
override fun save(ping: Ping): Ping {
val entity = ping.toEntity()
val savedEntity = jpaRepository.save(entity)
return savedEntity.toDomain()
}
override fun findAll(): List<Ping> {
return jpaRepository.findAll().map { it.toDomain() }
}
override fun findAll(): List<Ping> {
return jpaRepository.findAll().map { it.toDomain() }
}
override fun findById(id: Uuid): Ping? {
return jpaRepository.findById(id.toJavaUuid()).map { it.toDomain() }.orElse(null)
}
override fun findById(id: Uuid): Ping? {
return jpaRepository.findById(id.toJavaUuid()).map { it.toDomain() }.orElse(null)
}
override fun findByTimestampAfter(timestamp: Instant): List<Ping> {
return jpaRepository.findByCreatedAtAfter(timestamp).map { it.toDomain() }
}
override fun findByTimestampAfter(timestamp: Instant): List<Ping> {
return jpaRepository.findByCreatedAtAfter(timestamp).map { it.toDomain() }
}
private fun Ping.toEntity() = PingJpaEntity(
id = this.id.toJavaUuid(),
message = this.message,
createdAt = this.timestamp
)
private fun Ping.toEntity() = PingJpaEntity(
id = this.id.toJavaUuid(),
message = this.message,
createdAt = this.timestamp
)
private fun PingJpaEntity.toDomain() = Ping(
id = this.id.toKotlinUuid(),
message = this.message,
timestamp = this.createdAt
)
private fun PingJpaEntity.toDomain() = Ping(
id = this.id.toKotlinUuid(),
message = this.message,
timestamp = this.createdAt
)
}
@@ -5,5 +5,5 @@ import java.util.UUID
import java.time.Instant
interface SpringDataPingRepository : JpaRepository<PingJpaEntity, UUID> {
fun findByCreatedAtAfter(createdAt: Instant): List<PingJpaEntity>
fun findByCreatedAtAfter(createdAt: Instant): List<PingJpaEntity>
}
@@ -21,102 +21,102 @@ import kotlin.uuid.ExperimentalUuidApi
@RestController
@OptIn(ExperimentalUuidApi::class)
class PingController(
private val pingUseCase: PingUseCase,
private val properties: PingProperties
private val pingUseCase: PingUseCase,
private val properties: PingProperties
) : PingApi {
private val logger = LoggerFactory.getLogger(PingController::class.java)
private val formatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME
private val logger = LoggerFactory.getLogger(PingController::class.java)
private val formatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME
companion object {
const val PING_CIRCUIT_BREAKER = "pingCircuitBreaker"
companion object {
const val PING_CIRCUIT_BREAKER = "pingCircuitBreaker"
}
@GetMapping("/ping/simple")
override suspend fun simplePing(): PingResponse {
val domainPing = pingUseCase.executePing("Simple Ping")
return createResponse(domainPing, "pong")
}
@GetMapping("/ping/enhanced")
@CircuitBreaker(name = PING_CIRCUIT_BREAKER, fallbackMethod = "fallbackPing")
override suspend fun enhancedPing(
@RequestParam(required = false, defaultValue = "false") simulate: Boolean
): EnhancedPingResponse {
val start = System.nanoTime()
if (simulate && Random.nextDouble() < 0.6) {
throw RuntimeException("Simulated service failure")
}
@GetMapping("/ping/simple")
override suspend fun simplePing(): PingResponse {
val domainPing = pingUseCase.executePing("Simple Ping")
return createResponse(domainPing, "pong")
}
val domainPing = pingUseCase.executePing("Enhanced Ping")
val elapsedMs = (System.nanoTime() - start) / 1_000_000
@GetMapping("/ping/enhanced")
@CircuitBreaker(name = PING_CIRCUIT_BREAKER, fallbackMethod = "fallbackPing")
override suspend fun enhancedPing(
@RequestParam(required = false, defaultValue = "false") simulate: Boolean
): EnhancedPingResponse {
val start = System.nanoTime()
if (simulate && Random.nextDouble() < 0.6) {
throw RuntimeException("Simulated service failure")
}
val domainPing = pingUseCase.executePing("Enhanced Ping")
val elapsedMs = (System.nanoTime() - start) / 1_000_000
return EnhancedPingResponse(
status = "pong",
timestamp = domainPing.timestamp.atOffset(ZoneOffset.UTC).format(formatter),
service = properties.serviceName,
circuitBreakerState = "CLOSED",
responseTime = elapsedMs
)
}
// Neue Endpunkte
@GetMapping("/ping/public")
override suspend fun publicPing(): PingResponse {
val domainPing = pingUseCase.executePing("Public Ping")
return createResponse(domainPing, "public-pong")
}
@GetMapping("/ping/secure")
@PreAuthorize("hasRole('MELD_USER') or hasRole('MELD_ADMIN')") // Beispiel-Rollen
override suspend fun securePing(): PingResponse {
val domainPing = pingUseCase.executePing("Secure Ping")
return createResponse(domainPing, "secure-pong")
}
@GetMapping("/ping/sync")
override suspend fun syncPings(
// Changed the parameter name to 'since' to match SyncManager convention
@RequestParam(required = false, defaultValue = "0") since: Long
): List<PingEvent> {
return pingUseCase.getPingsSince(since).map {
PingEvent(
id = it.id.toString(),
message = it.message,
lastModified = it.timestamp.toEpochMilli()
)
}
}
// Helper
private fun createResponse(domainPing: at.mocode.ping.domain.Ping, status: String) = PingResponse(
status = status,
timestamp = domainPing.timestamp.atOffset(ZoneOffset.UTC).format(formatter),
service = properties.serviceName
return EnhancedPingResponse(
status = "pong",
timestamp = domainPing.timestamp.atOffset(ZoneOffset.UTC).format(formatter),
service = properties.serviceName,
circuitBreakerState = "CLOSED",
responseTime = elapsedMs
)
}
// Fallback
@Suppress("unused", "UNUSED_PARAMETER")
fun fallbackPing(simulate: Boolean, ex: Exception): EnhancedPingResponse {
logger.warn("Circuit breaker fallback triggered: {}", ex.message)
return EnhancedPingResponse(
status = "fallback",
timestamp = java.time.OffsetDateTime.now().format(formatter),
service = properties.serviceNameFallback,
circuitBreakerState = "OPEN",
responseTime = 0
)
}
// Neue Endpunkte
@GetMapping("/ping/health")
override suspend fun healthCheck(): HealthResponse {
return HealthResponse(
status = "up",
timestamp = java.time.OffsetDateTime.now().format(formatter),
service = properties.serviceName,
healthy = true
)
@GetMapping("/ping/public")
override suspend fun publicPing(): PingResponse {
val domainPing = pingUseCase.executePing("Public Ping")
return createResponse(domainPing, "public-pong")
}
@GetMapping("/ping/secure")
@PreAuthorize("hasRole('MELD_USER') or hasRole('MELD_ADMIN')") // Beispiel-Rollen
override suspend fun securePing(): PingResponse {
val domainPing = pingUseCase.executePing("Secure Ping")
return createResponse(domainPing, "secure-pong")
}
@GetMapping("/ping/sync")
override suspend fun syncPings(
// Changed the parameter name to 'since' to match SyncManager convention
@RequestParam(required = false, defaultValue = "0") since: Long
): List<PingEvent> {
return pingUseCase.getPingsSince(since).map {
PingEvent(
id = it.id.toString(),
message = it.message,
lastModified = it.timestamp.toEpochMilli()
)
}
}
// Helper
private fun createResponse(domainPing: at.mocode.ping.domain.Ping, status: String) = PingResponse(
status = status,
timestamp = domainPing.timestamp.atOffset(ZoneOffset.UTC).format(formatter),
service = properties.serviceName
)
// Fallback
@Suppress("unused", "UNUSED_PARAMETER")
fun fallbackPing(simulate: Boolean, ex: Exception): EnhancedPingResponse {
logger.warn("Circuit breaker fallback triggered: {}", ex.message)
return EnhancedPingResponse(
status = "fallback",
timestamp = java.time.OffsetDateTime.now().format(formatter),
service = properties.serviceNameFallback,
circuitBreakerState = "OPEN",
responseTime = 0
)
}
@GetMapping("/ping/health")
override suspend fun healthCheck(): HealthResponse {
return HealthResponse(
status = "up",
timestamp = java.time.OffsetDateTime.now().format(formatter),
service = properties.serviceName,
healthy = true
)
}
}
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="LOG_PATTERN" value="%d{ISO8601} %-5level [%X{traceId:-}:%X{spanId:-}] %logger{36} - %msg%n"/>
<property name="LOG_PATTERN" value="%d{ISO8601} %-5level [%X{traceId:-}:%X{spanId:-}] %logger{36} - %msg%n"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>
<logger name="org.springframework" level="INFO"/>
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springframework.boot.actuate" level="INFO"/>
<logger name="reactor.netty" level="WARN"/>
<logger name="org.springframework" level="INFO"/>
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springframework.boot.actuate" level="INFO"/>
<logger name="reactor.netty" level="WARN"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>