Skip to content

feat(stats): update user stats via video event SQS handlers#48

Merged
kelleyglenn merged 4 commits into
masterfrom
feature/47-user-stats-events
Feb 27, 2026
Merged

feat(stats): update user stats via video event SQS handlers#48
kelleyglenn merged 4 commits into
masterfrom
feature/47-user-stats-events

Conversation

@kelleyglenn

Copy link
Copy Markdown
Owner

Summary

  • Add SQS handlers that consume video events to keep user_stats counters accurate
  • New UserStatsService increments/decrements submission_count, approved_count, rejected_count
  • Fix seed data: Trusted User stats corrected from (10, 8, 2) to (10, 10, 0)

Closes #47

Changes

  • VideoSubmittedEvent.java / VideoStatusChangedEvent.java — event DTOs
  • UserStatsService.java — counter logic with floor-at-zero protection
  • VideoSubmittedHandler.java — SQS listener on user-video-events
  • VideoStatusChangedHandler.java — SQS listener on user-video-status-events
  • application.yml — queue config
  • R__dev_seed_users.sql — seed data fix
  • 13 unit tests covering all transitions and edge cases

Test plan

  • All unit tests pass (./gradlew unitTest) — 13 new tests
  • Full integration test suite passed (119 API + 252 E2E)

🤖 Generated with Claude Code

kelleyglenn and others added 2 commits February 26, 2026 04:26
- Add VideoSubmittedEvent and VideoStatusChangedEvent records
- Implement UserStatsService with incrementSubmissionCount and handleStatusChange
- Full test coverage for all counter transitions and edge cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Closes #47

- Add VideoSubmittedHandler listening on user-video-events queue
- Add VideoStatusChangedHandler listening on user-video-status-events queue
- Both delegate to UserStatsService for counter updates
- Fix seed data: Trusted User stats now match seed videos (10, 10, 0)
- Full test coverage for all handlers
@github-actions

github-actions Bot commented Feb 27, 2026

Copy link
Copy Markdown

Coverage Report

Overall Project 97.58% 🍏
Files changed 100% 🍏

File Coverage
UserStatsService.java 100% 🍏
VideoSubmittedEvent.java 100% 🍏
VideoStatusChangedHandler.java 100% 🍏
VideoStatusChangedEvent.java 100% 🍏
VideoSubmittedHandler.java 100% 🍏

kelleyglenn and others added 2 commits February 26, 2026 22:58
The new @SqsListener handlers cause ApplicationContext failure in CI
where no LocalStack is available. Mock SqsAsyncClient and exclude
SqsAutoConfiguration to match the video-service test pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@kelleyglenn kelleyglenn merged commit be596b0 into master Feb 27, 2026
6 checks passed
@kelleyglenn kelleyglenn deleted the feature/47-user-stats-events branch February 27, 2026 07:32
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.

User stats counters never updated by video status events

1 participant