### feat: implementiere SQLite-Integration und Repository-Refactoring
Desktop CI — Headless Tests & Build / Compose Desktop — Tests (headless) & Build (push) Failing after 58s
Build and Publish Docker Images / build-and-push (., backend/infrastructure/gateway/Dockerfile, api-gateway, api-gateway) (push) Successful in 6m0s
Build and Publish Docker Images / build-and-push (., backend/services/ping/Dockerfile, ping-service, ping-service) (push) Successful in 6m10s
Build and Publish Docker Images / build-and-push (., config/docker/caddy/web-app/Dockerfile, web-app, web-app) (push) Failing after 2m0s
Build and Publish Docker Images / build-and-push (., config/docker/keycloak/Dockerfile, keycloak, keycloak) (push) Successful in 1m55s
Desktop CI — Headless Tests & Build / Compose Desktop — Tests (headless) & Build (push) Failing after 58s
Build and Publish Docker Images / build-and-push (., backend/infrastructure/gateway/Dockerfile, api-gateway, api-gateway) (push) Successful in 6m0s
Build and Publish Docker Images / build-and-push (., backend/services/ping/Dockerfile, ping-service, ping-service) (push) Successful in 6m10s
Build and Publish Docker Images / build-and-push (., config/docker/caddy/web-app/Dockerfile, web-app, web-app) (push) Failing after 2m0s
Build and Publish Docker Images / build-and-push (., config/docker/keycloak/Dockerfile, keycloak, keycloak) (push) Successful in 1m55s
- Erstelle Persistenz-Layer mit SQLite-Tabellen für `Verein` und `Reiter` inkl. Queries. - Entferne Mock-Daten in `ReiterViewModel` und nutze Repository-Injektion. - Integriere neue Tabellen und Queries im `DesktopMasterdataRepository`. - Erweitere `VeranstalterWizardViewModel` um lokale Suche mit SQLite-Queries. - Harmonisiere Feldnamen (`remoteReiterResults`) über alle Module hinweg. - Aktualisiere DI-Module (`VeranstalterModule`, `ReiterModule`, `DesktopModule`) mit SQLite-Injektionen. - Refaktor UI-Komponenten und Screens (`ReiterScreen`, `StammdatenImportScreen`) mit neuer Logik.
This commit is contained in:
@@ -28,6 +28,7 @@ kotlin {
|
||||
sourceSets {
|
||||
commonMain.dependencies {
|
||||
implementation(projects.frontend.features.vereinFeature)
|
||||
implementation(projects.frontend.core.localDb)
|
||||
implementation(projects.frontend.core.designSystem)
|
||||
implementation(projects.frontend.core.network)
|
||||
implementation(projects.frontend.core.domain)
|
||||
|
||||
+11
-1
@@ -1,5 +1,8 @@
|
||||
package at.mocode.frontend.features.veranstalter.di
|
||||
|
||||
import at.mocode.frontend.core.domain.repository.MasterdataRepository
|
||||
import at.mocode.frontend.core.domain.zns.ZnsImportProvider
|
||||
import at.mocode.frontend.core.localdb.AppDatabase
|
||||
import at.mocode.frontend.features.veranstalter.data.remote.FakeVeranstalterRepository
|
||||
import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository
|
||||
import at.mocode.frontend.features.veranstalter.presentation.VeranstalterDetailViewModel
|
||||
@@ -11,5 +14,12 @@ val veranstalterModule = module {
|
||||
single<VeranstalterRepository> { FakeVeranstalterRepository() }
|
||||
factory { VeranstalterViewModel(get()) }
|
||||
factory { VeranstalterDetailViewModel(get()) }
|
||||
factory { VeranstalterWizardViewModel(get(), get(), get()) }
|
||||
factory {
|
||||
VeranstalterWizardViewModel(
|
||||
repo = get<VeranstalterRepository>(),
|
||||
masterdataRepository = get<MasterdataRepository>(),
|
||||
znsImportProvider = get<ZnsImportProvider>(),
|
||||
db = get<AppDatabase>()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+42
-15
@@ -5,14 +5,12 @@ import at.mocode.frontend.core.domain.repository.MasterdataRepository
|
||||
import at.mocode.frontend.core.domain.zns.ZnsImportProvider
|
||||
import at.mocode.frontend.core.domain.zns.ZnsRemoteReiter
|
||||
import at.mocode.frontend.core.domain.zns.ZnsRemoteVerein
|
||||
import at.mocode.frontend.core.localdb.AppDatabase
|
||||
import at.mocode.frontend.features.veranstalter.domain.Veranstalter
|
||||
import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
data class VeranstalterWizardState(
|
||||
val isLoading: Boolean = false,
|
||||
@@ -63,8 +61,10 @@ sealed interface VeranstalterWizardIntent {
|
||||
class VeranstalterWizardViewModel(
|
||||
private val repo: VeranstalterRepository,
|
||||
private val masterdataRepository: MasterdataRepository,
|
||||
private val znsImportProvider: ZnsImportProvider
|
||||
private val znsImportProvider: ZnsImportProvider,
|
||||
private val db: AppDatabase
|
||||
) : ViewModel() {
|
||||
private val queries = db.meldestelleDbQueries
|
||||
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||
private val _state = MutableStateFlow(VeranstalterWizardState())
|
||||
val state: StateFlow<VeranstalterWizardState> = _state
|
||||
@@ -96,11 +96,22 @@ class VeranstalterWizardViewModel(
|
||||
}
|
||||
_state.value = _state.value.copy(isSearchingVerein = true)
|
||||
scope.launch {
|
||||
znsImportProvider.searchRemote(query)
|
||||
_state.value = _state.value.copy(
|
||||
isSearchingVerein = false,
|
||||
vereinSearchResults = znsImportProvider.state.remoteResults
|
||||
)
|
||||
val localResults = queries.searchVereine(query, query).executeAsList().map { v ->
|
||||
ZnsRemoteVerein(v.id.toString(), v.name, v.oebs_nummer, v.ort, v.bundesland)
|
||||
}
|
||||
|
||||
if (localResults.isNotEmpty()) {
|
||||
_state.value = _state.value.copy(
|
||||
isSearchingVerein = false,
|
||||
vereinSearchResults = localResults
|
||||
)
|
||||
} else {
|
||||
znsImportProvider.searchRemote(query)
|
||||
_state.value = _state.value.copy(
|
||||
isSearchingVerein = false,
|
||||
vereinSearchResults = znsImportProvider.state.remoteResults
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,11 +123,22 @@ class VeranstalterWizardViewModel(
|
||||
}
|
||||
_state.value = _state.value.copy(isSearchingReiter = true)
|
||||
scope.launch {
|
||||
znsImportProvider.searchRemote(query)
|
||||
_state.value = _state.value.copy(
|
||||
isSearchingReiter = false,
|
||||
reiterSearchResults = znsImportProvider.state.remoteReiter
|
||||
)
|
||||
val localResults = queries.searchReiter(query, query, query).executeAsList().map { r ->
|
||||
ZnsRemoteReiter(r.id.toString(), r.zns_nummer, r.nachname, r.vorname, null, "", r.nation, null)
|
||||
}
|
||||
|
||||
if (localResults.isNotEmpty()) {
|
||||
_state.value = _state.value.copy(
|
||||
isSearchingReiter = false,
|
||||
reiterSearchResults = localResults
|
||||
)
|
||||
} else {
|
||||
znsImportProvider.searchRemote(query)
|
||||
_state.value = _state.value.copy(
|
||||
isSearchingReiter = false,
|
||||
reiterSearchResults = znsImportProvider.state.remoteReiterResults
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,4 +233,9 @@ class VeranstalterWizardViewModel(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
scope.cancel()
|
||||
super.onCleared()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user