feat: add follow endpoint with integration tests - #776
Merged
Chucks1093 merged 1 commit intoAug 25, 2026
Conversation
Add follow/unfollow endpoints for creators with idempotent behavior and follower count tracking. Changes: - Add Follow Prisma model with unique constraint on (followerAddress, creatorId) - Add followersCount field to CreatorProfile model - Create follow service with idempotent follow/unfollow logic - Create follow handlers for POST and DELETE endpoints - Add follow routes to creator router - Add comprehensive integration tests covering: - Follow increments count by 1 - Double follow is idempotent (count not incremented twice) - Unfollow decrements count by 1 - Double unfollow is idempotent (count does not go below 0) - Unauthenticated follow returns 401 - Non-existent creator returns 404
|
@Emeka-12 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add integration tests for the follow/unfollow endpoints to verify correct follower count incrementing and decrementing behavior. This also includes the implementation of the follow feature itself.
closes #697, closes #698, closes #699, closes #700
Changes
Schema
FollowPrisma model with unique constraint on(followerAddress, creatorId)followersCountfield toCreatorProfilemodel (default: 0)Implementation
follow.service.ts): Idempotent follow/unfollow logic with atomic transactionsfollow.handlers.ts): Express handlers for POST/DELETE endpointscreator.routes.ts): Added routes with Stellar signature authenticationIntegration Tests
Endpoints Added
/api/v1/creators/:creatorId/follow/api/v1/creators/:creatorId/followBoth endpoints require Stellar signature authentication (
x-wallet-address,x-wallet-signature,x-timestampheaders).Test Results
All 6 integration tests pass: