11import { nanoid , customAlphabet } from "nanoid" ;
22import slug from "slug" ;
33import { $replica , prisma } from "~/db.server" ;
4- import type { Project } from "@trigger.dev/database" ;
5- import { Organization , createEnvironment } from "./organization.server" ;
4+ import type { Prisma , Project } from "@trigger.dev/database" ;
5+ import { type Organization , createEnvironment } from "./organization.server" ;
66import { env } from "~/env.server" ;
77import { projectCreated } from "~/services/platform.v3.server" ;
88export type { Project } from "@trigger.dev/database" ;
@@ -14,6 +14,7 @@ type Options = {
1414 name : string ;
1515 userId : string ;
1616 version : "v2" | "v3" ;
17+ onboardingData ?: Prisma . InputJsonValue ;
1718} ;
1819
1920export class ExceededProjectLimitError extends Error {
@@ -24,7 +25,7 @@ export class ExceededProjectLimitError extends Error {
2425}
2526
2627export async function createProject (
27- { organizationSlug, name, userId, version } : Options ,
28+ { organizationSlug, name, userId, version, onboardingData } : Options ,
2829 attemptCount = 0
2930) : Promise < Project & { organization : Organization } > {
3031 //check the user has permissions to do this
@@ -84,6 +85,7 @@ export async function createProject(
8485 name,
8586 userId,
8687 version,
88+ onboardingData,
8789 } ,
8890 attemptCount + 1
8991 ) ;
@@ -100,6 +102,7 @@ export async function createProject(
100102 } ,
101103 externalRef : `proj_${ externalRefGenerator ( ) } ` ,
102104 version : version === "v3" ? "V3" : "V2" ,
105+ onboardingData : onboardingData ?? undefined ,
103106 } ,
104107 include : {
105108 organization : {
0 commit comments