Add suspend to getOneOff* read queries

recent_search
Takeshi Hagikura 1 year ago
parent 333a248327
commit 0c6e542555

@ -54,10 +54,10 @@ class DefaultSearchContentsRepository @Inject constructor(
val newsResourceIds = newsResourceFtsDao.searchAllNewsResources("*$searchQuery*") val newsResourceIds = newsResourceFtsDao.searchAllNewsResources("*$searchQuery*")
val topicIds = topicFtsDao.searchAllTopics("*$searchQuery*") val topicIds = topicFtsDao.searchAllTopics("*$searchQuery*")
return combine(newsResourceIds, topicIds) { news, topics -> return combine(newsResourceIds, topicIds) { newsFlow, topicsFlow ->
combine( combine(
newsResourceDao.getNewsResources(filterNewsIds = news.toSet()), newsResourceDao.getNewsResources(filterNewsIds = newsFlow.toSet()),
topicDao.getTopicEntities(topics.toSet()), topicDao.getTopicEntities(topicsFlow.toSet()),
) { newsResources, topics -> ) { newsResources, topics ->
SearchResult( SearchResult(
topics = topics.map { it.asExternalModel() }, topics = topics.map { it.asExternalModel() },

@ -68,7 +68,7 @@ interface NewsResourceDao {
@Transaction @Transaction
@Query(value = "SELECT * FROM news_resources ORDER BY publish_date DESC") @Query(value = "SELECT * FROM news_resources ORDER BY publish_date DESC")
fun getOneOffNewsResources(): List<PopulatedNewsResource> suspend fun getOneOffNewsResources(): List<PopulatedNewsResource>
/** /**
* Inserts [entities] into the db if they don't exist, and ignores those that do * Inserts [entities] into the db if they don't exist, and ignores those that do

@ -42,7 +42,7 @@ interface TopicDao {
fun getTopicEntities(): Flow<List<TopicEntity>> fun getTopicEntities(): Flow<List<TopicEntity>>
@Query(value = "SELECT * FROM topics") @Query(value = "SELECT * FROM topics")
fun getOneOffTopicEntities(): List<TopicEntity> suspend fun getOneOffTopicEntities(): List<TopicEntity>
@Query( @Query(
value = """ value = """

Loading…
Cancel
Save