feat: implement social layer, friends leaderboard, and milestone notifications - #101
Open
0xNinx wants to merge 1 commit into
Open
feat: implement social layer, friends leaderboard, and milestone notifications#1010xNinx wants to merge 1 commit into
0xNinx wants to merge 1 commit into
Conversation
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.
I have successfully implemented the social layer, friends leaderboard scoping features, and the milestone notification system.
Changes Made
Social Module
Created
follow.entity.ts
representing relational follows in PostgreSQL.
Created
social.service.ts
exposing follow/unfollow logic (with self-follow and duplicate checks), and followers/following query logic.
Created
social.controller.ts
providing the corresponding REST endpoints:
POST /social/follow/:userId
DELETE /social/follow/:userId
GET /social/following
GET /social/followers
Created
social.module.ts
linking dependencies.
Friends Leaderboard
Added
getFriendsLeaderboard
in
leaderboard.service.ts
to retrieve and stand up ranked entries for followed players.
Added GET /leaderboard/friends in
leaderboard.controller.ts
protected by
JwtAuthGuard
.
Milestone notifications
Added STREAK_RECORD_BROKEN to NotificationType enum in
notification.entity.ts
.
Custom events emitted when a player unlocks a rare/epic achievement or breaks a streak record.
Created
social.listener.ts
which automatically detects these events and writes notification records for all followers of that player.
Module Configuration
Registered
SocialModule
on
app.module.ts
.
Verification Results
Unit Tests
We created comprehensive unit tests covering the follow/unfollow services, self-follow and duplicate validation rules, as well as the relative ranking for friends in the leaderboard. All 10 tests passed successfully.
Closes #76