refactor(chapter): Migrate more queries to SQLDelight

This commit is contained in:
Ahmad Ansori Palembani 2024-08-17 07:59:39 +07:00
parent fac21dbab7
commit 1e68e55cf7
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
14 changed files with 160 additions and 95 deletions

View file

@ -32,6 +32,10 @@ AND (
:apply_filter = 0 OR S.name IS NULL
);
getChaptersById:
SELECT * FROM chapters
WHERE _id = :id;
getChaptersByUrl:
SELECT C.*
FROM chapters AS C
@ -43,6 +47,17 @@ AND (
:apply_filter = 0 OR S.name IS NULL
);
getChaptersByUrlAndMangaId:
SELECT C.*
FROM chapters AS C
LEFT JOIN scanlators_view AS S
ON C.manga_id = S.manga_id
AND ifnull(C.scanlator, 'N/A') = ifnull(S.name, '/<INVALID>/') -- I assume if it's N/A it shouldn't be filtered
WHERE C.url = :url AND C.manga_id = :manga_id
AND (
:apply_filter = 0 OR S.name IS NULL
);
getRecents:
SELECT
M.*,