nächster Versuch
This commit is contained in:
parent
8fcc279679
commit
490e86bf9d
|
|
@ -1,6 +1,6 @@
|
|||
package at.mocode
|
||||
|
||||
import at.mocode.model.Turnier
|
||||
import at.mocode.model.entitaeten.Turnier
|
||||
import at.mocode.plugins.configureDatabase
|
||||
import at.mocode.tables.TurniereTable
|
||||
import io.ktor.http.*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package at.mocode
|
||||
|
||||
import at.mocode.model.Turnier
|
||||
import at.mocode.model.entitaeten.Turnier
|
||||
import kotlinx.html.*
|
||||
import kotlinx.html.stream.appendHTML
|
||||
import java.io.StringWriter
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package at.mocode
|
||||
|
||||
import at.mocode.model.Turnier
|
||||
import at.mocode.model.entitaeten.Turnier
|
||||
import at.mocode.tables.TurniereTable
|
||||
import io.ktor.http.*
|
||||
import io.ktor.server.application.*
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ kotlin {
|
|||
dependencies {
|
||||
// put your Multiplatform dependencies here
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.1")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
|
||||
implementation("com.benasher44:uuid:0.8.1")
|
||||
implementation("com.ionspin.kotlin:bignum:0.3.8")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
package at.mocode.model
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Nennung(
|
||||
// Wir brauchen die Turnier-ID, um die Nennung zuzuordnen
|
||||
val turnierId: String,
|
||||
// Einfache Felder für den Start
|
||||
val riderName: String = "", // Standardwerte für leeres Formular
|
||||
val horseName: String = "",
|
||||
val email: String = "",
|
||||
val comments: String? = null
|
||||
// Hier kommen später Felder hinzu: Verein, Lizenznr., Tel,
|
||||
// und vor allem: die Auswahl der Prüfungen!
|
||||
)
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
package at.mocode.model
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
data class Turnier(
|
||||
val id: String, // Eine eindeutige ID für das Turnier (z.B. eine UUID als String)
|
||||
val name: String, // Der Name, z.B. "CDN-C Edelhof April 2025"
|
||||
val datum: String, // Das Datum oder der Zeitraum, erstmal als Text, z.B. "14.04.2025 - 15.04.2025"
|
||||
val logoUrl: String? = null, // Optional: Link zum Logo des Veranstalters
|
||||
val ausschreibungUrl: String? = null // Optional: Link zum Ausschreibung-PDF
|
||||
// Hier können später viele weitere Felder hinzukommen:
|
||||
// Ort, Veranstalter, Status (geplant, läuft, beendet), Disziplinen etc.
|
||||
)
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package at.mocode.model.entitaeten
|
||||
|
||||
import at.mocode.model.serializer.BigDecimalSerializer
|
||||
import at.mocode.model.serializer.JavaUUIDSerializer
|
||||
import at.mocode.model.serializer.KotlinInstantSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Artikel(
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
val id: UUID = UUID.randomUUID(),
|
||||
var bezeichnung: String,
|
||||
@Serializable(with = BigDecimalSerializer::class) // Beispiel für Serializer
|
||||
var preis: BigDecimal,
|
||||
var einheit: String,
|
||||
var istVerbandsabgabe: Boolean = false,
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
val createdAt: Instant = Clock.System.now(),
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
var updatedAt: Instant = Clock.System.now()
|
||||
)
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package at.mocode.model.entitaeten
|
||||
|
||||
import at.mocode.model.serializer.JavaUUIDSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class MeisterschaftReferenz(
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
val id: UUID = UUID.randomUUID(),
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
var meisterschaftId: UUID, // FK zu einer Meisterschafts-Entität
|
||||
var name: String,
|
||||
var betrifftBewerbNummern: List<Int>,
|
||||
var berechnungsstrategie: String?,
|
||||
var reglementUrl: String?
|
||||
)
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package at.mocode.model.entitaeten
|
||||
|
||||
import at.mocode.model.enums.PlatzTyp
|
||||
import at.mocode.model.serializer.JavaUUIDSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Platz(
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
val id: UUID = UUID.randomUUID(),
|
||||
var name: String,
|
||||
var dimension: String?,
|
||||
var boden: String?,
|
||||
var typ: PlatzTyp
|
||||
)
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package at.mocode.model.entitaeten
|
||||
|
||||
// Hinweis: In einem Kotlin Multiplatform-Projekt können JVM-spezifische Klassen wie
|
||||
// java.math.BigDecimal und java.util.UUID nicht im commonMain-Quellcode verwendet werden.
|
||||
// Stattdessen werden multiplatformfähige Alternativen verwendet:
|
||||
// - com.benasher44.uuid.Uuid anstelle von java.util.UUID
|
||||
// - com.ionspin.kotlin.bignum.decimal.BigDecimal anstelle von java.math.BigDecimal
|
||||
// Diese Klassen bieten ähnliche Funktionalität, sind aber auf allen Plattformen verfügbar.
|
||||
//
|
||||
// Für JVM-spezifischen Code können diese Klassen im jvmMain-Quellset verwendet werden.
|
||||
// Siehe: shared/src/jvmMain/kotlin/at/mocode/model/JvmSerializer.kt
|
||||
|
||||
import at.mocode.model.enums.NennungsArt
|
||||
import at.mocode.model.serializer.*
|
||||
import com.ionspin.kotlin.bignum.decimal.BigDecimal
|
||||
import kotlinx.datetime.Clock
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlinx.datetime.LocalDate
|
||||
import kotlinx.datetime.LocalDateTime
|
||||
import kotlinx.serialization.Serializable
|
||||
import com.benasher44.uuid.Uuid as UUID
|
||||
|
||||
@Serializable
|
||||
data class Turnier(
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
val id: UUID = UUID.randomUUID(),
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
var veranstaltungId: UUID,
|
||||
var oepsTurnierNr: String,
|
||||
var titel: String,
|
||||
var untertitel: String?,
|
||||
@Serializable(with = KotlinLocalDateSerializer::class)
|
||||
var datumVon: LocalDate,
|
||||
@Serializable(with = KotlinLocalDateSerializer::class)
|
||||
var datumBis: LocalDate,
|
||||
@Serializable(with = KotlinLocalDateTimeSerializer::class) // Beispiel
|
||||
var nennungsschluss: LocalDateTime?,
|
||||
var nennungsArt: List<NennungsArt> = emptyList(),
|
||||
var nennungsHinweis: String?,
|
||||
var eigenesNennsystemUrl: String?,
|
||||
@Serializable(with = BigDecimalSerializer::class)
|
||||
var nenngeld: BigDecimal?,
|
||||
@Serializable(with = BigDecimalSerializer::class)
|
||||
var startgeldStandard: BigDecimal?,
|
||||
var austragungsplaetze: List<Platz> = emptyList(),
|
||||
var vorbereitungsplaetze: List<Platz> = emptyList(),
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
var turnierleiterId: UUID?, // FK zu Person
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
var turnierbeauftragterId: UUID?, // FK zu Person
|
||||
var richterIds: List<@Serializable(with = JavaUUIDSerializer::class)UUID> = emptyList(), // Pool an Richtern
|
||||
var parcoursbauerIds: List<@Serializable(with = JavaUUIDSerializer::class)UUID> = emptyList(), // FKs zu Person
|
||||
var parcoursAssistentIds: List<@Serializable(with = JavaUUIDSerializer::class)UUID> = emptyList(), // FKs zu Person
|
||||
var tierarztInfos: String?,
|
||||
var hufschmiedInfo: String?,
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
var meldestelleVerantwortlicherId: UUID?, // FK zu Person
|
||||
var meldestelleTelefon: String?,
|
||||
var meldestelleOeffnungszeiten: String?,
|
||||
var ergebnislistenUrl: String?, // Wird später meist system-generiert
|
||||
var verfuegbareArtikel: List<Artikel> = emptyList(), // Zur Auswahl für die Kassa
|
||||
var meisterschaftRefs: List<MeisterschaftReferenz> = emptyList(),
|
||||
// var cupRefs: List<CupReferenz> = emptyList(),
|
||||
// var sonderpruefungRefs: List<SonderpruefungReferenz> = emptyList(),
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
val createdAt: Instant = Clock.System.now(),
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
var updatedAt: Instant = Clock.System.now()
|
||||
)
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package at.mocode.model.entitaeten
|
||||
|
||||
import at.mocode.model.serializer.JavaUUIDSerializer
|
||||
import at.mocode.model.serializer.KotlinInstantSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Veranstaltung(
|
||||
@Serializable(with = JavaUUIDSerializer::class) // Beispiel für Serializer, falls nötig
|
||||
val id: UUID = UUID.randomUUID(),
|
||||
var name: String,
|
||||
@Serializable(with = KotlinLocalDateSerializer::class) // Beispiel für Serializer
|
||||
var datumVon: LocalDate,
|
||||
@Serializable(with = KotlinLocalDateSerializer::class)
|
||||
var datumBis: LocalDate,
|
||||
var veranstalterName: String,
|
||||
var veranstalterOepsNummer: String?,
|
||||
var veranstalterTyp: VeranstalterTyp = VeranstalterTyp.UNBEKANNT,
|
||||
var veranstaltungsortName: String,
|
||||
var veranstaltungsortAdresse: String,
|
||||
var kontaktpersonName: String?,
|
||||
var kontaktTelefon: String?,
|
||||
var kontaktEmail: String?,
|
||||
var webseite: String?,
|
||||
var logoUrl: String?,
|
||||
var anfahrtsplanInfo: String?,
|
||||
var sponsorInfos: List<String> = emptyList(),
|
||||
var dsgvoText: String?,
|
||||
var haftungsText: String?,
|
||||
var sonstigeBesondereBestimmungen: String?,
|
||||
@Serializable(with = KotlinInstantSerializer::class) // Beispiel für Serializer
|
||||
val createdAt: Instant = Clock.System.now(),
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
var updatedAt: Instant = Clock.System.now()
|
||||
)
|
||||
28
shared/src/commonMain/kotlin/at/mocode/model/enums/Enums.kt
Normal file
28
shared/src/commonMain/kotlin/at/mocode/model/enums/Enums.kt
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
package at.mocode.model.enums
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
enum class VeranstalterTyp { VEREIN, FIRMA, PRIVATPERSON, SONSTIGE, UNBEKANNT }
|
||||
@Serializable
|
||||
enum class PlatzTyp { AUSTRAGUNG, VORBEREITUNG, LONGIEREN, SONSTIGES }
|
||||
@Serializable
|
||||
enum class NennungsArt { OEPS_ZNS, EIGENES_ONLINE, DIREKT_VERANSTALTER_EMAIL, DIREKT_VERANSTALTER_TELEFON, DIREKT_VERANSTALTER_WHATSAPP, SONSTIGE }
|
||||
@Serializable
|
||||
enum class Sparte { DRESSUR, SPRINGEN, VIELSEITIGKEIT, FAHREN, VOLTIGIEREN, WESTERN, DISTANZ, ISLAND, PFERDESPORT_SPIEL, BASIS, KOMBINIERT, SONSTIGES }
|
||||
@Serializable
|
||||
enum class BewerbStatus { GEPLANT, OFFEN_FUER_NENNUNG, GESCHLOSSEN_FUER_NENNUNG, LAEUFT, ABGESCHLOSSEN, ABGESAGT }
|
||||
@Serializable
|
||||
enum class Bedingungstyp { LIZENZ_REITER, LIZENZ_FAHRER, ALTER_PFERD, ALTER_REITER, RASSE_PFERD, GESCHLECHT_PFERD, GESCHLECHT_REITER, STARTKARTE, SONSTIGES }
|
||||
@Serializable
|
||||
enum class Operator { GLEICH, UNGLEICH, MINDESTENS, MAXIMAL, ZWISCHEN, IN_LISTE, NICHT_IN_LISTE }
|
||||
@Serializable
|
||||
enum class FunktionaerRolle { RICHTER, PARCOURSBAUER, PARCOURSBAU_ASSISTENT, TECHN_DELEGIERTER, TURNIERBEAUFTRAGTER, STEWARD, ZEITNEHMER, SCHREIBER, VERANSTALTER_KONTAKT, TURNIERLEITER, HELFER, SONSTIGE }
|
||||
@Serializable
|
||||
enum class RichterPosition { BEI_C, BEI_E, BEI_H, BEI_M, BEI_B, VORSITZ, SEITENRICHTER, SONSTIGE }
|
||||
@Serializable
|
||||
enum class Geschlecht { M, W, D, UNBEKANNT }
|
||||
@Serializable
|
||||
enum class LizenzTyp { REITER, FAHRER, VOLTIGIERER, WESTERN, WORKING_EQUITATION, POLO, STARTKARTE_ALLG, STARTKARTE_VOLTIGIEREN, STARTKARTE_WESTERN, STARTKARTE_ISLAND, STARTKARTE_FAHREN_JUGEND, STARTKARTE_HORSEBALL, STARTKARTE_POLO, PARAEQUESTRIAN, SONSTIGE }
|
||||
@Serializable
|
||||
enum class GeschlechtPferd { HENGST, STUTE, WALLACH, UNBEKANNT }
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package at.mocode.model.serializer
|
||||
|
||||
import com.ionspin.kotlin.bignum.decimal.BigDecimal
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
object BigDecimalSerializer : KSerializer<BigDecimal> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigDecimal", PrimitiveKind.STRING)
|
||||
override fun serialize(encoder: Encoder, value: BigDecimal) = encoder.encodeString(value.toStringExpanded())
|
||||
override fun deserialize(decoder: Decoder): BigDecimal = BigDecimal.parseString(decoder.decodeString())
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package at.mocode.model.serializer
|
||||
|
||||
import com.benasher44.uuid.Uuid
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.*
|
||||
|
||||
object JavaUUIDSerializer : KSerializer<Uuid> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("UUID", PrimitiveKind.STRING)
|
||||
override fun serialize(encoder: Encoder, value: Uuid) = encoder.encodeString(value.toString())
|
||||
override fun deserialize(decoder: Decoder): Uuid = Uuid.fromString(decoder.decodeString())
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package at.mocode.model.serializer
|
||||
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
object KotlinInstantSerializer : KSerializer<Instant> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("Instant", PrimitiveKind.STRING)
|
||||
override fun serialize(encoder: Encoder, value: Instant) = encoder.encodeString(value.toString())
|
||||
override fun deserialize(decoder: Decoder): Instant = Instant.parse(decoder.decodeString())
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package at.mocode.model.serializer
|
||||
|
||||
import kotlinx.datetime.LocalDate
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
object KotlinLocalDateSerializer : KSerializer<LocalDate> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("LocalDate", PrimitiveKind.STRING)
|
||||
override fun serialize(encoder: Encoder, value: LocalDate) = encoder.encodeString(value.toString())
|
||||
override fun deserialize(decoder: Decoder): LocalDate = LocalDate.parse(decoder.decodeString())
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package at.mocode.model.serializer
|
||||
|
||||
import kotlinx.datetime.LocalDateTime
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
object KotlinLocalDateTimeSerializer : KSerializer<LocalDateTime> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("LocalDateTime", PrimitiveKind.STRING)
|
||||
override fun serialize(encoder: Encoder, value: LocalDateTime) = encoder.encodeString(value.toString())
|
||||
override fun deserialize(decoder: Decoder): LocalDateTime = LocalDateTime.parse(decoder.decodeString())
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package at.mocode.model.stammdaten
|
||||
|
||||
import at.mocode.model.enums.LizenzTyp
|
||||
import at.mocode.model.enums.Sparte
|
||||
import at.mocode.model.serializer.KotlinLocalDateSerializer
|
||||
import kotlinx.datetime.LocalDate
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class LizenzInfo(
|
||||
val lizenzTyp: LizenzTyp,
|
||||
val stufe: String?,
|
||||
val sparte: Sparte?,
|
||||
val gueltigBisJahr: Int?, // Jahr als Int
|
||||
@Serializable(with = KotlinLocalDateSerializer::class)
|
||||
val ausgestelltAm: LocalDate?
|
||||
)
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package at.mocode.model.stammdaten
|
||||
|
||||
import at.mocode.model.enums.FunktionaerRolle
|
||||
import at.mocode.model.enums.Geschlecht
|
||||
import at.mocode.model.serializer.JavaUUIDSerializer
|
||||
import at.mocode.model.serializer.KotlinInstantSerializer
|
||||
import at.mocode.model.serializer.KotlinLocalDateSerializer
|
||||
import kotlinx.datetime.LocalDate
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Person(
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
val id: UUID = UUID.randomUUID(),
|
||||
var oepsSatzNr: String?,
|
||||
var nachname: String,
|
||||
var vorname: String,
|
||||
var titel: String?,
|
||||
@Serializable(with = KotlinLocalDateSerializer::class)
|
||||
var geburtsdatum: LocalDate?,
|
||||
var geschlecht: Geschlecht? = Geschlecht.UNBEKANNT,
|
||||
var nationalitaet: String?, // 3-Letter Code
|
||||
var email: String?,
|
||||
var telefon: String?,
|
||||
var adresse: String?,
|
||||
var plz: String?,
|
||||
var ort: String?,
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
var stammVereinId: UUID?, // FK zum Verein
|
||||
var mitgliedsNummerIntern: String?,
|
||||
var letzteZahlungJahr: Int?,
|
||||
var feiId: String?,
|
||||
var istGesperrt: Boolean = false,
|
||||
var sperrGrund: String?,
|
||||
var rollen: Set<FunktionaerRolle> = emptySet(),
|
||||
var lizenzen: List<LizenzInfo> = emptyList(),
|
||||
var qualifikationenRichter: List<String> = emptyList(),
|
||||
var qualifikationenParcoursbauer: List<String> = emptyList(),
|
||||
var istAktiv: Boolean = true,
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
val createdAt: Instant = Clock.System.now(),
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
var updatedAt: Instant = Clock.System.now()
|
||||
)
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package at.mocode.model.stammdaten
|
||||
|
||||
import at.mocode.model.enums.GeschlechtPferd
|
||||
import at.mocode.model.serializer.JavaUUIDSerializer
|
||||
import at.mocode.model.serializer.KotlinInstantSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Pferd(
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
val id: UUID = UUID.randomUUID(),
|
||||
var oepsKopfNr: String?,
|
||||
var oepsSatzNr: String?,
|
||||
var name: String,
|
||||
var lebensnummer: String?,
|
||||
var feiPassNr: String?,
|
||||
var geschlecht: GeschlechtPferd?,
|
||||
var geburtsjahr: Int?,
|
||||
var rasse: String?,
|
||||
var farbe: String?,
|
||||
var vaterName: String?,
|
||||
var mutterName: String?,
|
||||
var mutterVaterName: String?,
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
var besitzerId: UUID?, // FK Person
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
var verantwortlichePersonId: UUID?, // FK Person
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
var heimatVereinId: UUID?, // FK Verein
|
||||
var letzteZahlungJahrOeps: Int?,
|
||||
var stockmassCm: Int?,
|
||||
var istAktiv: Boolean = true,
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
val createdAt: Instant = Clock.System.now(),
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
var updatedAt: Instant = Clock.System.now()
|
||||
)
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package at.mocode.model.stammdaten
|
||||
|
||||
import at.mocode.model.serializer.JavaUUIDSerializer
|
||||
import at.mocode.model.serializer.KotlinInstantSerializer
|
||||
import com.benasher44.uuid.UUID
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Verein(
|
||||
@Serializable(with = JavaUUIDSerializer::class)
|
||||
val id: UUID = UUID.randomUUID(),
|
||||
var oepsVereinsNr: String,
|
||||
var name: String,
|
||||
var kuerzel: String?,
|
||||
var bundesland: String?,
|
||||
var adresse: String?,
|
||||
var plz: String?,
|
||||
var ort: String?,
|
||||
var email: String?,
|
||||
var telefon: String?,
|
||||
var webseite: String?,
|
||||
var istAktiv: Boolean = true,
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
val createdAt: Instant = Clock.System.now(),
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
var updatedAt: Instant = Clock.System.now()
|
||||
)
|
||||
22
shared/src/jvmMain/kotlin/at/mocode/model/JvmSerializer.kt
Normal file
22
shared/src/jvmMain/kotlin/at/mocode/model/JvmSerializer.kt
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package at.mocode.model
|
||||
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
import java.math.BigDecimal
|
||||
import java.util.*
|
||||
|
||||
object JavaUUIDSerializer : KSerializer<UUID> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("UUID", PrimitiveKind.STRING)
|
||||
override fun serialize(encoder: Encoder, value: UUID) = encoder.encodeString(value.toString())
|
||||
override fun deserialize(decoder: Decoder): UUID = UUID.fromString(decoder.decodeString())
|
||||
}
|
||||
|
||||
object BigDecimalSerializer : KSerializer<BigDecimal> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("BigDecimal", PrimitiveKind.STRING)
|
||||
override fun serialize(encoder: Encoder, value: BigDecimal) = encoder.encodeString(value.toPlainString())
|
||||
override fun deserialize(decoder: Decoder): BigDecimal = BigDecimal(decoder.decodeString())
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user