Skip to content

feat(social): prevent users from following themselves (BA-053) - #1037

Open
ranjeetprabhatedu-dotcom wants to merge 1 commit into
BlockDash-Studios:mainfrom
ranjeetprabhatedu-dotcom:feat/ba-053-prevent-self-follow-966
Open

ranjeetprabhatedu-dotcom wants to merge 1 commit into
BlockDash-Studios:mainfrom
ranjeetprabhatedu-dotcom:feat/ba-053-prevent-self-follow-966

Conversation

@ranjeetprabhatedu-dotcom

Copy link
Copy Markdown

Summary

This PR addresses issue #966 (BA-053) by enforcing self-follow prevention at the service boundary with a clear, structured CANNOT_FOLLOW_SELF error payload.

  • Changes:
    • BackendAcademy/src/social/dto/follow.dto.ts: Added Swagger documentation to FollowDto and exported SelfFollowError interface (code: 'CANNOT_FOLLOW_SELF').
    • BackendAcademy/src/social/follow.service.ts: Enforce self-follow rejection at the boundary (including trimmed whitespace comparison and DTO invocations) with structured error payload.
    • BackendAcademy/src/social/follow.service.spec.ts: Added unit tests verifying self-follow prevention across raw IDs, DTOs, and trimmed whitespace representations.
  • Verification:
    • All 18 tests in follow.service.spec.ts pass cleanly (100% Green).
    • Scope strictly restricted to the 3 allowlisted files.

Closes #966

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BA-053 — Prevent users from following themselves

1 participant