Skip to content

Achievements Module & Most frequent spending items endpoint#17

Merged
Joseph-Sameh-0 merged 13 commits into
developfrom
feature/goals-achievements
Jun 28, 2026
Merged

Achievements Module & Most frequent spending items endpoint#17
Joseph-Sameh-0 merged 13 commits into
developfrom
feature/goals-achievements

Conversation

@Eng-AmanyMohamed

Copy link
Copy Markdown
Contributor

PR: Achievements Module & Spending Analytics

Summary

This PR introduces the Gamified Achievements Module with event-driven notifications and adds an endpoint for retrieving the most frequent spending items.

Changes

Achievements Module

  • Implemented achievement evaluation and milestone tracking.
  • Added event publishing using AchievementEarnedEvent.
  • Added notification listener to send achievement unlock notifications.
  • Added paginated achievements endpoint with localization support (en / ar).

Spending Analytics

  • Added endpoint to retrieve top frequent spending items.
  • Supports optional filtering by category.

Testing

  • Added integration tests validating the complete achievement earning flow for each badge, ensuring achievements are awarded only when their specific conditions are met .

Eng-AmanyMohamed and others added 6 commits June 23, 2026 22:52
Introduce AchievementCode enum and add a code field to Achievement. Extend AchievementEarnedEvent with Arabic title/description and targetValue. Add paginated repository queries (missing achievements, distinct user IDs) and update UserAchievement repository. Implement seeding, paginated user-achievement syncing and per-user checks in AchievementService, plus a weekly AchievementScheduler. Refactor achievement flow (renamed listener, use SavingBalanceRepository, new update/unlock logic). Update SavingGoalService calls and integration tests to use codes and numeric BigDecimal literals. Improves scalability, i18n and background syncing of achievements.
Decouple achievement tracking from direct service calls by introducing a cross-module event system. AuthService, SavingGoalService, and TransactionService now publish domain events (UserLoggedInEvent, SavingGoalCompletedEvent, SavingsBalanceUpdatedEvent, TransactionCreatedEvent) that achievement listeners consume asynchronously.

Add new achievement types:
- Login streak (3, 7, 15, 30 day milestones)
- Transaction streak (daily transaction tracking)
- Category diversity (logging transactions in multiple categories)

Introduce streak tracking entities (LoginStreak, TransactionStreak) and repositories with efficient count-based progress tracking. Update achievement codes and types to support the new categories. Improve AchievementType enum with safe fallback for string conversion.

@Joseph-Sameh-0 Joseph-Sameh-0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work ya Amany

@Joseph-Sameh-0 Joseph-Sameh-0 merged commit 19b6215 into develop Jun 28, 2026
3 checks passed
@Joseph-Sameh-0 Joseph-Sameh-0 deleted the feature/goals-achievements branch June 28, 2026 12:18
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.

2 participants