File tree Expand file tree Collapse file tree
app/src/main/java/bitshift/studios/flightsapp/data/db/bookmarked Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import androidx.room.Delete
55import androidx.room.Insert
66import androidx.room.OnConflictStrategy
77import androidx.room.Query
8+ import bitshift.studios.flightsapp.data.db.airport.entities.AirportEntity
89import bitshift.studios.flightsapp.data.db.bookmarked.entities.BookmarkedAirportEntity
910import kotlinx.coroutines.flow.Flow
1011
@@ -17,6 +18,13 @@ interface BookmarkedAirportDao {
1718 )
1819 fun getBookmarkedAirports (): Flow <BookmarkedAirportEntity >
1920
21+ @Query(
22+ """
23+ SELECT EXISTS (SELECT 1 FROM bookmarked_airports WHERE departureCode = :code LIMIT 1)
24+ """
25+ )
26+ suspend fun isAirportBookmarked (code : String ): Boolean
27+
2028 @Insert(onConflict = OnConflictStrategy .IGNORE )
2129 suspend fun addAirportToBookmarks (airport : BookmarkedAirportEntity )
2230
You can’t perform that action at this time.
0 commit comments