chore: fix broken links in documentation, improve code snippets, and remove unnecessary imports in guides

This commit is contained in:
Stefan Mogeritsch 2026-03-15 20:05:23 +01:00
parent daeae0f868
commit 5f6114450d
6 changed files with 20 additions and 88 deletions

View File

@ -138,10 +138,6 @@ FROM User;
In `shared/src/commonMain/kotlin/database/DatabaseDriverFactory.kt`:
```kotlin
package com.example.database
import app.cash.sqldelight.db.SqlDriver
expect class DatabaseDriverFactory {
fun createDriver(): SqlDriver
}
@ -154,12 +150,6 @@ expect class DatabaseDriverFactory {
`shared/src/androidMain/kotlin/database/DatabaseDriverFactory.android.kt`:
```kotlin
package com.example.database
import android.content.Context
import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.android.AndroidSqliteDriver
actual class DatabaseDriverFactory(private val context: Context) {
actual fun createDriver(): SqlDriver {
return AndroidSqliteDriver(
@ -176,11 +166,6 @@ actual class DatabaseDriverFactory(private val context: Context) {
`shared/src/iosMain/kotlin/database/DatabaseDriverFactory.ios.kt`:
```kotlin
package com.example.database
import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.native.NativeSqliteDriver
actual class DatabaseDriverFactory {
actual fun createDriver(): SqlDriver {
return NativeSqliteDriver(
@ -197,11 +182,6 @@ actual class DatabaseDriverFactory {
`shared/src/desktopMain/kotlin/database/DatabaseDriverFactory.desktop.kt`:
```kotlin
package com.example.database
import app.cash.sqldelight.db.SqlDriver
import app.cash.sqldelight.driver.jdbc.sqlite.JdbcSqliteDriver
actual class DatabaseDriverFactory {
actual fun createDriver(): SqlDriver {
val driver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
@ -217,14 +197,6 @@ actual class DatabaseDriverFactory {
In `shared/src/commonMain/kotlin/repository/UserRepository.kt`:
```kotlin
package com.example.repository
import com.example.database.AppDatabase
import com.example.database.User
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO
import kotlinx.coroutines.withContext
class UserRepository(private val database: AppDatabase) {
private val queries = database.userQueries
@ -261,13 +233,6 @@ class UserRepository(private val database: AppDatabase) {
In `shared/src/commonMain/kotlin/di/DatabaseModule.kt`:
```kotlin
package com.example.di
import com.example.database.AppDatabase
import com.example.database.DatabaseDriverFactory
import com.example.repository.UserRepository
import org.koin.dsl.module
val databaseModule = module {
single { DatabaseDriverFactory() }
single { AppDatabase(get<DatabaseDriverFactory>().createDriver()) }
@ -283,12 +248,6 @@ val databaseModule = module {
`shared/src/androidMain/kotlin/di/PlatformModule.android.kt`:
```kotlin
package com.example.di
import com.example.database.DatabaseDriverFactory
import org.koin.android.ext.koin.androidContext
import org.koin.dsl.module
actual val platformModule = module {
single { DatabaseDriverFactory(androidContext()) }
}
@ -300,11 +259,6 @@ actual val platformModule = module {
`shared/src/iosMain/kotlin/di/PlatformModule.ios.kt`:
```kotlin
package com.example.di
import com.example.database.DatabaseDriverFactory
import org.koin.dsl.module
actual val platformModule = module {
single { DatabaseDriverFactory() }
}
@ -316,11 +270,6 @@ actual val platformModule = module {
`shared/src/desktopMain/kotlin/di/PlatformModule.desktop.kt`:
```kotlin
package com.example.di
import com.example.database.DatabaseDriverFactory
import org.koin.dsl.module
actual val platformModule = module {
single { DatabaseDriverFactory() }
}
@ -332,10 +281,6 @@ actual val platformModule = module {
`shared/src/commonMain/kotlin/di/PlatformModule.kt`:
```kotlin
package com.example.di
import org.koin.core.module.Module
expect val platformModule: Module
```
@ -345,11 +290,6 @@ expect val platformModule: Module
In `shared/src/commonMain/kotlin/di/KoinInit.kt`:
```kotlin
package com.example.di
import org.koin.core.context.startKoin
import org.koin.dsl.KoinAppDeclaration
fun initKoin(appDeclaration: KoinAppDeclaration = {}) = startKoin {
appDeclaration()
modules(
@ -388,9 +328,6 @@ class MainActivity : ComponentActivity() {
In `iosApp/iosApp/iOSApp.swift`:
```kotlin
import SwiftUI
import shared
@main
struct iOSApp : App {
@ -431,17 +368,6 @@ fun main() {
In `shared/src/commonMain/kotlin/viewmodel/UserViewModel.kt`:
```kotlin
package com.example.viewmodel
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.database.User
import com.example.repository.UserRepository
import kotlinx.coroutines.launch
class UserViewModel(private val userRepository: UserRepository) : ViewModel() {
var users by mutableStateOf<List<User>>(emptyList())

View File

@ -39,8 +39,6 @@ Anstatt die Datenbank direkt beim App-Start zu initialisieren (was im Web blocki
**Datei:** `shared/src/commonMain/kotlin/.../DatabaseDriverFactory.kt`
```kotlin
import app.cash.sqldelight.db.SqlDriver
interface DatabaseDriverFactory {
suspend fun createDriver(): SqlDriver
}
@ -54,9 +52,6 @@ Diese Komponente löst das Problem des Nutzers, indem sie die Initialisierung bi
**Datei:** `shared/src/commonMain/kotlin/.../DatabaseWrapper.kt`
```kotlin
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
class DatabaseWrapper(private val driverFactory: DatabaseDriverFactory) {
private var _database: AppDatabase? = null
private val mutex = Mutex()
@ -87,9 +82,6 @@ Hier liegt der Kern der Lösung: Wir warten explizit auf die Schema-Erstellung (
**Datei:** `shared/src/jsMain/kotlin/.../WebDatabaseDriverFactory.kt`
```kotlin
import app.cash.sqldelight.driver.worker.WebWorkerDriver
import org.w3c.dom.Worker
class WebDatabaseDriverFactory : DatabaseDriverFactory {
override suspend fun createDriver(): SqlDriver {
val worker = Worker(

View File

@ -27,7 +27,7 @@ Nutze immer `transactionResult` (oder die Aliase `readTransaction` / `writeTrans
fun findUser(id: UUID): Result<User> = readTransaction {
// 'this' ist hier eine JdbcTransaction
UserTable.select { UserTable.id eq id }
.map { ... }
.map { /* row -> User(...) */ }
.singleOrNull()
}
```
@ -40,7 +40,7 @@ Vermeide rohes SQL, wo immer möglich. Wenn es sein muss (z.B. für Performance-
* **`exec`:** Nutze immer `explicitStatementType`.
```kotlin
this.exec("SELECT 1", explicitStatementType = StatementType.SELECT) { rs -> ... }
this.exec("SELECT 1", explicitStatementType = StatementType.SELECT) { rs -> /* handle ResultSet */ }
```
* **`executeUpdate`:** Nutze die Helper-Methode `DatabaseUtils.executeUpdate`, da sie sich um das korrekte Schließen von Statements kümmert (Exposed `PreparedStatementApi` ist nicht `AutoCloseable`).

View File

@ -15,5 +15,5 @@ Dieses Verzeichnis enthält die spezifische Dokumentation für alle Backend-Komp
## Wichtige Einstiegspunkte
* **[Ping-Service](./Services/ping-service.md):** Dient als technischer Blueprint und einfachstes Beispiel für einen Service.
* **[Ping-Service](./Services/PingService_Reference.md):** Dient als technischer Blueprint und einfachstes Beispiel für einen Service.
* **[API-Gateway](../07_Infrastructure/api-gateway.md):** Beschreibung des zentralen Einstiegspunkts für alle externen Anfragen.

View File

@ -10,7 +10,7 @@ context: Operation Tracer Bullet (Phase 1)
# Arbeitsanweisung: Infrastructure Hardening & Security Implementation
**Ziel:** Finalisierung der Backend-Infrastruktur-Module und Härtung des `ping-service` gemäß [ADR 001](../01_Architecture/adr/001-backend-infrastructure-decisions.md).
**Ziel:** Finalisierung der Backend-Infrastruktur-Module und Härtung des `ping-service` gemäß [ADR 001](../../01_Architecture/adr/001-backend-infrastructure-decisions.md).
---
@ -76,5 +76,5 @@ Mache den Service "Production Ready."
---
**Referenzen:**
* [ADR 001: Backend Infrastructure Decisions](../01_Architecture/adr/001-backend-infrastructure-decisions.md)
* [Master Roadmap Q1 2026](../01_Architecture/MASTER_ROADMAP_2026_Q1.md)
* [ADR 001: Backend Infrastructure Decisions](../../01_Architecture/adr/001-backend-infrastructure-decisions.md)
* [Master Roadmap Q1 2026](../../01_Architecture/_archive/2026-03-15_MASTER_ROADMAP_2026_Q1.md)

View File

@ -79,6 +79,20 @@ Folgende aktive Dokumente hatten kein `last_update`-Feld im Frontmatter:
---
## 🛠️ Nachbesserungen (Session 2, 20:02 Uhr)
Auf Basis von IDE-Warnings/Errors wurden folgende Korrekturen durchgeführt:
| Datei | Problem | Fix |
|---|---|---|
| `05_Backend/_archive/2026-03-15_TASK_...Hardening.md` | Broken Links (falsche relative Pfade nach Archivierung) | Pfade auf `../../01_Architecture/...` korrigiert; Roadmap-Link auf archivierte Version |
| `05_Backend/README.md` | `ping-service.md` existiert nicht | Link auf `PingService_Reference.md` korrigiert |
| `05_Backend/Guides/Database_Best_Practices.md` | `...` in Kotlin-Code-Blöcken → "Expecting an element" | Durch Kommentare ersetzt |
| `02_Guides/SQLDelight_Integration_Compose_Multiplatform.md` | `package`/`import`-Direktiven in Code-Fragmenten → IDE-Fehler | Alle `package`- und `import`-Zeilen aus Kotlin-Blöcken entfernt |
| `02_Guides/SQLDelight_Web_Asynchron.md` | `package`/`import`-Direktiven in Code-Fragmenten → IDE-Fehler | Alle `package`- und `import`-Zeilen aus Kotlin-Blöcken entfernt |
---
## 🔗 Offene Punkte / Empfehlungen
- **Domain-Analyse-Docs** (`docs/03_Domain/03_Analysis/`) haben noch kein `last_update` — diese sind DRAFT und sollten beim nächsten Domain-Workshop aktualisiert werden.