A vibe coded tangled fork which supports pijul.

appview/db: add util to get reaction counts

Signed-off-by: oppiliappan <me@oppi.li>

authored by

oppiliappan and committed by tangled.org 5b37d3c7 12ffd7bd

+10 -1
+10 -1
appview/db/reaction.go
··· 52 52 return err 53 53 } 54 54 55 - func GetReactionCount(e Execer, threadAt syntax.ATURI, kind models.ReactionKind) (int, error) { 55 + func GetReactionCount(e Execer, threadAt syntax.ATURI) (int, error) { 56 + count := 0 57 + err := e.QueryRow(`select count(reacted_by_did) from reactions where thread_at = ?`, threadAt).Scan(&count) 58 + if err != nil { 59 + return 0, err 60 + } 61 + return count, nil 62 + } 63 + 64 + func GetReactionCountByKind(e Execer, threadAt syntax.ATURI, kind models.ReactionKind) (int, error) { 56 65 count := 0 57 66 err := e.QueryRow( 58 67 `select count(reacted_by_did) from reactions where thread_at = ? and kind = ?`, threadAt, kind).Scan(&count)