|
|
|
@ -5,6 +5,7 @@ import androidx.room.Delete
|
|
|
|
import androidx.room.Insert
|
|
|
|
import androidx.room.Insert
|
|
|
|
import androidx.room.Query
|
|
|
|
import androidx.room.Query
|
|
|
|
import androidx.room.Transaction
|
|
|
|
import androidx.room.Transaction
|
|
|
|
|
|
|
|
import androidx.room.Upsert
|
|
|
|
import kotlinx.coroutines.flow.Flow
|
|
|
|
import kotlinx.coroutines.flow.Flow
|
|
|
|
import org.koitharu.kotatsu.core.db.entity.MangaWithTags
|
|
|
|
import org.koitharu.kotatsu.core.db.entity.MangaWithTags
|
|
|
|
|
|
|
|
|
|
|
|
@ -14,6 +15,12 @@ abstract class BookmarksDao {
|
|
|
|
@Query("SELECT * FROM bookmarks WHERE manga_id = :mangaId AND page_id = :pageId")
|
|
|
|
@Query("SELECT * FROM bookmarks WHERE manga_id = :mangaId AND page_id = :pageId")
|
|
|
|
abstract suspend fun find(mangaId: Long, pageId: Long): BookmarkEntity?
|
|
|
|
abstract suspend fun find(mangaId: Long, pageId: Long): BookmarkEntity?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transaction
|
|
|
|
|
|
|
|
@Query(
|
|
|
|
|
|
|
|
"SELECT * FROM manga JOIN bookmarks ON bookmarks.manga_id = manga.manga_id ORDER BY bookmarks.created_at",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
abstract suspend fun findAll(): Map<MangaWithTags, List<BookmarkEntity>>
|
|
|
|
|
|
|
|
|
|
|
|
@Query("SELECT * FROM bookmarks WHERE manga_id = :mangaId AND chapter_id = :chapterId AND page = :page")
|
|
|
|
@Query("SELECT * FROM bookmarks WHERE manga_id = :mangaId AND chapter_id = :chapterId AND page = :page")
|
|
|
|
abstract fun observe(mangaId: Long, chapterId: Long, page: Int): Flow<BookmarkEntity?>
|
|
|
|
abstract fun observe(mangaId: Long, chapterId: Long, page: Int): Flow<BookmarkEntity?>
|
|
|
|
|
|
|
|
|
|
|
|
@ -37,4 +44,7 @@ abstract class BookmarksDao {
|
|
|
|
|
|
|
|
|
|
|
|
@Query("DELETE FROM bookmarks WHERE manga_id = :mangaId AND chapter_id = :chapterId AND page = :page")
|
|
|
|
@Query("DELETE FROM bookmarks WHERE manga_id = :mangaId AND chapter_id = :chapterId AND page = :page")
|
|
|
|
abstract suspend fun delete(mangaId: Long, chapterId: Long, page: Int): Int
|
|
|
|
abstract suspend fun delete(mangaId: Long, chapterId: Long, page: Int): Int
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Upsert
|
|
|
|
|
|
|
|
abstract suspend fun upsert(bookmarks: Collection<BookmarkEntity>)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|