From b761e4904af90d62bc1397438e042c4d7a0558b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=86=A0=EB=A7=88=EC=8A=A4?= <123928686+ki960213@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:56:08 +0900 Subject: [PATCH] =?UTF-8?q?merge:=20=EA=B2=80=EC=83=89=20=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=A0=80=EC=9E=A5=20=EC=8B=9C=20=EC=9D=B4=EC=A0=84?= =?UTF-8?q?=EC=97=90=20=EC=A4=91=EB=B3=B5=EB=90=98=EB=8A=94=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20=EA=B8=B0=EB=A1=9D=EC=9D=80=20=EC=A0=9C=EA=B1=B0?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD=20(#915)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Related to: #914 --- .../emmsale/data/common/database/dao/EventSearchHistoryDao.kt | 3 +++ .../data/repository/concretes/DefaultEventSearchRepository.kt | 1 + 2 files changed, 4 insertions(+) diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/common/database/dao/EventSearchHistoryDao.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/common/database/dao/EventSearchHistoryDao.kt index f19ae9610..e9b2b6b7a 100644 --- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/common/database/dao/EventSearchHistoryDao.kt +++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/common/database/dao/EventSearchHistoryDao.kt @@ -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() } diff --git a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultEventSearchRepository.kt b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultEventSearchRepository.kt index f3b615f45..ff0c711cc 100644 --- a/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultEventSearchRepository.kt +++ b/android/2023-emmsale/app/src/main/java/com/emmsale/data/repository/concretes/DefaultEventSearchRepository.kt @@ -23,6 +23,7 @@ class DefaultEventSearchRepository @Inject constructor( override suspend fun save(searchQuery: String) { withContext(dispatcher) { + dao.deleteByQuery(searchQuery) dao.save(EventSearchHistoryEntity(query = searchQuery)) } }