Refactor DefaultVeranstalterRepository to use exception classes instead of objects. Clean up unused imports in VeranstalterModule and VeranstalterAuswahlV2.
Desktop CI — Headless Tests & Build / Compose Desktop — Tests (headless) & Build (push) Has been cancelled
Build and Publish Docker Images / build-and-push (., backend/infrastructure/gateway/Dockerfile, api-gateway, api-gateway) (push) Has been cancelled
Build and Publish Docker Images / build-and-push (., backend/services/ping/Dockerfile, ping-service, ping-service) (push) Has been cancelled
Build and Publish Docker Images / build-and-push (., config/docker/caddy/web-app/Dockerfile, web-app, web-app) (push) Has been cancelled
Build and Publish Docker Images / build-and-push (., config/docker/keycloak/Dockerfile, keycloak, keycloak) (push) Has been cancelled
Desktop CI — Headless Tests & Build / Compose Desktop — Tests (headless) & Build (push) Has been cancelled
Build and Publish Docker Images / build-and-push (., backend/infrastructure/gateway/Dockerfile, api-gateway, api-gateway) (push) Has been cancelled
Build and Publish Docker Images / build-and-push (., backend/services/ping/Dockerfile, ping-service, ping-service) (push) Has been cancelled
Build and Publish Docker Images / build-and-push (., config/docker/caddy/web-app/Dockerfile, web-app, web-app) (push) Has been cancelled
Build and Publish Docker Images / build-and-push (., config/docker/keycloak/Dockerfile, keycloak, keycloak) (push) Has been cancelled
This commit is contained in:
+19
-19
@@ -19,9 +19,9 @@ class DefaultVeranstalterRepository(
|
|||||||
val response = client.get(ApiRoutes.Veranstalter.ROOT)
|
val response = client.get(ApiRoutes.Veranstalter.ROOT)
|
||||||
when {
|
when {
|
||||||
response.status.isSuccess() -> response.body<List<VeranstalterDto>>().map { it.toDomain() }
|
response.status.isSuccess() -> response.body<List<VeranstalterDto>>().map { it.toDomain() }
|
||||||
response.status == HttpStatusCode.Unauthorized -> throw AuthExpired
|
response.status == HttpStatusCode.Unauthorized -> throw AuthExpired()
|
||||||
response.status == HttpStatusCode.Forbidden -> throw AuthForbidden
|
response.status == HttpStatusCode.Forbidden -> throw AuthForbidden()
|
||||||
response.status.value >= 500 -> throw ServerError
|
response.status.value >= 500 -> throw ServerError()
|
||||||
else -> throw HttpError(response.status.value)
|
else -> throw HttpError(response.status.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -30,10 +30,10 @@ class DefaultVeranstalterRepository(
|
|||||||
val response = client.get("${ApiRoutes.Veranstalter.ROOT}/$id")
|
val response = client.get("${ApiRoutes.Veranstalter.ROOT}/$id")
|
||||||
when {
|
when {
|
||||||
response.status.isSuccess() -> response.body<VeranstalterDto>().toDomain()
|
response.status.isSuccess() -> response.body<VeranstalterDto>().toDomain()
|
||||||
response.status == HttpStatusCode.NotFound -> throw NotFound
|
response.status == HttpStatusCode.NotFound -> throw NotFound()
|
||||||
response.status == HttpStatusCode.Unauthorized -> throw AuthExpired
|
response.status == HttpStatusCode.Unauthorized -> throw AuthExpired()
|
||||||
response.status == HttpStatusCode.Forbidden -> throw AuthForbidden
|
response.status == HttpStatusCode.Forbidden -> throw AuthForbidden()
|
||||||
response.status.value >= 500 -> throw ServerError
|
response.status.value >= 500 -> throw ServerError()
|
||||||
else -> throw HttpError(response.status.value)
|
else -> throw HttpError(response.status.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,8 +42,8 @@ class DefaultVeranstalterRepository(
|
|||||||
val response = client.post(ApiRoutes.Veranstalter.ROOT) { setBody(model.toDto()) }
|
val response = client.post(ApiRoutes.Veranstalter.ROOT) { setBody(model.toDto()) }
|
||||||
when {
|
when {
|
||||||
response.status.isSuccess() -> response.body<VeranstalterDto>().toDomain()
|
response.status.isSuccess() -> response.body<VeranstalterDto>().toDomain()
|
||||||
response.status == HttpStatusCode.Conflict -> throw Conflict
|
response.status == HttpStatusCode.Conflict -> throw Conflict()
|
||||||
response.status.value >= 500 -> throw ServerError
|
response.status.value >= 500 -> throw ServerError()
|
||||||
else -> throw HttpError(response.status.value)
|
else -> throw HttpError(response.status.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,9 +52,9 @@ class DefaultVeranstalterRepository(
|
|||||||
val response = client.put("${ApiRoutes.Veranstalter.ROOT}/$id") { setBody(model.toDto()) }
|
val response = client.put("${ApiRoutes.Veranstalter.ROOT}/$id") { setBody(model.toDto()) }
|
||||||
when {
|
when {
|
||||||
response.status.isSuccess() -> response.body<VeranstalterDto>().toDomain()
|
response.status.isSuccess() -> response.body<VeranstalterDto>().toDomain()
|
||||||
response.status == HttpStatusCode.NotFound -> throw NotFound
|
response.status == HttpStatusCode.NotFound -> throw NotFound()
|
||||||
response.status == HttpStatusCode.Conflict -> throw Conflict
|
response.status == HttpStatusCode.Conflict -> throw Conflict()
|
||||||
response.status.value >= 500 -> throw ServerError
|
response.status.value >= 500 -> throw ServerError()
|
||||||
else -> throw HttpError(response.status.value)
|
else -> throw HttpError(response.status.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,17 +63,17 @@ class DefaultVeranstalterRepository(
|
|||||||
val response = client.delete("${ApiRoutes.Veranstalter.ROOT}/$id")
|
val response = client.delete("${ApiRoutes.Veranstalter.ROOT}/$id")
|
||||||
when {
|
when {
|
||||||
response.status.isSuccess() -> Unit
|
response.status.isSuccess() -> Unit
|
||||||
response.status == HttpStatusCode.NotFound -> throw NotFound
|
response.status == HttpStatusCode.NotFound -> throw NotFound()
|
||||||
response.status.value >= 500 -> throw ServerError
|
response.status.value >= 500 -> throw ServerError()
|
||||||
else -> throw HttpError(response.status.value)
|
else -> throw HttpError(response.status.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fehler-Typen (vereinfachtes DomainError-Äquivalent)
|
// Fehler-Typen (vereinfachtes DomainError-Äquivalent)
|
||||||
object AuthExpired : RuntimeException("AUTH_EXPIRED")
|
class AuthExpired : RuntimeException("AUTH_EXPIRED")
|
||||||
object AuthForbidden : RuntimeException("AUTH_FORBIDDEN")
|
class AuthForbidden : RuntimeException("AUTH_FORBIDDEN")
|
||||||
object NotFound : RuntimeException("NOT_FOUND")
|
class NotFound : RuntimeException("NOT_FOUND")
|
||||||
object Conflict : RuntimeException("CONFLICT")
|
class Conflict : RuntimeException("CONFLICT")
|
||||||
object ServerError : RuntimeException("SERVER_ERROR")
|
class ServerError : RuntimeException("SERVER_ERROR")
|
||||||
class HttpError(val code: Int) : RuntimeException("HTTP_$code")
|
class HttpError(val code: Int) : RuntimeException("HTTP_$code")
|
||||||
|
|||||||
-1
@@ -2,7 +2,6 @@ package at.mocode.frontend.features.veranstalter.di
|
|||||||
|
|
||||||
import at.mocode.frontend.features.veranstalter.data.remote.DefaultVeranstalterRepository
|
import at.mocode.frontend.features.veranstalter.data.remote.DefaultVeranstalterRepository
|
||||||
import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository
|
import at.mocode.frontend.features.veranstalter.domain.VeranstalterRepository
|
||||||
import io.ktor.client.HttpClient
|
|
||||||
import org.koin.core.qualifier.named
|
import org.koin.core.qualifier.named
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
|
|||||||
-1
@@ -9,7 +9,6 @@ import androidx.compose.foundation.lazy.items
|
|||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.ArrowForward
|
import androidx.compose.material.icons.automirrored.filled.ArrowForward
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material.icons.filled.ArrowForward
|
|
||||||
import androidx.compose.material.icons.filled.Close
|
import androidx.compose.material.icons.filled.Close
|
||||||
import androidx.compose.material.icons.filled.Search
|
import androidx.compose.material.icons.filled.Search
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
|
|||||||
Reference in New Issue
Block a user