Support for private tracking with AniList and Bangumi (#1736)

Co-authored-by: MajorTanya <39014446+MajorTanya@users.noreply.github.com>
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
NarwhalHorns
2025-02-25 11:01:13 +00:00
committed by GitHub
parent badc229a23
commit 49b2b346b6
27 changed files with 214 additions and 25 deletions

View File

@@ -17,6 +17,7 @@ object TrackMapper {
remoteUrl: String,
startDate: Long,
finishDate: Long,
private: Boolean,
): Track = Track(
id = id,
mangaId = mangaId,
@@ -31,5 +32,6 @@ object TrackMapper {
remoteUrl = remoteUrl,
startDate = startDate,
finishDate = finishDate,
private = private,
)
}

View File

@@ -64,6 +64,7 @@ class TrackRepositoryImpl(
remoteUrl = mangaTrack.remoteUrl,
startDate = mangaTrack.startDate,
finishDate = mangaTrack.finishDate,
private = mangaTrack.private,
)
}
}

View File

@@ -1,3 +1,5 @@
import kotlin.Boolean;
CREATE TABLE manga_sync(
_id INTEGER NOT NULL PRIMARY KEY,
manga_id INTEGER NOT NULL,
@@ -12,6 +14,7 @@ CREATE TABLE manga_sync(
remote_url TEXT NOT NULL,
start_date INTEGER NOT NULL,
finish_date INTEGER NOT NULL,
private INTEGER AS Boolean DEFAULT 0 NOT NULL,
UNIQUE (manga_id, sync_id) ON CONFLICT REPLACE,
FOREIGN KEY(manga_id) REFERENCES mangas (_id)
ON DELETE CASCADE
@@ -36,8 +39,8 @@ FROM manga_sync
WHERE manga_id = :mangaId;
insert:
INSERT INTO manga_sync(manga_id,sync_id,remote_id,library_id,title,last_chapter_read,total_chapters,status,score,remote_url,start_date,finish_date)
VALUES (:mangaId,:syncId,:remoteId,:libraryId,:title,:lastChapterRead,:totalChapters,:status,:score,:remoteUrl,:startDate,:finishDate);
INSERT INTO manga_sync(manga_id,sync_id,remote_id,library_id,title,last_chapter_read,total_chapters,status,score,remote_url,start_date,finish_date,private)
VALUES (:mangaId,:syncId,:remoteId,:libraryId,:title,:lastChapterRead,:totalChapters,:status,:score,:remoteUrl,:startDate,:finishDate,:private);
update:
UPDATE manga_sync
@@ -53,5 +56,6 @@ SET
score = coalesce(:score, score),
remote_url = coalesce(:trackingUrl, remote_url),
start_date = coalesce(:startDate, start_date),
finish_date = coalesce(:finishDate, finish_date)
finish_date = coalesce(:finishDate, finish_date),
private = coalesce(:private, private)
WHERE _id = :id;

View File

@@ -0,0 +1,4 @@
import kotlin.Boolean;
-- Add private field for tracking
ALTER TABLE manga_sync ADD COLUMN private INTEGER AS Boolean DEFAULT 0 NOT NULL;