chore(turnier-feature): remove unused ViewModels and UI components

- Removed `AbteilungViewModel`, `BewerbAnlegenViewModel`, `BewerbViewModel`, and `CreateBewerbWizardScreen`.
- Cleaned up related imports and unused domain models.
This commit is contained in:
2026-04-13 14:38:12 +02:00
parent 5c7ba28b1e
commit f719764914
65 changed files with 989 additions and 157 deletions
@@ -13,6 +13,10 @@ version = "1.0.0"
kotlin {
jvm()
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
wasmJs {
browser()
}
sourceSets {
commonMain.dependencies {
@@ -0,0 +1,60 @@
package at.mocode.frontend.features.billing.data
import at.mocode.frontend.features.billing.domain.BillingRepository
import at.mocode.frontend.features.billing.domain.BuchungDto
import at.mocode.frontend.features.billing.domain.BuchungRequest
import at.mocode.frontend.features.billing.domain.TeilnehmerKontoDto
class FakeBillingRepository : BillingRepository {
private val konten = mutableListOf<TeilnehmerKontoDto>()
private val buchungen = mutableMapOf<String, MutableList<BuchungDto>>()
override suspend fun getOrCreateKonto(
veranstaltungId: String,
personId: String,
personName: String
): Result<TeilnehmerKontoDto> {
val existing = konten.find { it.personId == personId && it.veranstaltungId == veranstaltungId }
if (existing != null) return Result.success(existing)
val newKonto = TeilnehmerKontoDto(
id = "k_${konten.size + 1}",
veranstaltungId = veranstaltungId,
personId = personId,
personName = personName,
saldoCent = 0,
bemerkungen = null
)
konten.add(newKonto)
buchungen[newKonto.id] = mutableListOf()
return Result.success(newKonto)
}
override suspend fun getKonten(veranstaltungId: String): Result<List<TeilnehmerKontoDto>> {
return Result.success(konten.filter { it.veranstaltungId == veranstaltungId })
}
override suspend fun getBuchungen(kontoId: String): Result<List<BuchungDto>> {
return Result.success(buchungen[kontoId] ?: emptyList())
}
override suspend fun addBuchung(kontoId: String, request: BuchungRequest): Result<TeilnehmerKontoDto> {
val index = konten.indexOfFirst { it.id == kontoId }
if (index == -1) return Result.failure(Exception("Konto nicht gefunden"))
val konto = konten[index]
val newBuchung = BuchungDto(
id = "b_${(buchungen[kontoId]?.size ?: 0) + 1}",
kontoId = kontoId,
betragCent = request.betragCent,
verwendungszweck = request.verwendungszweck,
typ = request.typ,
gebuchtAm = "2026-04-13T14:30:00Z" // Statischer Zeitstempel für Offline-Betrieb
)
buchungen.getOrPut(kontoId) { mutableListOf() }.add(newBuchung)
val updatedKonto = konto.copy(saldoCent = konto.saldoCent + request.betragCent)
konten[index] = updatedKonto
return Result.success(updatedKonto)
}
}
@@ -1,6 +1,6 @@
package at.mocode.frontend.features.billing.di
import at.mocode.frontend.features.billing.data.DefaultBillingRepository
import at.mocode.frontend.features.billing.data.FakeBillingRepository
import at.mocode.frontend.features.billing.domain.BillingCalculator
import at.mocode.frontend.features.billing.domain.BillingRepository
import at.mocode.frontend.features.billing.presentation.BillingViewModel
@@ -8,6 +8,7 @@ import org.koin.dsl.module
val billingModule = module {
single { BillingCalculator() }
single<BillingRepository> { DefaultBillingRepository(get()) }
// Wir nutzen das Fake-Repository als Fallback für den Desktop/Startup-Mode
single<BillingRepository> { FakeBillingRepository() }
factory { BillingViewModel(get()) }
}
@@ -18,7 +18,8 @@ value class Money(val cents: Long) {
val absCents = if (negative) -cents else cents
val euros = absCents / 100
val rest = absCents % 100
return "%s%d,%02d €".format(if (negative) "-" else "", euros, rest)
val restStr = if (rest < 10) "0$rest" else "$rest"
return "${if (negative) "-" else ""}$euros,$restStr"
}
}
@@ -28,40 +28,56 @@ class BillingViewModel(
fun loadKonten(veranstaltungId: String) {
viewModelScope.launch {
_uiState.value = _uiState.value.copy(isLoading = true)
repository.getKonten(veranstaltungId)
.onSuccess { konten ->
_uiState.value = _uiState.value.copy(konten = konten, isLoading = false, error = null)
}
.onFailure {
_uiState.value = _uiState.value.copy(isLoading = false, error = it.message)
}
_uiState.value = _uiState.value.copy(isLoading = true, error = null)
try {
repository.getKonten(veranstaltungId)
.onSuccess { konten ->
_uiState.value = _uiState.value.copy(konten = konten, isLoading = false, error = null)
}
.onFailure {
_uiState.value = _uiState.value.copy(
isLoading = false,
error = "Fehler beim Laden der Konten: ${it.message ?: "Unbekannter Fehler"}"
)
}
} catch (e: Exception) {
_uiState.value = _uiState.value.copy(
isLoading = false,
error = "Kritischer Netzwerkfehler: ${e.message}"
)
}
}
}
fun loadKonto(veranstaltungId: String, personId: String, personName: String) {
viewModelScope.launch {
_uiState.value = _uiState.value.copy(isLoading = true)
_uiState.value = _uiState.value.copy(isLoading = true, error = null)
repository.getOrCreateKonto(veranstaltungId, personId, personName)
.onSuccess { konto ->
_uiState.value = _uiState.value.copy(selectedKonto = konto, error = null)
loadBuchungen(konto.id)
}
.onFailure {
_uiState.value = _uiState.value.copy(isLoading = false, error = it.message)
_uiState.value = _uiState.value.copy(
isLoading = false,
error = "Fehler beim Laden/Erstellen des Kontos: ${it.message ?: "Unbekannter Fehler"}"
)
}
}
}
private fun loadBuchungen(kontoId: String) {
viewModelScope.launch {
_uiState.value = _uiState.value.copy(isLoading = true)
_uiState.value = _uiState.value.copy(isLoading = true, error = null)
repository.getBuchungen(kontoId)
.onSuccess { buchungen ->
_uiState.value = _uiState.value.copy(buchungen = buchungen, isLoading = false, error = null)
}
.onFailure {
_uiState.value = _uiState.value.copy(isLoading = false, error = it.message)
_uiState.value = _uiState.value.copy(
isLoading = false,
error = "Fehler beim Laden der Buchungen: ${it.message ?: "Unbekannter Fehler"}"
)
}
}
}
@@ -69,15 +85,18 @@ class BillingViewModel(
fun buche(betragCent: Long, zweck: String, typ: String) {
val konto = _uiState.value.selectedKonto ?: return
viewModelScope.launch {
_uiState.value = _uiState.value.copy(isLoading = true)
_uiState.value = _uiState.value.copy(isLoading = true, error = null)
val request = BuchungRequest(betragCent = betragCent, verwendungszweck = zweck, typ = typ)
repository.addBuchung(konto.id, request)
.onSuccess { aktualisiertesKonto ->
_uiState.value = _uiState.value.copy(selectedKonto = aktualisiertesKonto)
_uiState.value = _uiState.value.copy(selectedKonto = aktualisiertesKonto, error = null)
loadBuchungen(konto.id)
}
.onFailure {
_uiState.value = _uiState.value.copy(isLoading = false, error = it.message)
_uiState.value = _uiState.value.copy(
isLoading = false,
error = "Fehler beim Buchen: ${it.message ?: "Unbekannter Fehler"}"
)
}
}
}