Adds GET /api/v1/admin/mangas and /admin/mangas/:id/chapters guarded by RequireAdmin. Sync state is computed at query time from the existing crawler signals (manga_sources / chapter_sources / crawler_jobs) — no new state column is persisted, so the crawler stays the single writer of these signals. Per-manga priority: InProgress (in-flight sync_manga or sync_chapter_list job) > Dropped (all source rows soft-dropped) > Synced (default; covers user-uploaded mangas with zero source rows). Per-chapter priority: Downloading (in-flight sync_chapter_content) > Dropped (all source rows soft-dropped) > Failed (most-recent terminal job is dead) > NotDownloaded (page_count = 0) > Synced. The Failed check sits ABOVE NotDownloaded so the more informative "we tried and it died" state wins over "we never got around to it" — see the priority comment in repo/admin_view.rs. Migration 0020 adds a partial index on crawler_jobs((payload->>'source_manga_key')) for the one job kind (sync_manga) whose payload doesn't carry manga_id directly — without it the in-flight detection for a manga falls back to a seqscan over the job table.
36 lines
967 B
Rust
36 lines
967 B
Rust
pub mod admin_audit;
|
|
pub mod api_token;
|
|
pub mod author;
|
|
pub mod bookmark;
|
|
pub mod chapter;
|
|
pub mod collection;
|
|
pub mod genre;
|
|
pub mod manga;
|
|
pub mod page;
|
|
pub mod patch;
|
|
pub mod read_progress;
|
|
pub mod session;
|
|
pub mod sync_state;
|
|
pub mod tag;
|
|
pub mod upload_entry;
|
|
pub mod user;
|
|
pub mod user_preferences;
|
|
|
|
pub use admin_audit::AdminAuditEntry;
|
|
pub use api_token::ApiToken;
|
|
pub use author::{Author, AuthorRef, AuthorWithCount};
|
|
pub use bookmark::{Bookmark, BookmarkSummary};
|
|
pub use chapter::Chapter;
|
|
pub use collection::{Collection, CollectionSummary};
|
|
pub use genre::{Genre, GenreRef};
|
|
pub use manga::{Manga, MangaCard, MangaDetail};
|
|
pub use page::Page;
|
|
pub use patch::Patch;
|
|
pub use read_progress::{ReadProgress, ReadProgressForManga, ReadProgressSummary};
|
|
pub use session::Session;
|
|
pub use sync_state::{ChapterSyncState, MangaSyncState};
|
|
pub use tag::{Tag, TagRef};
|
|
pub use upload_entry::UploadEntry;
|
|
pub use user::User;
|
|
pub use user_preferences::UserPreferences;
|