-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateTestGroups.js
More file actions
88 lines (76 loc) · 2.8 KB
/
Copy pathcreateTestGroups.js
File metadata and controls
88 lines (76 loc) · 2.8 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
/**
* Test utility to create sample groups for testing
* Run this to populate the database with test groups
*/
import { GroupService } from './src/services/GroupService.js';
import { AuthService } from './src/services/AuthService.js';
const createTestGroups = async () => {
try {
console.log('Creating test groups...');
// Make sure user is authenticated (this would be the current user)
const currentUser = AuthService.getCurrentUser();
if (!currentUser) {
console.error('No authenticated user found. Please login first.');
return;
}
console.log('Current user:', currentUser.uid);
const testGroups = [
{
name: 'React Native Developers',
description: 'A group for React Native enthusiasts to share knowledge and collaborate on mobile app projects.',
type: 'study',
tags: ['React Native', 'Mobile Development', 'JavaScript'],
isPrivate: false
},
{
name: 'AI/ML Study Group',
description: 'Join us to explore artificial intelligence and machine learning concepts together.',
type: 'study',
tags: ['AI', 'Machine Learning', 'Python', 'Data Science'],
isPrivate: false
},
{
name: 'Campus Hackathon Team',
description: 'Building the next big thing for our upcoming hackathon competition.',
type: 'project',
tags: ['Hackathon', 'Innovation', 'Teamwork'],
isPrivate: false
},
{
name: 'Web Development Bootcamp',
description: 'Learning full-stack web development together - from frontend to backend.',
type: 'study',
tags: ['Web Development', 'JavaScript', 'Node.js', 'React'],
isPrivate: false
}
];
const createdGroups = [];
for (const groupData of testGroups) {
try {
console.log(`Creating group: ${groupData.name}`);
const result = await GroupService.createGroup(groupData);
console.log(`✅ Created group: ${groupData.name} with ID: ${result.groupId}`);
createdGroups.push({ ...groupData, id: result.groupId });
} catch (error) {
console.error(`❌ Failed to create group ${groupData.name}:`, error.message);
}
}
console.log(`\n🎉 Successfully created ${createdGroups.length} test groups!`);
console.log('Groups created:', createdGroups.map(g => g.name));
return createdGroups;
} catch (error) {
console.error('❌ Error creating test groups:', error);
}
};
// Export for use in other files
export { createTestGroups };
// If running this file directly
if (typeof window === 'undefined') {
createTestGroups()
.then(() => {
console.log('Test groups creation completed');
})
.catch((error) => {
console.error('Test groups creation failed:', error);
});
}