Update billing-service and series-service: refine frontend API integration, stabilize JPA entities, add Flyway migrations, and enhance roadmap documentation.
This commit is contained in:
+6
@@ -23,6 +23,12 @@ class DefaultBillingRepository(
|
||||
}.body()
|
||||
}
|
||||
|
||||
override suspend fun getKonten(veranstaltungId: String): Result<List<TeilnehmerKontoDto>> = runCatching {
|
||||
client.get(ApiRoutes.Billing.KONTEN) {
|
||||
parameter("veranstaltungId", veranstaltungId)
|
||||
}.body()
|
||||
}
|
||||
|
||||
override suspend fun getBuchungen(kontoId: String): Result<List<BuchungDto>> = runCatching {
|
||||
client.get(ApiRoutes.Billing.buchungen(kontoId)).body()
|
||||
}
|
||||
|
||||
+5
@@ -12,6 +12,11 @@ interface BillingRepository {
|
||||
personName: String = "Unbekannt"
|
||||
): Result<TeilnehmerKontoDto>
|
||||
|
||||
/**
|
||||
* Holt alle Teilnehmer-Konten für eine Veranstaltung.
|
||||
*/
|
||||
suspend fun getKonten(veranstaltungId: String): Result<List<TeilnehmerKontoDto>>
|
||||
|
||||
/**
|
||||
* Holt die Buchungshistorie für ein bestimmtes Konto.
|
||||
*/
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ fun BillingScreen(
|
||||
var showBuchungsDialog by remember { mutableStateOf(false) }
|
||||
|
||||
LaunchedEffect(veranstaltungId) {
|
||||
viewModel.loadKonten(veranstaltungId)
|
||||
viewModel.loadKonten(veranstaltungId.toString())
|
||||
}
|
||||
|
||||
Column(modifier = Modifier.fillMaxSize().padding(16.dp)) {
|
||||
@@ -40,7 +40,7 @@ fun BillingScreen(
|
||||
Spacer(Modifier.width(8.dp))
|
||||
Text("Teilnehmer-Abrechnung", style = MaterialTheme.typography.headlineSmall)
|
||||
Spacer(Modifier.weight(1f))
|
||||
IconButton(onClick = { viewModel.loadKonten(veranstaltungId) }) {
|
||||
IconButton(onClick = { viewModel.loadKonten(veranstaltungId.toString()) }) {
|
||||
Icon(Icons.Default.Refresh, contentDescription = "Aktualisieren")
|
||||
}
|
||||
}
|
||||
|
||||
+17
-2
@@ -2,12 +2,14 @@ package at.mocode.frontend.features.billing.presentation
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import at.mocode.frontend.features.billing.domain.*
|
||||
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
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
import kotlin.uuid.Uuid
|
||||
|
||||
data class BillingUiState(
|
||||
val isLoading: Boolean = false,
|
||||
@@ -24,6 +26,19 @@ class BillingViewModel(
|
||||
private val _uiState = MutableStateFlow(BillingUiState())
|
||||
val uiState = _uiState.asStateFlow()
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun loadKonto(veranstaltungId: String, personId: String, personName: String) {
|
||||
viewModelScope.launch {
|
||||
_uiState.value = _uiState.value.copy(isLoading = true)
|
||||
|
||||
Reference in New Issue
Block a user