chore: Prepare find duplicate query

This commit is contained in:
Ahmad Ansori Palembani 2024-06-19 15:24:11 +07:00
parent 395f10c8a9
commit 535fcc81dd
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 15 additions and 0 deletions

View file

@ -139,6 +139,16 @@ fun Manga.addOrRemoveToFavorites(
): Snackbar? {
if (!favorite) {
if (checkForDupes) {
// TODO
/*
val duplicateManga = runBlocking(Dispatchers.IO) { handler.awaitOne {
mangasQueries.findDuplicateFavorite(
this@addOrRemoveToFavorites.title,
this@addOrRemoveToFavorites.source,
Manga::mapper,
)
} }
*/
val duplicateManga = db.getDuplicateLibraryManga(this).executeAsBlocking()
if (duplicateManga != null) {
showAddDuplicateDialog(

View file

@ -40,6 +40,11 @@ SELECT *
FROM mangas
WHERE _id = :mangaId;
findDuplicateFavorite:
SELECT *
FROM mangas
WHERE favorite = 1 AND lower(title) = :title AND source = :source;
insert:
INSERT INTO mangas (source, url, artist, author, description, genre, title, status, thumbnail_url, favorite, last_update, initialized, viewer, hide_title, chapter_flags, date_added, filtered_scanlators, update_strategy)
VALUES (:source, :url, :artist, :author, :description, :genre, :title, :status, :thumbnailUrl, :favorite, :lastUpdate, :initialized, :viewer, :hideTitle, :chapterFlags, :dateAdded, :filteredScanlators, :updateStrategy);