caelum0x af2c2fcd04 fix(ritgram): correct swapped follower/following back-relation field names
Account.followers/following and User.followers/following were labeled
backwards relative to what they actually return: the "followers" field
on each model was the back-relation for the FK column that makes *this*
row the follower (i.e. "who I follow"), and "following" was the
back-relation for the FK column that makes this row the target (i.e.
"who follows me") -- exactly inverted from their names.

Swap just the two field names on each model (relation tags, FK columns,
and the Follow model's own follower/following fields are untouched, so
this needs zero DB migration). This fixes every _count.select.followers/
following read across router.ts, social.ts, resolvers.ts, adminController,
searchController, popularController, socialGraphService,
trendingRankingService, fakeAccountDetectionService, etc. in one place --
all profile header counts, followers/following list pages, and REST/
tRPC/GraphQL responses were pulling the inverted number.

followService.ts and the tRPC getFollowers/getFollowing procedures
already bypass these relations (query Follow directly by followerUserId/
followingUserId), so they were already correct and are unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-18 02:41:24 +03:00
..