A lexicon-driven AppView for ATProto. happyview.dev
backfill firehose jetstream atproto appview oauth lexicon
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: show collections on Records page even if they have no records

Trezy 56a35a9e 67049d9b

+11 -1
+11 -1
src/admin/stats.rs
··· 18 18 .map_err(|e| AppError::Internal(format!("failed to count records: {e}")))?; 19 19 20 20 let collections: Vec<(String, i64)> = sqlx::query_as( 21 - "SELECT collection, COUNT(*) FROM records GROUP BY collection ORDER BY collection", 21 + r#" 22 + SELECT c.collection, COALESCE(r.cnt, 0) AS count 23 + FROM ( 24 + SELECT id AS collection FROM lexicons 25 + WHERE lexicon_json->'defs'->'main'->>'type' = 'record' 26 + ) c 27 + LEFT JOIN ( 28 + SELECT collection, COUNT(*) AS cnt FROM records GROUP BY collection 29 + ) r ON r.collection = c.collection 30 + ORDER BY c.collection 31 + "#, 22 32 ) 23 33 .fetch_all(&state.db) 24 34 .await