Add microservices for masterdata, events, and ZNS import; configure API gateway routes; implement real Turnier and Verein repository integrations; and update infrastructure, frontend, and documentation.
This commit is contained in:
+21
-13
@@ -1,5 +1,7 @@
|
||||
package at.mocode.turnier.feature.presentation
|
||||
|
||||
import at.mocode.turnier.feature.domain.Turnier
|
||||
import at.mocode.turnier.feature.domain.TurnierRepository
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
@@ -34,11 +36,6 @@ sealed interface TurnierIntent {
|
||||
data object ClearError : TurnierIntent
|
||||
}
|
||||
|
||||
interface TurnierRepository {
|
||||
suspend fun list(): List<TurnierListItem>
|
||||
// Platzhalter für B-2: suspend fun get(id: Long): TurnierDetail
|
||||
}
|
||||
|
||||
class TurnierViewModel(
|
||||
private val repo: TurnierRepository,
|
||||
) {
|
||||
@@ -64,18 +61,29 @@ class TurnierViewModel(
|
||||
private fun load() {
|
||||
reduce { it.copy(isLoading = true, errorMessage = null) }
|
||||
scope.launch {
|
||||
try {
|
||||
val items = repo.list()
|
||||
reduce { cur ->
|
||||
val filtered = filterList(items, cur.searchQuery)
|
||||
cur.copy(isLoading = false, list = items, filtered = filtered)
|
||||
repo.list()
|
||||
.onSuccess { list ->
|
||||
val items = list.map { it.toListItem() }
|
||||
reduce { cur ->
|
||||
val filtered = filterList(items, cur.searchQuery)
|
||||
cur.copy(isLoading = false, list = items, filtered = filtered)
|
||||
}
|
||||
}
|
||||
.onFailure { t ->
|
||||
reduce { it.copy(isLoading = false, errorMessage = t.message ?: "Fehler beim Laden") }
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
reduce { it.copy(isLoading = false, errorMessage = t.message ?: "Unbekannter Fehler beim Laden") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Turnier.toListItem() = TurnierListItem(
|
||||
id = id,
|
||||
name = name,
|
||||
ort = "Stadl-Paura", // Platzhalter bis API erweitert
|
||||
startDatum = "2026-05-01",
|
||||
endDatum = "2026-05-03",
|
||||
status = "AKTIV"
|
||||
)
|
||||
|
||||
private fun filter() {
|
||||
val cur = _state.value
|
||||
val filtered = filterList(cur.list, cur.searchQuery)
|
||||
|
||||
Reference in New Issue
Block a user