Skip to content

Commit

Permalink
✅ Improve PauseRepository + PauseRepositoryTest
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Colman Lopes <[email protected]>
  • Loading branch information
LeoColman committed Jan 31, 2025
1 parent 27ada78 commit 98738ce
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 407 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ package br.com.colman.petals.use.pause.repository

import app.cash.sqldelight.coroutines.asFlow
import app.cash.sqldelight.coroutines.mapToList
import app.cash.sqldelight.coroutines.mapToOneOrNull
import br.com.colman.petals.PauseQueries
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import java.time.LocalTime
import java.time.format.DateTimeFormatter
Expand All @@ -21,10 +19,6 @@ class PauseRepository(
pauses.map(PauseEntity::toPause).sortedWith(compareBy({ it.startTime }, { it.endTime }))
}

fun get(dispatcher: CoroutineDispatcher = IO): Flow<Pause?> {
return pauseQueries.selectFirst().asFlow().mapToOneOrNull(dispatcher).map { it?.toPause() }
}

fun insert(pause: Pause) {
pauseQueries.insert(pause.toEntity())
}
Expand Down
50 changes: 0 additions & 50 deletions app/src/main/kotlin/br/com/colman/petals/widget/BreakPeriodPart.kt

This file was deleted.

34 changes: 0 additions & 34 deletions app/src/main/kotlin/br/com/colman/petals/widget/PetalsAppWidget.kt

This file was deleted.

This file was deleted.

205 changes: 0 additions & 205 deletions app/src/main/kotlin/br/com/colman/petals/widget/WidgetUsagePart.kt

This file was deleted.

Loading

0 comments on commit 98738ce

Please sign in to comment.