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:
@@ -0,0 +1,15 @@
|
||||
plugins {
|
||||
alias(libs.plugins.kotlinJvm)
|
||||
alias(libs.plugins.kotlinSpring)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(projects.platform.platformDependencies)
|
||||
implementation(projects.backend.services.identity.identityDomain)
|
||||
implementation(projects.core.coreDomain)
|
||||
implementation(projects.core.coreUtils)
|
||||
implementation(libs.exposed.core)
|
||||
implementation(libs.exposed.dao)
|
||||
implementation(libs.exposed.jdbc)
|
||||
implementation(libs.exposed.kotlin.datetime)
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
|
||||
package at.mocode.identity.infrastructure.persistence
|
||||
|
||||
import at.mocode.identity.domain.model.DomProfil
|
||||
import at.mocode.identity.domain.repository.ProfileRepository
|
||||
import org.jetbrains.exposed.v1.core.ResultRow
|
||||
import org.jetbrains.exposed.v1.core.eq
|
||||
import org.jetbrains.exposed.v1.core.statements.UpdateBuilder
|
||||
import org.jetbrains.exposed.v1.jdbc.deleteWhere
|
||||
import org.jetbrains.exposed.v1.jdbc.insert
|
||||
import org.jetbrains.exposed.v1.jdbc.selectAll
|
||||
import org.jetbrains.exposed.v1.jdbc.transactions.transaction
|
||||
import org.jetbrains.exposed.v1.jdbc.update
|
||||
import kotlin.time.Clock
|
||||
import kotlin.uuid.Uuid
|
||||
import kotlin.uuid.toJavaUuid
|
||||
import kotlin.uuid.toKotlinUuid
|
||||
|
||||
class ExposedProfileRepository : ProfileRepository {
|
||||
|
||||
override suspend fun findById(id: Uuid): DomProfil? = transaction {
|
||||
ProfileTable.selectAll().where { ProfileTable.id eq id.toJavaUuid() }
|
||||
.map { rowToProfile(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
|
||||
override suspend fun findByUserId(userId: String): DomProfil? = transaction {
|
||||
ProfileTable.selectAll().where { ProfileTable.userId eq userId }
|
||||
.map { rowToProfile(it) }
|
||||
.singleOrNull()
|
||||
}
|
||||
|
||||
override suspend fun findBySatznummer(satznummer: String): List<DomProfil> = transaction {
|
||||
ProfileTable.selectAll().where { ProfileTable.satznummer eq satznummer }
|
||||
.map { rowToProfile(it) }
|
||||
}
|
||||
|
||||
override suspend fun save(profil: DomProfil): DomProfil = transaction {
|
||||
val now = Clock.System.now()
|
||||
val updated = profil.copy(updatedAt = now)
|
||||
val javaId = profil.profileId.toJavaUuid()
|
||||
|
||||
val existing = ProfileTable.selectAll().where { ProfileTable.id eq javaId }.singleOrNull()
|
||||
if (existing != null) {
|
||||
ProfileTable.update({ ProfileTable.id eq javaId }) { profileToStatement(it, updated) }
|
||||
} else {
|
||||
ProfileTable.insert {
|
||||
it[id] = javaId
|
||||
profileToStatement(it, updated)
|
||||
}
|
||||
}
|
||||
updated
|
||||
}
|
||||
|
||||
override suspend fun delete(id: Uuid): Boolean = transaction {
|
||||
ProfileTable.deleteWhere { ProfileTable.id eq id.toJavaUuid() } > 0
|
||||
}
|
||||
|
||||
private fun rowToProfile(row: ResultRow): DomProfil = DomProfil(
|
||||
profileId = row[ProfileTable.id].toKotlinUuid(),
|
||||
userId = row[ProfileTable.userId],
|
||||
satznummer = row[ProfileTable.satznummer],
|
||||
logoUrl = row[ProfileTable.logoUrl],
|
||||
bio = row[ProfileTable.bio],
|
||||
contactEmail = row[ProfileTable.contactEmail],
|
||||
createdAt = row[ProfileTable.createdAt],
|
||||
updatedAt = row[ProfileTable.updatedAt]
|
||||
)
|
||||
|
||||
private fun profileToStatement(stmt: UpdateBuilder<*>, p: DomProfil) {
|
||||
stmt[ProfileTable.userId] = p.userId
|
||||
stmt[ProfileTable.satznummer] = p.satznummer
|
||||
stmt[ProfileTable.logoUrl] = p.logoUrl
|
||||
stmt[ProfileTable.bio] = p.bio
|
||||
stmt[ProfileTable.contactEmail] = p.contactEmail
|
||||
stmt[ProfileTable.createdAt] = p.createdAt
|
||||
stmt[ProfileTable.updatedAt] = p.updatedAt
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package at.mocode.identity.infrastructure.persistence
|
||||
|
||||
import org.jetbrains.exposed.v1.core.Table
|
||||
import org.jetbrains.exposed.v1.core.java.javaUUID
|
||||
import org.jetbrains.exposed.v1.datetime.timestamp
|
||||
|
||||
/**
|
||||
* Exposed Table definition for user profiles.
|
||||
* Links Keycloak user IDs to official ZNS satznummer.
|
||||
*/
|
||||
object ProfileTable : Table("identity_profiles") {
|
||||
val id = javaUUID("id").autoGenerate()
|
||||
override val primaryKey = PrimaryKey(id)
|
||||
|
||||
val userId = varchar("user_id", 100)
|
||||
val satznummer = varchar("satznummer", 20)
|
||||
|
||||
val logoUrl = text("logo_url").nullable()
|
||||
val bio = text("bio").nullable()
|
||||
val contactEmail = varchar("contact_email", 200).nullable()
|
||||
|
||||
val createdAt = timestamp("created_at")
|
||||
val updatedAt = timestamp("updated_at")
|
||||
|
||||
init {
|
||||
index(true, userId)
|
||||
index(false, satznummer)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user