-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathseed.js
97 lines (91 loc) · 2.36 KB
/
seed.js
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
// seed.js
const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();
async function main() {
const profiles = [
{
domain: "admin",
name: "Admin",
bio: "Sample bio for Admin",
heading: "Sample Heading 1",
profile_photo: "https://picsum.photos/200",
styles: {
ProfileCard: {
backgroundColor: "#BFDBFE",
color: "#1E3A8A",
padding: "1rem",
borderRadius: "0.5rem",
boxShadow:
"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
},
},
},
{
domain: "user",
name: "User",
bio: "Sample bio for User",
heading: "Sample Heading 2",
profile_photo: "https://picsum.photos/200",
styles: {
ProfileCard: {
backgroundColor: "#FED7D7",
color: "#E11D48",
padding: "1rem",
borderRadius: "0.5rem",
boxShadow:
"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
},
},
},
{
domain: "industry",
name: "Industry",
bio: "Sample bio for Industry",
heading: "Sample Heading 3",
profile_photo: "https://picsum.photos/200",
styles: {
ProfileCard: {
backgroundColor: "#C6F6D5",
color: "#065F46",
padding: "1rem",
borderRadius: "0.5rem",
boxShadow:
"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
},
},
},
{
domain: "supplier",
name: "Supplier",
bio: "Sample bio for Supplier",
heading: "Sample Heading 4",
profile_photo: "https://picsum.photos/200",
styles: {
ProfileCard: {
backgroundColor: "#FEEBC8",
color: "#D97706",
padding: "1rem",
borderRadius: "0.5rem",
boxShadow:
"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
},
},
},
];
// Remove all records in the profiles table
await prisma.profile.deleteMany();
console.log("all profiles removed!");
for (const profile of profiles) {
await prisma.profile.create({
data: profile,
});
}
console.log("Sample profiles created");
}
main()
.catch((e) => {
throw e;
})
.finally(async () => {
await prisma.$disconnect();
});