generator client { provider = "prisma-client-js" engineType = "binary" } datasource db { provider = "postgresql" url = env("PG_DATABASE_URL") } generator nestgraphql { provider = "node node_modules/prisma-nestjs-graphql" output = "../../src/api/@generated" // CommentThread create: Only Allow targets createMany and comments createMany decorate_createCommentThreadTargets_type = "*CommentThreadTargetCreateNestedManyWithoutCommentThreadInput" decorate_createCommentThreadTargets_field = "!(createMany)" decorate_createCommentThreadTargets_name = "HideField" decorate_createCommentThreadTargets_from = "@nestjs/graphql" decorate_createCommentThreadTargets_arguments = "[]" decorate_createCommentThreadComments_type = "*CommentCreateNestedManyWithoutCommentThreadInput" decorate_createCommentThreadComments_field = "!(createMany)" decorate_createCommentThreadComments_name = "HideField" decorate_createCommentThreadComments_from = "@nestjs/graphql" decorate_createCommentThreadComments_arguments = "[]" // Comment create: Only Allow author connect and commentThread connect decorate_createCommentUser_type = "*UserCreateNestedOneWithoutCommentsInput" decorate_createCommentUser_field = "!(connect)" decorate_createCommentUser_name = "HideField" decorate_createCommentUser_from = "@nestjs/graphql" decorate_createCommentUser_arguments = "[]" decorate_createCommentCommentThread_type = "*CommentThreadCreateNestedOneWithoutCommentsInput" decorate_createCommentCommentThread_field = "!(connect)" decorate_createCommentCommentThread_name = "HideField" decorate_createCommentCommentThread_from = "@nestjs/graphql" decorate_createCommentCommentThread_arguments = "[]" // Person create: Only Allow company connect decorate_createPersonCompany_type = "*CompanyCreateNestedOneWithoutPeopleInput" decorate_createPersonCompany_field = "!(connect)" decorate_createPersonCompany_name = "HideField" decorate_createPersonCompany_from = "@nestjs/graphql" decorate_createPersonCompany_arguments = "[]" // Person update: Only Allow company connect decorate_updatePersonCompany_type = "*CompanyUpdateOneWithoutPeopleNestedInput" decorate_updatePersonCompany_field = "!(connect)" decorate_updatePersonCompany_name = "HideField" decorate_updatePersonCompany_from = "@nestjs/graphql" decorate_updatePersonCompany_arguments = "[]" // Company create: Only Allow people and accountOwner connect decorate_createCompanyUser_type = "*UserCreateNestedOneWithoutCompaniesInput" decorate_createCompanyUser_field = "!(connect)" decorate_createCompanyUser_name = "HideField" decorate_createCompanyUser_from = "@nestjs/graphql" decorate_createCompanyUser_arguments = "[]" decorate_createCompanyPerson_type = "*PersonCreateNestedManyWithoutCompanyInput" decorate_createCompanyPerson_field = "!(connect)" decorate_createCompanyPerson_name = "HideField" decorate_createCompanyPerson_from = "@nestjs/graphql" decorate_createCompanyPerson_arguments = "[]" // Company update: Only Allow action on people and accountOwner decorate_updateCompanyUser_type = "*UserUpdateOneWithoutCompaniesNestedInput" decorate_updateCompanyUser_field = "!(connect)" decorate_updateCompanyUser_name = "HideField" decorate_updateCompanyUser_from = "@nestjs/graphql" decorate_updateCompanyUser_arguments = "[]" decorate_updateCompanyPerson_type = "*PersonUpdateManyWithoutCompanyNestedInput" decorate_updateCompanyPerson_field = "!(connect)" decorate_updateCompanyPerson_name = "HideField" decorate_updateCompanyPerson_from = "@nestjs/graphql" decorate_updateCompanyPerson_arguments = "[]" // PipelineProgress create: Only Allow pipelineStage and pipeline connect decorate_createPipelineProgressPipeline_type = "*PipelineCreateNestedOneWithoutPipelineProgressesInput" decorate_createPipelineProgressPipeline_field = "!(connect)" decorate_createPipelineProgressPipeline_name = "HideField" decorate_createPipelineProgressPipeline_from = "@nestjs/graphql" decorate_createPipelineProgressPipeline_arguments = "[]" decorate_createPipelineProgressPipelineStage_type = "*PipelineStageCreateNestedOneWithoutPipelineProgressesInput" decorate_createPipelineProgressPipelineStage_field = "!(connect)" decorate_createPipelineProgressPipelineStage_name = "HideField" decorate_createPipelineProgressPipelineStage_from = "@nestjs/graphql" decorate_createPipelineProgressPipelineStage_arguments = "[]" // PipelineProgress update: Only Allow pipelineStage and pipeline connect decorate_updatePipelineProgressPipeline_type = "*PipelineUpdateOneRequiredWithoutPipelineProgressesNestedInput" decorate_updatePipelineProgressPipeline_field = "!(connect)" decorate_updatePipelineProgressPipeline_name = "HideField" decorate_updatePipelineProgressPipeline_from = "@nestjs/graphql" decorate_updatePipelineProgressPipeline_arguments = "[]" decorate_updatePipelineProgressPipelineStage_type = "*PipelineStageUpdateOneRequiredWithoutPipelineProgressesNestedInput" decorate_updatePipelineProgressPipelineStage_field = "!(connect)" decorate_updatePipelineProgressPipelineStage_name = "HideField" decorate_updatePipelineProgressPipelineStage_from = "@nestjs/graphql" decorate_updatePipelineProgressPipelineStage_arguments = "[]" // Disable _count on all models except Aggregation use case decorate_count_type = "!(*Aggregate*|*GroupBy*|*OrderBy*)" decorate_count_field = "_count" decorate_count_name = "HideField" decorate_count_from = "@nestjs/graphql" decorate_count_arguments = "[]" } model User { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? lastSeen DateTime? disabled Boolean @default(false) displayName String email String @unique avatarUrl String? locale String phoneNumber String? passwordHash String? emailVerified Boolean @default(false) metadata Json? /// @TypeGraphQL.omit(input: true) workspaceMember WorkspaceMember? companies Company[] /// @TypeGraphQL.omit(input: true, output: true) refreshTokens RefreshToken[] comments Comment[] @@map("users") } /// @TypeGraphQL.omit(input: true) model Workspace { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? domainName String @unique displayName String logo String? workspaceMember WorkspaceMember[] companies Company[] people Person[] commentThreads CommentThread[] comments Comment[] pipelines Pipeline[] pipelineStages PipelineStage[] pipelineProgresses PipelineProgress[] @@map("workspaces") } model WorkspaceMember { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? userId String @unique user User @relation(fields: [userId], references: [id]) /// @TypeGraphQL.omit(input: true, output: true) workspaceId String /// @TypeGraphQL.omit(input: true, output: true) workspace Workspace @relation(fields: [workspaceId], references: [id]) @@map("workspace_members") } model Company { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? name String domainName String address String employees Int? accountOwnerId String? accountOwner User? @relation(fields: [accountOwnerId], references: [id]) people Person[] /// @TypeGraphQL.omit(input: true, output: true) workspaceId String /// @TypeGraphQL.omit(input: true, output: true) workspace Workspace @relation(fields: [workspaceId], references: [id]) @@map("companies") } model Person { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? firstname String lastname String email String phone String city String companyId String? company Company? @relation(fields: [companyId], references: [id]) /// @TypeGraphQL.omit(input: true, output: true) workspaceId String /// @TypeGraphQL.omit(input: true, output: true) workspace Workspace @relation(fields: [workspaceId], references: [id]) @@map("people") } model RefreshToken { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? refreshToken String userId String user User @relation(fields: [userId], references: [id]) @@map("refresh_tokens") } model CommentThread { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? commentThreadTargets CommentThreadTarget[] comments Comment[] /// @TypeGraphQL.omit(input: true, output: true) workspaceId String /// @TypeGraphQL.omit(input: true, output: true) workspace Workspace @relation(fields: [workspaceId], references: [id]) @@map("comment_threads") } model Comment { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? body String authorId String author User @relation(fields: [authorId], references: [id]) commentThreadId String commentThread CommentThread @relation(fields: [commentThreadId], references: [id]) /// @TypeGraphQL.omit(input: true, output: true) workspaceId String /// @TypeGraphQL.omit(input: true, output: true) workspace Workspace @relation(fields: [workspaceId], references: [id]) @@map("comments") } enum CommentableType { Person Company } model CommentThreadTarget { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? commentThreadId String commentThread CommentThread @relation(fields: [commentThreadId], references: [id]) commentableType CommentableType commentableId String @@map("comment_thread_targets") } model Pipeline { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? name String icon String pipelineStages PipelineStage[] pipelineProgresses PipelineProgress[] /// @TypeGraphQL.omit(input: true, output: true) workspaceId String /// @TypeGraphQL.omit(input: true, output: true) workspace Workspace @relation(fields: [workspaceId], references: [id]) @@map("pipelines") } model PipelineStage { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? name String type String color String pipelineId String pipeline Pipeline @relation(fields: [pipelineId], references: [id]) pipelineProgresses PipelineProgress[] /// @TypeGraphQL.omit(input: true, output: true) workspaceId String /// @TypeGraphQL.omit(input: true, output: true) workspace Workspace @relation(fields: [workspaceId], references: [id]) @@map("pipeline_stages") } enum PipelineProgressableType { Person Company } model PipelineProgress { id String @id createdAt DateTime @default(now()) updatedAt DateTime @updatedAt deletedAt DateTime? pipelineId String pipeline Pipeline @relation(fields: [pipelineId], references: [id]) pipelineStageId String pipelineStage PipelineStage @relation(fields: [pipelineStageId], references: [id]) progressableType PipelineProgressableType progressableId String /// @TypeGraphQL.omit(input: true, output: true) workspaceId String /// @TypeGraphQL.omit(input: true, output: true) workspace Workspace @relation(fields: [workspaceId], references: [id]) @@map("pipeline_progresses") }