Skip to content

Commit

Permalink
merge: 검색 기록 저장 시 이전에 중복되는 검색 기록은 제거하도록 변경 (#915)
Browse files Browse the repository at this point in the history
Related to: #914
  • Loading branch information
ki960213 authored Feb 7, 2024
1 parent b8a3f58 commit b761e49
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 b761e49

Please sign in to comment.