diff --git a/README_CONFIG.md b/README_CONFIG.md index 3183b930..054e7fe5 100644 --- a/README_CONFIG.md +++ b/README_CONFIG.md @@ -124,7 +124,7 @@ logging.responses=false Die Konfiguration wird über die zentrale `AppConfig`-Klasse bereitgestellt: ```kotlin -import at.mocode.shared.config.AppConfig +'import at.mocode.shared.config.AppConfig' // Verwendung der Konfiguration fun example() { diff --git a/api-gateway/src/jvmMain/kotlin/at/mocode/gateway/Application.kt b/api-gateway/src/jvmMain/kotlin/at/mocode/gateway/Application.kt index 40c89ee2..84e9627f 100644 --- a/api-gateway/src/jvmMain/kotlin/at/mocode/gateway/Application.kt +++ b/api-gateway/src/jvmMain/kotlin/at/mocode/gateway/Application.kt @@ -2,15 +2,9 @@ package at.mocode.gateway import at.mocode.gateway.config.MigrationSetup import at.mocode.shared.config.AppConfig -import at.mocode.shared.database.DatabaseConfig import at.mocode.shared.database.DatabaseFactory -import io.ktor.serialization.kotlinx.json.* -import io.ktor.server.application.* import io.ktor.server.engine.* import io.ktor.server.netty.* -import io.ktor.server.plugins.contentnegotiation.* -import io.ktor.server.response.* -import io.ktor.server.routing.* fun main() { // Konfiguration laden (wird automatisch beim ersten Zugriff auf AppConfig initialisiert) diff --git a/event-management/src/jvmMain/kotlin/at/mocode/events/infrastructure/repository/VeranstaltungRepositoryImpl.kt b/event-management/src/jvmMain/kotlin/at/mocode/events/infrastructure/repository/VeranstaltungRepositoryImpl.kt index c909764d..090b40b3 100644 --- a/event-management/src/jvmMain/kotlin/at/mocode/events/infrastructure/repository/VeranstaltungRepositoryImpl.kt +++ b/event-management/src/jvmMain/kotlin/at/mocode/events/infrastructure/repository/VeranstaltungRepositoryImpl.kt @@ -91,7 +91,7 @@ class VeranstaltungRepositoryImpl : VeranstaltungRepository { val now = Clock.System.now() val updatedVeranstaltung = veranstaltung.copy(updatedAt = now) - // Check if record exists + // Check if a record exists val existingRecord = VeranstaltungTable.selectAll() .where { VeranstaltungTable.id eq veranstaltung.veranstaltungId } .singleOrNull() @@ -103,7 +103,7 @@ class VeranstaltungRepositoryImpl : VeranstaltungRepository { } updatedVeranstaltung } else { - // Insert new record + // Insert a new record VeranstaltungTable.insert { it[id] = veranstaltung.veranstaltungId veranstaltungToStatement(it, updatedVeranstaltung) diff --git a/member-management/src/commonMain/kotlin/at/mocode/members/domain/service/UserAuthorizationService.kt b/member-management/src/commonMain/kotlin/at/mocode/members/domain/service/UserAuthorizationService.kt index 965c9b7c..e960c1e0 100644 --- a/member-management/src/commonMain/kotlin/at/mocode/members/domain/service/UserAuthorizationService.kt +++ b/member-management/src/commonMain/kotlin/at/mocode/members/domain/service/UserAuthorizationService.kt @@ -1,15 +1,9 @@ package at.mocode.members.domain.service -import at.mocode.members.domain.model.DomUser -import at.mocode.members.domain.repository.UserRepository -import at.mocode.members.domain.repository.PersonRolleRepository -import at.mocode.members.domain.repository.RolleRepository -import at.mocode.members.domain.repository.RolleBerechtigungRepository -import at.mocode.members.domain.repository.BerechtigungRepository -import at.mocode.enums.RolleE import at.mocode.enums.BerechtigungE +import at.mocode.enums.RolleE +import at.mocode.members.domain.repository.* import com.benasher44.uuid.Uuid -import kotlinx.datetime.LocalDate import kotlinx.datetime.Clock import kotlinx.datetime.TimeZone import kotlinx.datetime.todayIn @@ -44,16 +38,16 @@ class UserAuthorizationService( * Fetches complete authorization information for a user. * * @param userId The user ID - * @return UserAuthInfo if user exists and is active, null otherwise + * @return UserAuthInfo if the user exists and is active, null otherwise */ suspend fun getUserAuthInfo(userId: Uuid): UserAuthInfo? { // Get user val user = userRepository.findById(userId) ?: return null - // Check if user is active + // Check if the user is active if (!user.istAktiv) return null - // Check if user is locked + // Check if the user is locked val now = Clock.System.now() if (user.gesperrtBis != null && user.gesperrtBis!! > now) return null @@ -77,10 +71,10 @@ class UserAuthorizationService( * Fetches authorization information for a user by username or email. * * @param usernameOrEmail The username or email - * @return UserAuthInfo if user exists and is active, null otherwise + * @return UserAuthInfo if the user exists and is active, null otherwise */ suspend fun getUserAuthInfoByUsernameOrEmail(usernameOrEmail: String): UserAuthInfo? { - // Try to find user by username first + // Try to find the user by username first val user = userRepository.findByUsername(usernameOrEmail) ?: userRepository.findByEmail(usernameOrEmail) ?: return null @@ -152,7 +146,7 @@ class UserAuthorizationService( * * @param userId The user ID * @param role The role to check - * @return true if user has the role, false otherwise + * @return true if the user has the role, false otherwise */ suspend fun hasRole(userId: Uuid, role: RolleE): Boolean { val authInfo = getUserAuthInfo(userId) ?: return false @@ -164,7 +158,7 @@ class UserAuthorizationService( * * @param userId The user ID * @param permission The permission to check - * @return true if user has the permission, false otherwise + * @return true if the user has the permission, false otherwise */ suspend fun hasPermission(userId: Uuid, permission: BerechtigungE): Boolean { val authInfo = getUserAuthInfo(userId) ?: return false diff --git a/shared-kernel/src/jvmMain/kotlin/at/mocode/shared/config/AppEnvironment.kt b/shared-kernel/src/jvmMain/kotlin/at/mocode/shared/config/AppEnvironment.kt index 6c225ccb..4d5e5b82 100644 --- a/shared-kernel/src/jvmMain/kotlin/at/mocode/shared/config/AppEnvironment.kt +++ b/shared-kernel/src/jvmMain/kotlin/at/mocode/shared/config/AppEnvironment.kt @@ -19,7 +19,7 @@ enum class AppEnvironment { val envName = System.getenv("APP_ENV")?.uppercase() ?: "DEVELOPMENT" return try { valueOf(envName) - } catch (e: IllegalArgumentException) { + } catch (_: IllegalArgumentException) { println("Warnung: Unbekannte Umgebung '$envName', verwende DEVELOPMENT") DEVELOPMENT }