Monorepo for Tangled
0

Configure Feed

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

appview/db: add util to get reaction counts

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

author
oppiliappan
committer tangled.org date (Apr 1, 2026, 10:19 AM UTC) commit 5b37d3c7 parent 12ffd7bd change-id mwqymtom
+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)