feat(admin): observability — job history, live now-analyzing, durations & metrics (0.84.0) (#6)
This commit was merged in pull request #6.
This commit is contained in:
@@ -60,6 +60,27 @@ pub async fn locate(
|
||||
Ok(row)
|
||||
}
|
||||
|
||||
/// Like [`locate`] but also resolves the manga title and chapter number, so
|
||||
/// live analysis events can carry human labels for the "now analyzing"
|
||||
/// banner without the dashboard having to look them up. Returns
|
||||
/// `(manga_id, manga_title, chapter_id, chapter_number, page_number)`.
|
||||
pub async fn locate_labeled(
|
||||
pool: &PgPool,
|
||||
page_id: Uuid,
|
||||
) -> AppResult<Option<(Uuid, String, Uuid, i32, i32)>> {
|
||||
let row: Option<(Uuid, String, Uuid, i32, i32)> = sqlx::query_as(
|
||||
"SELECT c.manga_id, m.title, p.chapter_id, c.number, p.page_number \
|
||||
FROM pages p \
|
||||
JOIN chapters c ON c.id = p.chapter_id \
|
||||
JOIN mangas m ON m.id = c.manga_id \
|
||||
WHERE p.id = $1",
|
||||
)
|
||||
.bind(page_id)
|
||||
.fetch_optional(pool)
|
||||
.await?;
|
||||
Ok(row)
|
||||
}
|
||||
|
||||
pub async fn list_for_chapter(pool: &PgPool, chapter_id: Uuid) -> AppResult<Vec<Page>> {
|
||||
let rows = sqlx::query_as::<_, Page>(
|
||||
r#"
|
||||
|
||||
Reference in New Issue
Block a user