MCPcopy
hub / github.com/OpenPipe/OpenPipe / userProject

Function userProject

app/src/server/utils/userProject.ts:4–33  ·  view source on GitHub ↗
(userId: string)

Source from the content-addressed store, hash-verified

2import { generateApiKey } from "./generateApiKey";
3
4export default async function userProject(userId: string) {
5 return await prisma.project.upsert({
6 where: {
7 personalProjectUserId: userId,
8 },
9 update: {},
10 create: {
11 personalProjectUserId: userId,
12 projectUsers: {
13 create: {
14 userId: userId,
15 role: "OWNER",
16 },
17 },
18 apiKeys: {
19 create: [
20 {
21 name: "Default API Key",
22 apiKey: generateApiKey(),
23 },
24 {
25 name: "Read-Only API Key",
26 apiKey: generateApiKey(),
27 readOnly: true,
28 },
29 ],
30 },
31 },
32 });
33}

Callers 1

projects.router.tsFile · 0.85

Calls 1

generateApiKeyFunction · 0.90

Tested by

no test coverage detected