-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3416e5f
commit 7f031d8
Showing
17 changed files
with
195 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
core/data/src/main/java/store/newsbriefing/app/core/data/repository/model/Scrap.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
package store.newsbriefing.app.core.data.repository.model | ||
|
||
import store.newsbriefing.app.core.common.util.toZoneDateTime | ||
import store.newsbriefing.app.core.model.Scrap | ||
import store.newsbriefing.app.core.model.TimeOfDay | ||
import store.newsbriefing.app.core.network.model.NetworkScrap | ||
|
||
fun NetworkScrap.asExternalModel() = Scrap( | ||
briefingId = briefingId, | ||
ranks = ranks, | ||
title = title, | ||
subtitle = subtitle, | ||
date = date.toZoneDateTime(), | ||
date = date, | ||
gptModel = gptModel, | ||
timeOfDay = timeOfDay | ||
timeOfDay = TimeOfDay.fromValue(timeOfDay) | ||
) |
23 changes: 23 additions & 0 deletions
23
...ain/src/main/kotlin/store/newsbriefing/app/core/domain/LoadBriefingScrapArticleUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package store.newsbriefing.app.core.domain | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.first | ||
import kotlinx.coroutines.flow.flow | ||
import store.newsbriefing.app.core.data.repository.MemberTokenRepository | ||
import store.newsbriefing.app.core.data.repository.ScrapRepository | ||
import store.newsbriefing.app.core.model.BriefingScrapArticle | ||
import javax.inject.Inject | ||
|
||
class LoadBriefingScrapArticleUseCase @Inject constructor( | ||
private val scrapRepository: ScrapRepository, | ||
private val memberTokenRepository: MemberTokenRepository | ||
) { | ||
suspend operator fun invoke(): Flow<List<BriefingScrapArticle>> { | ||
val userId = memberTokenRepository.getMemberToken().first().memberId | ||
val scraps = scrapRepository.getScrap(userId).first() | ||
|
||
val groupedScraps = scraps.groupBy { it.date } | ||
|
||
return flow { emit(groupedScraps.map { BriefingScrapArticle(it.key, it.value) }) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
core/model/src/main/java/store/newsbriefing/app/core/model/BriefingScrapArticle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package store.newsbriefing.app.core.model | ||
|
||
data class BriefingScrapArticle( | ||
val date: String, | ||
val scraps: List<Scrap> | ||
) |
6 changes: 2 additions & 4 deletions
6
core/model/src/main/java/store/newsbriefing/app/core/model/Scrap.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
package store.newsbriefing.app.core.model | ||
|
||
import java.time.ZonedDateTime | ||
|
||
data class Scrap( | ||
val briefingId: Int, | ||
val ranks: Int, | ||
val title: String, | ||
val subtitle: String, | ||
val date: ZonedDateTime, | ||
val date: String, | ||
val gptModel: String, | ||
val timeOfDay: String, | ||
val timeOfDay: TimeOfDay, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.