generated from nhcarrigan/template
feat: implement comprehensive achievement system with 62 achievements
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>
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
export * from "./lib/achievement.constants";
|
||||
export * from "./lib/achievement.types";
|
||||
export type * from "./lib/art.types";
|
||||
export * from "./lib/audit.types";
|
||||
export * from "./lib/auth.types";
|
||||
|
||||
@@ -0,0 +1,644 @@
|
||||
/**
|
||||
* @copyright NHCarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import {
|
||||
AchievementCategory,
|
||||
AchievementDefinition,
|
||||
AchievementTier,
|
||||
} from "./achievement.types";
|
||||
|
||||
export const ACHIEVEMENTS: Record<string, AchievementDefinition> = {
|
||||
// ========== SUGGESTION ACHIEVEMENTS (15) ==========
|
||||
suggestion_first_steps: {
|
||||
key: "suggestion_first_steps",
|
||||
title: "First Steps",
|
||||
description: "Submit your first 10 suggestions to the library",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Bronze,
|
||||
icon: "🌱",
|
||||
points: 50,
|
||||
requirements: { count: 10 },
|
||||
},
|
||||
suggestion_contributor: {
|
||||
key: "suggestion_contributor",
|
||||
title: "Contributor",
|
||||
description: "Submit 50 suggestions to the library",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "📝",
|
||||
points: 100,
|
||||
requirements: { count: 50 },
|
||||
},
|
||||
suggestion_dedicated: {
|
||||
key: "suggestion_dedicated",
|
||||
title: "Dedicated",
|
||||
description: "Submit 100 suggestions to the library",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "⭐",
|
||||
points: 250,
|
||||
requirements: { count: 100 },
|
||||
},
|
||||
suggestion_master: {
|
||||
key: "suggestion_master",
|
||||
title: "Master Curator",
|
||||
description: "Submit 250 suggestions to the library",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "💎",
|
||||
points: 500,
|
||||
requirements: { count: 250 },
|
||||
},
|
||||
suggestion_legend: {
|
||||
key: "suggestion_legend",
|
||||
title: "Legend",
|
||||
description: "Submit 500 suggestions to the library",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Diamond,
|
||||
icon: "👑",
|
||||
points: 1000,
|
||||
requirements: { count: 500 },
|
||||
},
|
||||
suggestion_approved: {
|
||||
key: "suggestion_approved",
|
||||
title: "Approved!",
|
||||
description: "Have your first suggestion accepted",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Bronze,
|
||||
icon: "✅",
|
||||
points: 50,
|
||||
requirements: { count: 1 },
|
||||
},
|
||||
suggestion_quality_5: {
|
||||
key: "suggestion_quality_5",
|
||||
title: "Quality Curator",
|
||||
description: "Have 5 suggestions accepted",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "🌟",
|
||||
points: 100,
|
||||
requirements: { count: 5 },
|
||||
},
|
||||
suggestion_quality_10: {
|
||||
key: "suggestion_quality_10",
|
||||
title: "Elite Curator",
|
||||
description: "Have 10 suggestions accepted",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "🏆",
|
||||
points: 200,
|
||||
requirements: { count: 10 },
|
||||
},
|
||||
suggestion_quality_25: {
|
||||
key: "suggestion_quality_25",
|
||||
title: "Master Curator",
|
||||
description: "Have 25 suggestions accepted",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "💫",
|
||||
points: 400,
|
||||
requirements: { count: 25 },
|
||||
},
|
||||
suggestion_quality_50: {
|
||||
key: "suggestion_quality_50",
|
||||
title: "Grand Master",
|
||||
description: "Have 50 suggestions accepted",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "🎖️",
|
||||
points: 700,
|
||||
requirements: { count: 50 },
|
||||
},
|
||||
suggestion_quality_100: {
|
||||
key: "suggestion_quality_100",
|
||||
title: "Ultimate Curator",
|
||||
description: "Have 100 suggestions accepted",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Diamond,
|
||||
icon: "👸",
|
||||
points: 1500,
|
||||
requirements: { count: 100 },
|
||||
},
|
||||
suggestion_acceptance_75: {
|
||||
key: "suggestion_acceptance_75",
|
||||
title: "Quality Over Quantity",
|
||||
description: "Maintain a 75%+ acceptance rate (minimum 20 suggestions)",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "🎯",
|
||||
points: 300,
|
||||
requirements: { rate: 0.75, count: 20 },
|
||||
},
|
||||
suggestion_acceptance_100: {
|
||||
key: "suggestion_acceptance_100",
|
||||
title: "Perfect Record",
|
||||
description: "Achieve 100% acceptance rate (minimum 10 suggestions)",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "✨",
|
||||
points: 500,
|
||||
requirements: { rate: 1.0, count: 10 },
|
||||
},
|
||||
suggestion_renaissance: {
|
||||
key: "suggestion_renaissance",
|
||||
title: "Renaissance Person",
|
||||
description: "Submit accepted suggestions across all 6 media types",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "🌈",
|
||||
points: 400,
|
||||
requirements: { diversity: true },
|
||||
},
|
||||
suggestion_enthusiast: {
|
||||
key: "suggestion_enthusiast",
|
||||
title: "Suggestion Enthusiast",
|
||||
description: "Submit 5 suggestions in one day",
|
||||
category: AchievementCategory.Suggestion,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "🔥",
|
||||
points: 150,
|
||||
requirements: { count: 5, dayRange: 1 },
|
||||
},
|
||||
|
||||
// ========== LIKE ACHIEVEMENTS (12) ==========
|
||||
like_first: {
|
||||
key: "like_first",
|
||||
title: "First Like",
|
||||
description: "Like your first item in the library",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Bronze,
|
||||
icon: "❤️",
|
||||
points: 25,
|
||||
requirements: { count: 1 },
|
||||
},
|
||||
like_enthusiast: {
|
||||
key: "like_enthusiast",
|
||||
title: "Enthusiast",
|
||||
description: "Like 25 items in the library",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Bronze,
|
||||
icon: "💕",
|
||||
points: 50,
|
||||
requirements: { count: 25 },
|
||||
},
|
||||
like_fan: {
|
||||
key: "like_fan",
|
||||
title: "Fan",
|
||||
description: "Like 100 items in the library",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "💖",
|
||||
points: 100,
|
||||
requirements: { count: 100 },
|
||||
},
|
||||
like_super_fan: {
|
||||
key: "like_super_fan",
|
||||
title: "Super Fan",
|
||||
description: "Like 250 items in the library",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "💝",
|
||||
points: 250,
|
||||
requirements: { count: 250 },
|
||||
},
|
||||
like_mega_fan: {
|
||||
key: "like_mega_fan",
|
||||
title: "Mega Fan",
|
||||
description: "Like 500 items in the library",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "💗",
|
||||
points: 500,
|
||||
requirements: { count: 500 },
|
||||
},
|
||||
like_legendary: {
|
||||
key: "like_legendary",
|
||||
title: "Legendary Fan",
|
||||
description: "Like 1000 items in the library",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Diamond,
|
||||
icon: "💞",
|
||||
points: 1000,
|
||||
requirements: { count: 1000 },
|
||||
},
|
||||
like_book_lover: {
|
||||
key: "like_book_lover",
|
||||
title: "Book Lover",
|
||||
description: "Like 50 books",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "📚",
|
||||
points: 100,
|
||||
requirements: { count: 50 },
|
||||
},
|
||||
like_gamer: {
|
||||
key: "like_gamer",
|
||||
title: "Gamer",
|
||||
description: "Like 50 games",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "🎮",
|
||||
points: 100,
|
||||
requirements: { count: 50 },
|
||||
},
|
||||
like_cinephile: {
|
||||
key: "like_cinephile",
|
||||
title: "Cinephile",
|
||||
description: "Like 50 shows/films",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "🎬",
|
||||
points: 100,
|
||||
requirements: { count: 50 },
|
||||
},
|
||||
like_music: {
|
||||
key: "like_music",
|
||||
title: "Music Enthusiast",
|
||||
description: "Like 50 music albums",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "🎵",
|
||||
points: 100,
|
||||
requirements: { count: 50 },
|
||||
},
|
||||
like_diverse: {
|
||||
key: "like_diverse",
|
||||
title: "Diverse Taste",
|
||||
description: "Like items from all 6 media types",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "🌍",
|
||||
points: 200,
|
||||
requirements: { diversity: true },
|
||||
},
|
||||
like_binge: {
|
||||
key: "like_binge",
|
||||
title: "Binge Liker",
|
||||
description: "Like 20+ items in one day",
|
||||
category: AchievementCategory.Like,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "⚡",
|
||||
points: 150,
|
||||
requirements: { count: 20, dayRange: 1 },
|
||||
},
|
||||
|
||||
// ========== COMMENT ACHIEVEMENTS (12) ==========
|
||||
comment_first: {
|
||||
key: "comment_first",
|
||||
title: "First Thoughts",
|
||||
description: "Leave your first comment in the library",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Bronze,
|
||||
icon: "💬",
|
||||
points: 25,
|
||||
requirements: { count: 1 },
|
||||
},
|
||||
comment_reviewer: {
|
||||
key: "comment_reviewer",
|
||||
title: "Reviewer",
|
||||
description: "Leave 10 comments in the library",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Bronze,
|
||||
icon: "✍️",
|
||||
points: 50,
|
||||
requirements: { count: 10 },
|
||||
},
|
||||
comment_critic: {
|
||||
key: "comment_critic",
|
||||
title: "Critic",
|
||||
description: "Leave 50 comments in the library",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "🗣️",
|
||||
points: 100,
|
||||
requirements: { count: 50 },
|
||||
},
|
||||
comment_expert: {
|
||||
key: "comment_expert",
|
||||
title: "Expert Critic",
|
||||
description: "Leave 100 comments in the library",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "🎭",
|
||||
points: 250,
|
||||
requirements: { count: 100 },
|
||||
},
|
||||
comment_master: {
|
||||
key: "comment_master",
|
||||
title: "Master Reviewer",
|
||||
description: "Leave 250 comments in the library",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "📖",
|
||||
points: 500,
|
||||
requirements: { count: 250 },
|
||||
},
|
||||
comment_legend: {
|
||||
key: "comment_legend",
|
||||
title: "Review Legend",
|
||||
description: "Leave 500 comments in the library",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Diamond,
|
||||
icon: "🏅",
|
||||
points: 1000,
|
||||
requirements: { count: 500 },
|
||||
},
|
||||
comment_detailed: {
|
||||
key: "comment_detailed",
|
||||
title: "Detailed Critic",
|
||||
description: "Write 10 comments with 500+ characters",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "📝",
|
||||
points: 150,
|
||||
requirements: { count: 10 },
|
||||
},
|
||||
comment_essay: {
|
||||
key: "comment_essay",
|
||||
title: "Essay Writer",
|
||||
description: "Write 5 comments with 1000+ characters",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "📄",
|
||||
points: 300,
|
||||
requirements: { count: 5 },
|
||||
},
|
||||
comment_novel: {
|
||||
key: "comment_novel",
|
||||
title: "Novel Writer",
|
||||
description: "Write 3 comments with 2000+ characters",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "📚",
|
||||
points: 500,
|
||||
requirements: { count: 3 },
|
||||
},
|
||||
comment_thoughtful: {
|
||||
key: "comment_thoughtful",
|
||||
title: "Thoughtful Reviewer",
|
||||
description: "Comment on 50 different items",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "💭",
|
||||
points: 150,
|
||||
requirements: { uniqueItems: 50 },
|
||||
},
|
||||
comment_diverse: {
|
||||
key: "comment_diverse",
|
||||
title: "Well-Rounded Critic",
|
||||
description: "Comment on all 6 media types",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "🎨",
|
||||
points: 250,
|
||||
requirements: { diversity: true },
|
||||
},
|
||||
comment_first_to_comment: {
|
||||
key: "comment_first_to_comment",
|
||||
title: "Discussion Starter",
|
||||
description: "Be the first to comment on 10 items",
|
||||
category: AchievementCategory.Comment,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "🗨️",
|
||||
points: 200,
|
||||
requirements: { count: 10 },
|
||||
},
|
||||
|
||||
// ========== ENGAGEMENT ACHIEVEMENTS (15) ==========
|
||||
engagement_welcome: {
|
||||
key: "engagement_welcome",
|
||||
title: "Welcome!",
|
||||
description: "Complete your profile setup",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Bronze,
|
||||
icon: "👋",
|
||||
points: 25,
|
||||
requirements: {},
|
||||
},
|
||||
engagement_streak_7: {
|
||||
key: "engagement_streak_7",
|
||||
title: "Daily Visitor",
|
||||
description: "Login for 7 days in a row",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Bronze,
|
||||
icon: "🔥",
|
||||
points: 100,
|
||||
requirements: { streak: 7 },
|
||||
},
|
||||
engagement_streak_30: {
|
||||
key: "engagement_streak_30",
|
||||
title: "Dedicated",
|
||||
description: "Login for 30 days in a row",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "💪",
|
||||
points: 250,
|
||||
requirements: { streak: 30 },
|
||||
},
|
||||
engagement_streak_100: {
|
||||
key: "engagement_streak_100",
|
||||
title: "Committed",
|
||||
description: "Login for 100 days in a row",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "🏆",
|
||||
points: 500,
|
||||
requirements: { streak: 100 },
|
||||
},
|
||||
engagement_streak_365: {
|
||||
key: "engagement_streak_365",
|
||||
title: "Unstoppable",
|
||||
description: "Login for 365 days in a row",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Diamond,
|
||||
icon: "⚡",
|
||||
points: 2000,
|
||||
requirements: { streak: 365 },
|
||||
},
|
||||
engagement_triple_threat: {
|
||||
key: "engagement_triple_threat",
|
||||
title: "Triple Threat",
|
||||
description: "Submit a suggestion, like an item, and leave a comment in the same day",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "🎯",
|
||||
points: 200,
|
||||
requirements: { dayRange: 1 },
|
||||
},
|
||||
engagement_power_user: {
|
||||
key: "engagement_power_user",
|
||||
title: "Power User",
|
||||
description: "Achieve Triple Threat 10 times",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "💫",
|
||||
points: 750,
|
||||
requirements: { count: 10 },
|
||||
},
|
||||
engagement_early_adopter: {
|
||||
key: "engagement_early_adopter",
|
||||
title: "Early Adopter",
|
||||
description: "Be among the first 10 users to join",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Diamond,
|
||||
icon: "🌟",
|
||||
points: 1000,
|
||||
requirements: {},
|
||||
},
|
||||
engagement_founding_100: {
|
||||
key: "engagement_founding_100",
|
||||
title: "Founding Member",
|
||||
description: "Be among the first 100 users to join",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "🎖️",
|
||||
points: 500,
|
||||
requirements: {},
|
||||
},
|
||||
engagement_founding_1000: {
|
||||
key: "engagement_founding_1000",
|
||||
title: "Pioneer",
|
||||
description: "Be among the first 1000 users to join",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "🚀",
|
||||
points: 200,
|
||||
requirements: {},
|
||||
},
|
||||
engagement_veteran_30: {
|
||||
key: "engagement_veteran_30",
|
||||
title: "Veteran",
|
||||
description: "Have an account for 30 days",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Bronze,
|
||||
icon: "⏰",
|
||||
points: 50,
|
||||
requirements: { dayRange: 30 },
|
||||
},
|
||||
engagement_veteran_180: {
|
||||
key: "engagement_veteran_180",
|
||||
title: "Seasoned",
|
||||
description: "Have an account for 6 months",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "📅",
|
||||
points: 150,
|
||||
requirements: { dayRange: 180 },
|
||||
},
|
||||
engagement_veteran_365: {
|
||||
key: "engagement_veteran_365",
|
||||
title: "Longstanding",
|
||||
description: "Have an account for 1 year",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "🎂",
|
||||
points: 300,
|
||||
requirements: { dayRange: 365 },
|
||||
},
|
||||
engagement_veteran_730: {
|
||||
key: "engagement_veteran_730",
|
||||
title: "Elder",
|
||||
description: "Have an account for 2 years",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "🗓️",
|
||||
points: 600,
|
||||
requirements: { dayRange: 730 },
|
||||
},
|
||||
engagement_veteran_1825: {
|
||||
key: "engagement_veteran_1825",
|
||||
title: "Legend",
|
||||
description: "Have an account for 5 years",
|
||||
category: AchievementCategory.Engagement,
|
||||
tier: AchievementTier.Diamond,
|
||||
icon: "🌠",
|
||||
points: 1500,
|
||||
requirements: { dayRange: 1825 },
|
||||
},
|
||||
|
||||
// ========== REPORT ACHIEVEMENTS (8) ==========
|
||||
report_watchful: {
|
||||
key: "report_watchful",
|
||||
title: "Watchful Eye",
|
||||
description: "Submit your first valid report (ACTION_TAKEN)",
|
||||
category: AchievementCategory.Report,
|
||||
tier: AchievementTier.Bronze,
|
||||
icon: "👀",
|
||||
points: 50,
|
||||
requirements: { count: 1 },
|
||||
},
|
||||
report_guardian: {
|
||||
key: "report_guardian",
|
||||
title: "Guardian",
|
||||
description: "Have 5 reports result in ACTION_TAKEN",
|
||||
category: AchievementCategory.Report,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "🛡️",
|
||||
points: 100,
|
||||
requirements: { count: 5 },
|
||||
},
|
||||
report_protector: {
|
||||
key: "report_protector",
|
||||
title: "Protector",
|
||||
description: "Have 10 reports result in ACTION_TAKEN",
|
||||
category: AchievementCategory.Report,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "⚔️",
|
||||
points: 250,
|
||||
requirements: { count: 10 },
|
||||
},
|
||||
report_vigilant: {
|
||||
key: "report_vigilant",
|
||||
title: "Vigilant Protector",
|
||||
description: "Have 25 reports result in ACTION_TAKEN",
|
||||
category: AchievementCategory.Report,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "🔰",
|
||||
points: 500,
|
||||
requirements: { count: 25 },
|
||||
},
|
||||
report_accuracy_80: {
|
||||
key: "report_accuracy_80",
|
||||
title: "Sharp Eye",
|
||||
description: "Maintain 80%+ ACTION_TAKEN rate (minimum 10 reports)",
|
||||
category: AchievementCategory.Report,
|
||||
tier: AchievementTier.Gold,
|
||||
icon: "🎯",
|
||||
points: 300,
|
||||
requirements: { rate: 0.8, count: 10 },
|
||||
},
|
||||
report_accuracy_90: {
|
||||
key: "report_accuracy_90",
|
||||
title: "Eagle Eye",
|
||||
description: "Maintain 90%+ ACTION_TAKEN rate (minimum 10 reports)",
|
||||
category: AchievementCategory.Report,
|
||||
tier: AchievementTier.Platinum,
|
||||
icon: "🦅",
|
||||
points: 500,
|
||||
requirements: { rate: 0.9, count: 10 },
|
||||
},
|
||||
report_consistent: {
|
||||
key: "report_consistent",
|
||||
title: "Consistent Guardian",
|
||||
description: "Submit at least one report weekly for 4 weeks",
|
||||
category: AchievementCategory.Report,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "📆",
|
||||
points: 200,
|
||||
requirements: { count: 4 },
|
||||
},
|
||||
report_volume: {
|
||||
key: "report_volume",
|
||||
title: "Dedicated Reporter",
|
||||
description: "Submit 50 reports (any status)",
|
||||
category: AchievementCategory.Report,
|
||||
tier: AchievementTier.Silver,
|
||||
icon: "📝",
|
||||
points: 150,
|
||||
requirements: { count: 50 },
|
||||
},
|
||||
};
|
||||
|
||||
export const ACHIEVEMENT_LIST = Object.values(ACHIEVEMENTS);
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @copyright NHCarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
export enum AchievementCategory {
|
||||
Suggestion = "SUGGESTION",
|
||||
Like = "LIKE",
|
||||
Comment = "COMMENT",
|
||||
Engagement = "ENGAGEMENT",
|
||||
Report = "REPORT",
|
||||
}
|
||||
|
||||
export enum AchievementTier {
|
||||
Bronze = "BRONZE",
|
||||
Silver = "SILVER",
|
||||
Gold = "GOLD",
|
||||
Platinum = "PLATINUM",
|
||||
Diamond = "DIAMOND",
|
||||
}
|
||||
|
||||
export interface AchievementRequirements {
|
||||
count?: number;
|
||||
rate?: number;
|
||||
streak?: number;
|
||||
diversity?: boolean;
|
||||
uniqueItems?: number;
|
||||
dayRange?: number;
|
||||
}
|
||||
|
||||
export interface AchievementDefinition {
|
||||
key: string;
|
||||
title: string;
|
||||
description: string;
|
||||
category: AchievementCategory;
|
||||
tier: AchievementTier;
|
||||
icon: string;
|
||||
points: number;
|
||||
requirements: AchievementRequirements;
|
||||
}
|
||||
|
||||
export interface UserAchievement {
|
||||
id: string;
|
||||
userId: string;
|
||||
achievementKey: string;
|
||||
progress: number;
|
||||
earned: boolean;
|
||||
earnedAt?: Date;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export interface AchievementProgress {
|
||||
definition: AchievementDefinition;
|
||||
progress: number;
|
||||
earned: boolean;
|
||||
earnedAt?: Date;
|
||||
}
|
||||
|
||||
export interface UserAchievementSummary {
|
||||
totalPoints: number;
|
||||
totalEarned: number;
|
||||
recentAchievements: AchievementProgress[];
|
||||
progressByCategory: {
|
||||
category: AchievementCategory;
|
||||
earned: number;
|
||||
total: number;
|
||||
}[];
|
||||
}
|
||||
@@ -21,6 +21,7 @@ enum AuditAction {
|
||||
rateLimitExceeded = "RATE_LIMIT_EXCEEDED",
|
||||
csrfValidationFailed = "CSRF_VALIDATION_FAILED",
|
||||
unauthorizedAccess = "UNAUTHORIZED_ACCESS",
|
||||
achievementUnlocked = "ACHIEVEMENT_UNLOCKED",
|
||||
}
|
||||
|
||||
enum AuditCategory {
|
||||
|
||||
Reference in New Issue
Block a user