(prisma: PrismaClient)
| 4 | const SLACK_CONNECTION_KEY = "slack-seed-key"; |
| 5 | |
| 6 | export async function seedCloud(prisma: PrismaClient) { |
| 7 | if (!process.env.SEED_CLOUD_EMAIL) { |
| 8 | return; |
| 9 | } |
| 10 | |
| 11 | const name = process.env.SEED_CLOUD_EMAIL.split("@")[0]; |
| 12 | |
| 13 | // Create a user, organization, and project |
| 14 | const user = await prisma.user.upsert({ |
| 15 | where: { |
| 16 | email: process.env.SEED_CLOUD_EMAIL, |
| 17 | }, |
| 18 | create: { |
| 19 | email: process.env.SEED_CLOUD_EMAIL, |
| 20 | name, |
| 21 | authenticationMethod: "MAGIC_LINK", |
| 22 | }, |
| 23 | update: {}, |
| 24 | }); |
| 25 | |
| 26 | const organization = await prisma.organization.upsert({ |
| 27 | where: { |
| 28 | slug: "seed-org-123", |
| 29 | }, |
| 30 | create: { |
| 31 | title: "Personal Workspace", |
| 32 | slug: "seed-org-123", |
| 33 | members: { |
| 34 | create: { |
| 35 | userId: user.id, |
| 36 | role: "ADMIN", |
| 37 | }, |
| 38 | }, |
| 39 | projects: { |
| 40 | create: { |
| 41 | name: "My Project", |
| 42 | slug: "my-project-123", |
| 43 | externalRef: "my-project-123", |
| 44 | }, |
| 45 | }, |
| 46 | }, |
| 47 | update: {}, |
| 48 | include: { |
| 49 | members: true, |
| 50 | projects: true, |
| 51 | }, |
| 52 | }); |
| 53 | |
| 54 | const adminMember = organization.members[0]; |
| 55 | const defaultProject = organization.projects[0]; |
| 56 | |
| 57 | const devEnv = await prisma.runtimeEnvironment.upsert({ |
| 58 | where: { |
| 59 | apiKey: "tr_dev_bNaLxayOXqoj", |
| 60 | }, |
| 61 | create: { |
| 62 | apiKey: "tr_dev_bNaLxayOXqoj", |
| 63 | pkApiKey: "pk_dev_323f3650218e370508cf", |
no outgoing calls
no test coverage detected
searching dependent graphs…