Skip to content

Commit

Permalink
fix(DefaultEventSearchRepository): 검색 기록 저장 시 이전에 중복되는 검색 기록은 제거하도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ki960213 committed Feb 7, 2024
1 parent b8a3f58 commit 136699e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ interface EventSearchHistoryDao {
@Delete
fun delete(eventSearch: EventSearchHistoryEntity)

@Query("DELETE FROM event_search WHERE query = :query")
fun deleteByQuery(query: String)

@Query("DELETE FROM event_search")
fun deleteAll()
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class DefaultEventSearchRepository @Inject constructor(

override suspend fun save(searchQuery: String) {
withContext(dispatcher) {
dao.deleteByQuery(searchQuery)
dao.save(EventSearchHistoryEntity(query = searchQuery))
}
}
Expand Down

0 comments on commit 136699e

Please sign in to comment.