Skip to content

Commit b77684c

Browse files
committed
fix : 최그 검색 중복 저장 해결
1 parent 799b342 commit b77684c

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

data/src/main/java/com/stop/data/local/database/dao/RecentPlaceSearchDao.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import kotlinx.coroutines.flow.Flow
1111
interface RecentPlaceSearchDao {
1212

1313
@Insert(onConflict = OnConflictStrategy.REPLACE)
14-
suspend fun insertRecentPlaceSearchEntity(recentPlaceSearchEntity: RecentPlaceSearchEntity)
14+
suspend fun insertRecentPlaceSearchEntity(recentPlaceSearchEntity: RecentPlaceSearchEntity) : Long
1515

1616
@Query("SELECT * FROM RecentPlaceSearchEntity ORDER BY id DESC")
1717
fun getAllRecentPlaceSearchEntity(): Flow<List<RecentPlaceSearchEntity>>

data/src/main/java/com/stop/data/local/model/RecentPlaceSearchEntity.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
package com.stop.data.local.model
22

33
import androidx.room.Entity
4+
import androidx.room.Index
45
import androidx.room.PrimaryKey
56
import com.stop.data.model.nearplace.PlaceRepositoryItem
67

7-
@Entity
8+
@Entity(indices = [Index(value = ["name"], unique = true)])
89
data class RecentPlaceSearchEntity(
9-
@PrimaryKey(autoGenerate = true)
10-
val id: Int? = null,
1110
val name: String,
1211
val radius: String,
1312
val fullAddressRoad: String,
1413
val centerLat: Double,
15-
val centerLon: Double
14+
val centerLon: Double,
15+
@PrimaryKey(autoGenerate = true)
16+
val id: Long = 0,
1617
) {
1718

1819
fun toRepositoryModel() = PlaceRepositoryItem(

presentation/src/main/java/com/stop/ui/route/RouteFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class RouteFragment : Fragment() {
9494

9595
routeViewModel.lastTimeResponse.observe(viewLifecycleOwner) { event ->
9696
event.getContentIfNotHandled()?.let { response ->
97-
clickRouteViewModel.lastTimes = response
97+
routeViewModel.lastTimes = response
9898
binding.root.findNavController().navigate(R.id.action_routeFragment_to_routeDetailFragment)
9999
}
100100
}

0 commit comments

Comments
 (0)