fixing Frontend und libs.versions.toml
This commit is contained in:
@@ -21,12 +21,20 @@ kotlin {
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
// Opt-in to experimental Kotlin UUID API across all source sets
|
||||
all {
|
||||
languageSettings.optIn("kotlin.uuid.ExperimentalUuidApi")
|
||||
}
|
||||
|
||||
commonMain.dependencies {
|
||||
// Core dependencies (that aren't included in platform-dependencies)
|
||||
api(libs.uuid)
|
||||
api(projects.core.coreUtils)
|
||||
api(projects.core.coreDomain)
|
||||
|
||||
// Serialization and date-time for commonMain
|
||||
api(libs.kotlinx.serialization.json)
|
||||
api(libs.kotlinx.datetime)
|
||||
|
||||
}
|
||||
|
||||
commonTest.dependencies {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
package at.mocode.core.domain.event
|
||||
|
||||
import at.mocode.core.domain.model.*
|
||||
import at.mocode.core.domain.serialization.KotlinInstantSerializer
|
||||
import com.benasher44.uuid.uuid4
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.time.Clock
|
||||
import kotlin.time.ExperimentalTime
|
||||
import kotlin.time.Instant
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
/**
|
||||
* Basis-Interface für alle Domain-Events im System.
|
||||
@@ -32,7 +33,7 @@ abstract class BaseDomainEvent(
|
||||
override val aggregateId: AggregateId,
|
||||
override val eventType: EventType,
|
||||
override val version: EventVersion,
|
||||
override val eventId: EventId = EventId(uuid4()),
|
||||
override val eventId: EventId = EventId(Uuid.random()),
|
||||
@Serializable(with = KotlinInstantSerializer::class)
|
||||
override val timestamp: Instant,
|
||||
override val correlationId: CorrelationId? = null,
|
||||
@@ -43,7 +44,7 @@ abstract class BaseDomainEvent(
|
||||
aggregateId: AggregateId,
|
||||
eventType: EventType,
|
||||
version: EventVersion,
|
||||
eventId: EventId = EventId(uuid4()),
|
||||
eventId: EventId = EventId(Uuid.random()),
|
||||
correlationId: CorrelationId? = null,
|
||||
causationId: CausationId? = null
|
||||
) : this(
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
package at.mocode.core.domain.model
|
||||
|
||||
import at.mocode.core.domain.serialization.UuidSerializer
|
||||
import com.benasher44.uuid.Uuid
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.jvm.JvmInline
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
/**
|
||||
* Value-Classes für stark typisierte IDs und Fachwerte.
|
||||
|
||||
+4
-3
@@ -1,7 +1,5 @@
|
||||
package at.mocode.core.domain.serialization
|
||||
|
||||
import com.benasher44.uuid.Uuid
|
||||
import com.benasher44.uuid.uuidFrom
|
||||
import kotlinx.datetime.LocalDate
|
||||
import kotlinx.datetime.LocalDateTime
|
||||
import kotlinx.datetime.LocalTime
|
||||
@@ -13,6 +11,8 @@ import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
import kotlin.time.ExperimentalTime
|
||||
import kotlin.time.Instant
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
/**
|
||||
* Serializer für kotlin.time. Instant Objekte.
|
||||
@@ -35,6 +35,7 @@ object KotlinInstantSerializer : KSerializer<Instant> {
|
||||
* Serializer für UUID Objekte.
|
||||
* Konvertiert UUID zu/von String-Repräsentation.
|
||||
*/
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
object UuidSerializer : KSerializer<Uuid> {
|
||||
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("UUID", PrimitiveKind.STRING)
|
||||
|
||||
@@ -43,7 +44,7 @@ object UuidSerializer : KSerializer<Uuid> {
|
||||
}
|
||||
|
||||
override fun deserialize(decoder: Decoder): Uuid {
|
||||
return uuidFrom(decoder.decodeString())
|
||||
return Uuid.parse(decoder.decodeString())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
@file:OptIn(kotlin.uuid.ExperimentalUuidApi::class)
|
||||
package at.mocode.core.utils
|
||||
|
||||
import at.mocode.core.domain.model.*
|
||||
import com.benasher44.uuid.uuid4
|
||||
import kotlin.time.Clock
|
||||
import kotlin.time.ExperimentalTime
|
||||
import kotlin.time.Instant
|
||||
import kotlin.time.Clock
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
/**
|
||||
* Extension-Funktionen für häufig verwendete Operationen im gesamten System.
|
||||
@@ -15,27 +16,27 @@ import kotlin.time.Clock
|
||||
/**
|
||||
* Erstellt eine neue EntityId mit einer zufälligen UUID.
|
||||
*/
|
||||
fun EntityId.Companion.random(): EntityId = EntityId(uuid4())
|
||||
fun EntityId.Companion.random(): EntityId = EntityId(Uuid.random())
|
||||
|
||||
/**
|
||||
* Erstellt eine neue EventId mit einer zufälligen UUID.
|
||||
*/
|
||||
fun EventId.Companion.random(): EventId = EventId(uuid4())
|
||||
fun EventId.Companion.random(): EventId = EventId(Uuid.random())
|
||||
|
||||
/**
|
||||
* Erstellt eine neue AggregateId mit einer zufälligen UUID.
|
||||
*/
|
||||
fun AggregateId.Companion.random(): AggregateId = AggregateId(uuid4())
|
||||
fun AggregateId.Companion.random(): AggregateId = AggregateId(Uuid.random())
|
||||
|
||||
/**
|
||||
* Erstellt eine neue CorrelationId mit einer zufälligen UUID.
|
||||
*/
|
||||
fun CorrelationId.Companion.random(): CorrelationId = CorrelationId(uuid4())
|
||||
fun CorrelationId.Companion.random(): CorrelationId = CorrelationId(Uuid.random())
|
||||
|
||||
/**
|
||||
* Erstellt eine neue CausationId mit einer zufälligen UUID.
|
||||
*/
|
||||
fun CausationId.Companion.random(): CausationId = CausationId(uuid4())
|
||||
fun CausationId.Companion.random(): CausationId = CausationId(Uuid.random())
|
||||
|
||||
// === String Extensions ===
|
||||
|
||||
|
||||
Reference in New Issue
Block a user