feat: engagement-counter denormalization, pagination fixes, dead-code cleanup
Bundles the 2026-07-12 code-audit session (Clusters A/B/C/D partial/E/F): denormalized Post/Advertisement reaction/comment/repost counters synced transactionally instead of live _count queries; real cursor-based pagination for followers/following/blocks lists; assertPetOwnership + formatRelativeTime centralized; dead r2.ts + AWS SDK deps removed; missing DB indexes added; account-deletion flow, mention notifications, pull-to-refresh feed, and mobile UI/i18n fixes from the surrounding sessions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e91705063f
commit
f14be58c06
182 files changed
+10562
-724
No files matched your search
@@ -0,0 +1,14 @@
|
||||
-- One-off backfill for the new denormalized engagement counters (Cluster A).
|
||||
-- Run once, immediately after `prisma migrate dev` adds the columns (which
|
||||
-- default to 0), so existing posts/ads don't briefly show 0 engagement.
|
||||
-- Safe to re-run — it always recomputes from the source-of-truth tables.
|
||||
|
||||
UPDATE "Post" p
|
||||
SET "reactionCount" = COALESCE((SELECT COUNT(*) FROM "Reaction" r WHERE r."postId" = p.id), 0),
|
||||
"commentCount" = COALESCE((SELECT COUNT(*) FROM "Comment" c WHERE c."postId" = p.id), 0),
|
||||
"repostCount" = COALESCE((SELECT COUNT(*) FROM "Repost" rp WHERE rp."originalPostId" = p.id), 0);
|
||||
|
||||
UPDATE "Advertisement" a
|
||||
SET "adReactionCount" = COALESCE((SELECT COUNT(*) FROM "AdReaction" ar WHERE ar."adId" = a.id), 0),
|
||||
"adCommentCount" = COALESCE((SELECT COUNT(*) FROM "AdComment" ac WHERE ac."adId" = a.id), 0),
|
||||
"adRepostCount" = COALESCE((SELECT COUNT(*) FROM "AdRepost" arp WHERE arp."adId" = a.id), 0);
|
||||
Reference in new issue
Block a user