a tool for shared writing and social publishing

add all leaflets feed

+21 -10
+21 -10
feeds/index.ts
··· 63 63 .eq( 64 64 "documents_in_publications.publications.identities.bsky_follows.identity", 65 65 auth, 66 + ); 67 + } else if (feedAtURI.rkey === "all-leaflets") { 68 + query = supabaseServerClient 69 + .from("documents") 70 + .select( 71 + `*, 72 + documents_in_publications!inner(publications!inner(*))`, 66 73 ) 67 - .not("data -> postRef", "is", null) 68 - .order("indexed_at", { ascending: false }) 69 - .limit(25); 74 + .or( 75 + "record->preferences->showInDiscover.is.null,record->preferences->>showInDiscover.eq.true", 76 + { referencedTable: "documents_in_publications.publications" }, 77 + ); 70 78 } else { 79 + //the default subscription feed 71 80 query = supabaseServerClient 72 81 .from("documents") 73 82 .select( ··· 77 86 .eq( 78 87 "documents_in_publications.publications.publication_subscriptions.identity", 79 88 auth, 80 - ) 81 - .not("data -> postRef", "is", null) 82 - .order("indexed_at", { ascending: false }) 83 - .order("uri", { ascending: false }) 84 - .limit(25); 89 + ); 85 90 } 91 + query = query 92 + .not("data -> postRef", "is", null) 93 + .order("indexed_at", { ascending: false }) 94 + .order("uri", { ascending: false }) 95 + .limit(25); 86 96 if (parsedCursor) 87 - query.or( 97 + query = query.or( 88 98 `indexed_at.lt.${parsedCursor.date},and(indexed_at.eq.${parsedCursor.date},uri.lt.${parsedCursor.uri})`, 89 99 ); 90 100 91 - let { data } = await query; 101 + let { data, error } = await query; 102 + console.log(error); 92 103 posts = data; 93 104 94 105 posts = posts || [];