-
Notifications
You must be signed in to change notification settings - Fork 269
Expand file tree
/
Copy pathachievements.seed.ts
More file actions
320 lines (314 loc) · 8.6 KB
/
Copy pathachievements.seed.ts
File metadata and controls
320 lines (314 loc) · 8.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
import { AchievementType, AchievementDifficulty } from './entities/achievement.entity';
/**
* Seed data for default achievements
* This can be used to populate the database with standard achievements
*/
export const DEFAULT_ACHIEVEMENTS = [
// Milestone achievements
{
name: 'First Lesson',
description: 'Complete your first lesson',
longDescription: 'Begin your learning journey by completing your first lesson',
iconUrl: 'https://example.com/icons/first-lesson.png',
type: AchievementType.MILESTONE,
difficulty: AchievementDifficulty.EASY,
pointsReward: 50,
experienceReward: 25,
criteria: {
type: 'LESSONS_COMPLETED',
target: 1,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 1,
},
},
{
name: 'Lesson Enthusiast',
description: 'Complete 10 lessons',
longDescription: 'Demonstrates consistent engagement with learning',
iconUrl: 'https://example.com/icons/lesson-enthusiast.png',
type: AchievementType.MILESTONE,
difficulty: AchievementDifficulty.MEDIUM,
pointsReward: 150,
experienceReward: 100,
criteria: {
type: 'LESSONS_COMPLETED',
target: 10,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 10,
},
},
{
name: 'Lesson Master',
description: 'Complete 50 lessons',
longDescription: 'You are a dedicated learner',
iconUrl: 'https://example.com/icons/lesson-master.png',
type: AchievementType.MILESTONE,
difficulty: AchievementDifficulty.HARD,
pointsReward: 500,
experienceReward: 250,
criteria: {
type: 'LESSONS_COMPLETED',
target: 50,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 50,
},
},
{
name: 'First Course',
description: 'Complete your first course',
longDescription: 'Celebrate completing your first full course',
iconUrl: 'https://example.com/icons/first-course.png',
type: AchievementType.MILESTONE,
difficulty: AchievementDifficulty.EASY,
pointsReward: 100,
experienceReward: 50,
criteria: {
type: 'COURSES_COMPLETED',
target: 1,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 1,
},
},
{
name: 'Course Champion',
description: 'Complete 5 courses',
longDescription: 'You have completed multiple courses',
iconUrl: 'https://example.com/icons/course-champion.png',
type: AchievementType.MILESTONE,
difficulty: AchievementDifficulty.HARD,
pointsReward: 400,
experienceReward: 200,
criteria: {
type: 'COURSES_COMPLETED',
target: 5,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 5,
},
},
// Streak achievements
{
name: 'Week Warrior',
description: 'Maintain a 7-day streak',
longDescription: 'Complete at least one lesson every day for a week',
iconUrl: 'https://example.com/icons/week-warrior.png',
type: AchievementType.STREAKS,
difficulty: AchievementDifficulty.MEDIUM,
pointsReward: 200,
experienceReward: 100,
criteria: {
type: 'DAYS_STREAK',
target: 7,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 7,
},
},
{
name: 'Month Marathon',
description: 'Maintain a 30-day streak',
longDescription: 'Complete at least one lesson every day for a month',
iconUrl: 'https://example.com/icons/month-marathon.png',
type: AchievementType.STREAKS,
difficulty: AchievementDifficulty.HARD,
pointsReward: 600,
experienceReward: 300,
criteria: {
type: 'DAYS_STREAK',
target: 30,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 30,
},
},
{
name: 'Unstoppable',
description: 'Maintain a 100-day streak',
longDescription: 'An incredible display of dedication and consistency',
iconUrl: 'https://example.com/icons/unstoppable.png',
type: AchievementType.STREAKS,
difficulty: AchievementDifficulty.LEGENDARY,
pointsReward: 2000,
experienceReward: 1000,
criteria: {
type: 'DAYS_STREAK',
target: 100,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 100,
},
},
// Skill-based achievements
{
name: 'Quick Learner',
description: 'Complete a lesson in under 5 minutes',
longDescription: 'Demonstrates rapid comprehension',
iconUrl: 'https://example.com/icons/quick-learner.png',
type: AchievementType.SKILL_BASED,
difficulty: AchievementDifficulty.MEDIUM,
pointsReward: 150,
experienceReward: 75,
criteria: {
type: 'LESSON_TIME',
target: 5,
unit: 'minutes',
},
progressConfig: {
trackingType: 'binary',
maxProgress: 1,
},
},
{
name: 'Perfect Score',
description: 'Achieve 100% on a lesson assessment',
longDescription: 'Demonstrates mastery of the material',
iconUrl: 'https://example.com/icons/perfect-score.png',
type: AchievementType.SKILL_BASED,
difficulty: AchievementDifficulty.HARD,
pointsReward: 300,
experienceReward: 150,
criteria: {
type: 'ASSESSMENT_SCORE',
target: 100,
},
progressConfig: {
trackingType: 'binary',
maxProgress: 1,
},
},
// Engagement achievements
{
name: 'Early Bird',
description: 'Complete a lesson before 9 AM',
longDescription: 'Start your day with learning',
iconUrl: 'https://example.com/icons/early-bird.png',
type: AchievementType.ENGAGEMENT,
difficulty: AchievementDifficulty.EASY,
pointsReward: 50,
experienceReward: 25,
criteria: {
type: 'COMPLETION_TIME',
target: '09:00',
},
progressConfig: {
trackingType: 'binary',
maxProgress: 1,
},
},
{
name: 'Active Participant',
description: 'Post 5 discussion comments',
longDescription: 'Engage with the learning community',
iconUrl: 'https://example.com/icons/active-participant.png',
type: AchievementType.ENGAGEMENT,
difficulty: AchievementDifficulty.MEDIUM,
pointsReward: 200,
experienceReward: 100,
criteria: {
type: 'DISCUSSION_POSTS',
target: 5,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 5,
},
},
{
name: 'Community Helper',
description: 'Receive 10 helpful votes on forum posts',
longDescription: 'Help others in the community',
iconUrl: 'https://example.com/icons/community-helper.png',
type: AchievementType.ENGAGEMENT,
difficulty: AchievementDifficulty.HARD,
pointsReward: 400,
experienceReward: 200,
criteria: {
type: 'HELPFUL_VOTES',
target: 10,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 10,
},
},
// Contribution achievements
{
name: 'Educator',
description: 'Create your first course',
longDescription: 'Share your knowledge with others',
iconUrl: 'https://example.com/icons/educator.png',
type: AchievementType.CONTRIBUTION,
difficulty: AchievementDifficulty.HARD,
pointsReward: 500,
experienceReward: 250,
criteria: {
type: 'COURSES_CREATED',
target: 1,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 1,
},
},
{
name: 'Course Creator',
description: 'Create 5 courses',
longDescription: 'Establish yourself as a course creator',
iconUrl: 'https://example.com/icons/course-creator.png',
type: AchievementType.CONTRIBUTION,
difficulty: AchievementDifficulty.LEGENDARY,
pointsReward: 1500,
experienceReward: 750,
criteria: {
type: 'COURSES_CREATED',
target: 5,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 5,
},
},
{
name: 'Lesson Author',
description: 'Create 10 lessons',
longDescription: 'Create comprehensive learning content',
iconUrl: 'https://example.com/icons/lesson-author.png',
type: AchievementType.CONTRIBUTION,
difficulty: AchievementDifficulty.HARD,
pointsReward: 600,
experienceReward: 300,
criteria: {
type: 'LESSONS_CREATED',
target: 10,
},
progressConfig: {
trackingType: 'incremental',
maxProgress: 10,
},
},
];
/**
* Helper function to seed achievements into the database
*/
export async function seedAchievements(achievementsService: any): Promise<void> {
try {
for (const achievementData of DEFAULT_ACHIEVEMENTS) {
await achievementsService.createAchievement(achievementData);
}
console.log(`✅ Seeded ${DEFAULT_ACHIEVEMENTS.length} achievements`);
} catch (error) {
console.error('❌ Error seeding achievements:', error);
}
}