-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsetup-test-data.js
More file actions
65 lines (56 loc) · 1.85 KB
/
setup-test-data.js
File metadata and controls
65 lines (56 loc) · 1.85 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
const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();
async function setupTestData() {
try {
console.log("Setting up test data...");
// Check if test user exists
let user = await prisma.user.findUnique({
where: { id: "test-user-123" },
});
if (!user) {
// Create test user
console.log("Creating test user...");
user = await prisma.user.create({
data: {
id: "test-user-123",
nickname: "TestUser",
email: "test@example.com",
},
});
console.log("Test user created:", user);
} else {
console.log("Test user already exists:", user);
}
// Check all communities
const communities = await prisma.community.findMany({
select: { id: true, subdomain: true, displayName: true, createdAt: true },
});
console.log("Available communities:", communities);
// Check for ALL dev communities
const devCommunities = await prisma.community.findMany({
where: { subdomain: "dev" },
});
console.log("Dev communities found:", devCommunities.length);
devCommunities.forEach((community, index) => {
console.log(` Dev community ${index + 1}:`, {
id: community.id,
displayName: community.displayName,
createdAt: community.createdAt,
});
});
// Check existing profiles for our test user
const existingProfiles = await prisma.profile.findMany({
where: { userId: "test-user-123" },
include: {
community: { select: { subdomain: true, displayName: true } },
},
});
console.log("Existing profiles for test user:", existingProfiles);
console.log("✅ Test data setup completed!");
} catch (error) {
console.error("❌ Error setting up test data:", error);
} finally {
await prisma.$disconnect();
}
}
setupTestData();