Commit Graph

7 Commits

Author SHA1 Message Date
hikari 3da648544e feat: implement comprehensive achievement system with 62 achievements
Node.js CI / CI (pull_request) Failing after 1m21s
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m22s
Adds a complete achievement system with gamification features across all user interactions.

**Database & Types:**
- Add UserAchievement model to track user progress and earned achievements
- Add achievement-related fields to User model (achievementPoints, currentStreak, lastStreakCheck)
- Add ACHIEVEMENT_UNLOCKED audit action type
- Define 62 achievements as TypeScript constants across 5 categories

**Achievement Categories:**
- Suggestions (15): First suggestion through ultimate curator milestones
- Likes (12): First like through legendary fan milestones
- Comments (12): First comment through review legend milestones
- Engagement (15): Login streaks and total activity tracking
- Reports (8): Valid reports and accuracy tracking

**Backend Implementation:**
- Create AchievementService with comprehensive checking logic
- Add achievement route with 6 API endpoints
- Integrate achievement checking into all user interaction points:
  - Suggestions (create + accept)
  - Likes (toggle)
  - Comments (all 6 media types)
  - Login streaks
  - Reports (profile + comment)
- Update UserService to include achievement points in profiles

**Frontend Implementation:**
- Create AchievementService for API communication
- Create achievements page showing all 62 achievements with:
  - Category filtering (All, Suggestions, Likes, Comments, Engagement, Reports)
  - Tier-based styling (Bronze, Silver, Gold, Platinum, Diamond)
  - Progress indicators for in-progress achievements
  - Earned date display for completed achievements
- Add "Recent Achievements" section to user profiles
- Add "🏆 Achievements" link to header navigation
- Only show "View All" link on own profile

**Technical Features:**
- Real-time achievement checking on user actions
- Progress tracking to avoid recalculation
- Points system for gamification
- Tier-based gradient styling
- Leaderboard-ready architecture

Resolves #48

Co-Authored-By: Hikari <hikari@nhcarrigan.com>
2026-02-19 22:02:10 -08:00
hikari 9d965808a7 feat: add primary badge selection for user profiles
Implements #49 - Allow users to select one primary badge to display
on their profile instead of showing all badges at once.

Changes:
- Add PrimaryBadge enum to Prisma schema and shared types (STAFF, MOD, VIP, DISCORD)
- Add primaryBadge field to User model and all user interfaces
- Update settings component with badge selection dropdown
- Only show badges the user actually has in the dropdown
- Update profile component to display only selected badge (or all if none selected)
- Add primaryBadge to admin profile edit modal
- Update API routes and services to handle primaryBadge
- Export PrimaryBadge enum from shared-types (not just as type)

Additional fixes:
- Fix Angular output naming: rename onEdit/onDelete to edit/delete
- Update all parent components using comment-display outputs
- Add type casting for Prisma PrimaryBadge enum to shared-types enum
2026-02-19 20:28:23 -08:00
hikari c154ef1897 feat: add admin profile editing capability
Added admin endpoint and functionality for editing user profiles from the
report management interface:

Backend Changes:
- Added PUT /api/users/:id endpoint for admin-only profile editing
- Reuses existing updateUserSettings logic with slug uniqueness validation
- Protected with adminGuard and csrfProtection
- Proper audit logging for admin profile edits

Frontend Changes:
- Added adminUpdateUser() method to UserService
- Updated editProfile() in admin-reports to load profile and allow bio editing
- Uses prompt for quick bio editing (can be expanded to full form later)
- Shows success/error toasts and refreshes report list after edit

Admins can now quickly edit reported user profiles directly from the
report management interface.
2026-02-19 20:05:57 -08:00
hikari 6e884b9ae8 feat: implement admin action APIs for comment and profile moderation
Added full API implementation for admin action buttons in the report
management interface:

Backend Changes:
- Created new /api/comments routes for admin-only comment operations
- Added PUT /api/comments/:id for admin comment editing
- Added DELETE /api/comments/:id for admin comment deletion
- Added POST /api/users/:id/make-private for admin profile privacy control
- All endpoints protected with adminGuard and csrfProtection
- Proper audit logging for all admin actions
- Added onDelete: Cascade to CommentReport relation for safe comment deletion

Frontend Changes:
- Added adminUpdateComment() and adminDeleteComment() to CommentsService
- Added makeProfilePrivate() to UserService
- Integrated API calls into admin-reports component methods
- editComment() now updates comment via API and refreshes report list
- deleteComment() now deletes comment via API and refreshes report list
- makeProfilePrivate() now updates profile privacy via API
- editProfile() navigates using ObjectId instead of Discord username
- All actions show success/error toasts and close modals on completion

The admin interface now has full working moderation capabilities for both
comment and profile reports.
2026-02-19 19:58:13 -08:00
naomi 5eec4c7640 feat: add social links with validation and Font Awesome icons
Added comprehensive social links functionality to user profiles:

**New Social Platforms:**
- Website (full URL validation)
- GitHub (username format)
- Bluesky (handle format)
- LinkedIn (username format)
- Twitch (username format)
- YouTube (handle or channel ID format)
- Discord Server (invite code format)

**Features:**
- Database schema updated with 7 new optional social link fields
- Backend services and API routes updated to handle all social links
- Settings form with input fields and helpful validation hints
- Profile display with Font Awesome icons for each platform
- Regex validation patterns for all fields with visual feedback
- Green border for valid input, red border for invalid input
- All form inputs use consistent type="text" for uniform styling
- Discord accepts just invite code (constructs full URL automatically)

**Technical Changes:**
- Installed @fortawesome/angular-fontawesome with pinned versions
- Replaced emoji icons with proper Font Awesome components
- Added FontAwesomeModule to profile component
- Updated all User type interfaces across frontend and backend
- Updated UserService mappings in all methods
- Added comprehensive regex patterns matching platform requirements

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-19 17:59:10 -08:00
hikari 34c7ca8ba2 feat: implement user profiles and settings
Add comprehensive user profile system allowing users to showcase
their activity and customize their profiles.

Database Changes:
- Added profile fields to User model: slug, displayName, bio, profilePublic
- Added index on slug field for efficient lookups

API Changes:
- Added GET /users/me endpoint to fetch current user
- Added PUT /users/me endpoint to update user settings
- Added GET /users/profile/:identifier endpoint for public profiles
- Updated UserService with profile methods and statistics
- Modified AuthService to include profile fields in user responses

Frontend Changes:
- Created ProfileComponent to display user profiles with stats
- Created SettingsComponent for profile customization
- Added profile and settings routes
- Updated header dropdown menu with profile links
- Enhanced UserService with profile methods
- Added updateUser method to AuthService

Features:
- Custom profile slugs for clean URLs
- Display names separate from usernames
- User bios (up to 500 characters)
- Public/private profile toggle
- Activity statistics (suggestions, likes, comments, acceptance rate)
- Badge display (Staff, Mod, VIP, Discord Member)
- Beautiful witch-themed styling

Closes #45
2026-02-19 17:27:35 -08:00
naomi 0a654f423a feat: security and auditing 2026-02-04 16:48:08 -08:00