refactor(core): MP-25 Move User and AuthToken to core-domain
This commit is contained in:
parent
afd109efcc
commit
a8d99b5168
40
frontend/core/domain/build.gradle.kts
Normal file
40
frontend/core/domain/build.gradle.kts
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.kotlinMultiplatform)
|
||||||
|
alias(libs.plugins.kotlinSerialization)
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
val enableWasm = providers.gradleProperty("enableWasm").orNull == "true"
|
||||||
|
|
||||||
|
jvmToolchain(21)
|
||||||
|
|
||||||
|
jvm()
|
||||||
|
js {
|
||||||
|
browser {
|
||||||
|
testTask { enabled = false }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enableWasm) {
|
||||||
|
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
|
||||||
|
wasmJs { browser() }
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
commonMain.dependencies {
|
||||||
|
implementation(libs.kotlinx.serialization.json)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||||
|
compilerOptions {
|
||||||
|
jvmTarget.set(JvmTarget.JVM_21)
|
||||||
|
freeCompilerArgs.addAll("-opt-in=kotlin.RequiresOptIn")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package at.mocode.frontend.core.domain.models
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class AuthToken(
|
||||||
|
val accessToken: String,
|
||||||
|
val tokenType: String = "Bearer",
|
||||||
|
val expiresAtEpochMillis: Long? = null
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package at.mocode.frontend.core.domain.models
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class User(
|
||||||
|
val id: String,
|
||||||
|
val username: String,
|
||||||
|
val displayName: String? = null,
|
||||||
|
val roles: List<String> = emptyList()
|
||||||
|
)
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
package at.mocode.clients.authfeature
|
package at.mocode.clients.authfeature
|
||||||
|
|
||||||
import at.mocode.shared.core.AppConstants
|
import at.mocode.shared.core.AppConstants
|
||||||
|
import io.ktor.client.*
|
||||||
import io.ktor.client.call.*
|
import io.ktor.client.call.*
|
||||||
import io.ktor.client.request.forms.*
|
import io.ktor.client.request.forms.*
|
||||||
import io.ktor.http.*
|
import io.ktor.http.*
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import io.ktor.client.HttpClient
|
|
||||||
import org.koin.core.qualifier.named
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data classes for authentication API communication
|
* Data classes for authentication API communication
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ kotlin {
|
||||||
|
|
||||||
api(projects.core.coreUtils)
|
api(projects.core.coreUtils)
|
||||||
api(projects.core.coreDomain)
|
api(projects.core.coreDomain)
|
||||||
|
api(project(":frontend:core:domain"))
|
||||||
|
|
||||||
// Kotlinx core dependencies (coroutines, serialization, datetime)
|
// Kotlinx core dependencies (coroutines, serialization, datetime)
|
||||||
implementation(libs.bundles.kotlinx.core)
|
implementation(libs.bundles.kotlinx.core)
|
||||||
|
|
|
||||||
|
|
@ -39,21 +39,3 @@ data class PingData(
|
||||||
val service: String
|
val service: String
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
|
||||||
* Minimale User- und Auth-Models für Shared-Kernel (Quick-Fix für Build).
|
|
||||||
* Hinweis: Für MP-25 können diese in :frontend:core:domain verschoben/ausgebaut werden.
|
|
||||||
*/
|
|
||||||
@Serializable
|
|
||||||
data class AuthToken(
|
|
||||||
val accessToken: String,
|
|
||||||
val tokenType: String = "Bearer",
|
|
||||||
val expiresAtEpochMillis: Long? = null
|
|
||||||
)
|
|
||||||
|
|
||||||
@Serializable
|
|
||||||
data class User(
|
|
||||||
val id: String,
|
|
||||||
val username: String,
|
|
||||||
val displayName: String? = null,
|
|
||||||
val roles: List<String> = emptyList()
|
|
||||||
)
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package at.mocode.shared.presentation.actions
|
package at.mocode.shared.presentation.actions
|
||||||
|
|
||||||
import at.mocode.shared.presentation.state.Notification
|
import at.mocode.shared.presentation.state.Notification
|
||||||
import at.mocode.shared.domain.model.User
|
import at.mocode.frontend.core.domain.models.User
|
||||||
import at.mocode.shared.domain.model.AuthToken
|
import at.mocode.frontend.core.domain.models.AuthToken
|
||||||
|
|
||||||
sealed class AppAction {
|
sealed class AppAction {
|
||||||
// Auth Actions
|
// Auth Actions
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package at.mocode.shared.presentation.state
|
package at.mocode.shared.presentation.state
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import at.mocode.shared.domain.model.User
|
import at.mocode.frontend.core.domain.models.User
|
||||||
import at.mocode.shared.domain.model.AuthToken
|
import at.mocode.frontend.core.domain.models.AuthToken
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class AppState(
|
data class AppState(
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ include(":docs")
|
||||||
// FRONTEND
|
// FRONTEND
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// --- CORE ---
|
// --- CORE ---
|
||||||
|
include(":frontend:core:domain")
|
||||||
include(":frontend:core:design-system")
|
include(":frontend:core:design-system")
|
||||||
include(":frontend:core:navigation")
|
include(":frontend:core:navigation")
|
||||||
include(":frontend:core:network")
|
include(":frontend:core:network")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user