2021-04-22 11:47:18 +02:00
|
|
|
package org.pixeldroid.app.utils.db.dao.feedContent
|
2020-11-27 17:02:52 +01:00
|
|
|
|
|
|
|
import androidx.paging.PagingSource
|
|
|
|
import androidx.room.Dao
|
|
|
|
import androidx.room.Query
|
2021-04-22 11:47:18 +02:00
|
|
|
import org.pixeldroid.app.utils.api.objects.Notification
|
2020-11-27 17:02:52 +01:00
|
|
|
|
|
|
|
@Dao
|
|
|
|
interface NotificationDao: FeedContentDao<Notification> {
|
|
|
|
|
2021-08-14 19:40:31 +02:00
|
|
|
@Query("DELETE FROM notifications WHERE user_id=:userId AND instance_uri=:instanceUri")
|
|
|
|
override suspend fun clearFeedContent(userId: String, instanceUri: String)
|
2020-11-27 17:02:52 +01:00
|
|
|
|
|
|
|
@Query("""SELECT * FROM notifications WHERE user_id=:userId AND instance_uri=:instanceUri
|
2021-09-25 13:52:18 +02:00
|
|
|
ORDER BY datetime(created_at) DESC""")
|
2020-11-27 17:02:52 +01:00
|
|
|
override fun feedContent(userId: String, instanceUri: String): PagingSource<Int, Notification>
|
2020-11-28 15:05:13 +01:00
|
|
|
|
2021-09-25 13:52:18 +02:00
|
|
|
@Query("""SELECT * FROM notifications WHERE user_id=:userId AND instance_uri=:instanceUri
|
|
|
|
ORDER BY datetime(created_at) DESC LIMIT 1""")
|
|
|
|
fun latestNotification(userId: String, instanceUri: String): Notification?
|
2020-11-27 17:02:52 +01:00
|
|
|
}
|