Add Pipelines models in server (#182)

* Hide workspace and refresh token from schema

* Add pipe models and migrations

* Add seeds

* Update FE graphql schema
This commit is contained in:
Charles Bochet
2023-06-02 11:20:21 +02:00
committed by GitHub
parent bf3097500a
commit 2395f791c8
335 changed files with 8371 additions and 428 deletions

View File

@ -52,8 +52,10 @@ model User {
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[]
@ -74,6 +76,8 @@ model Workspace {
people Person[]
commentThreads CommentThread[]
comments Comment[]
pipelines Pipeline[]
pipelineStages PipelineStage[]
@@map("workspaces")
}
@ -85,9 +89,9 @@ model WorkspaceMember {
deletedAt DateTime?
userId String @unique
user User @relation(fields: [userId], references: [id])
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.omit(input: true, output: true)
workspaceId String
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.omit(input: true, output: true)
workspace Workspace @relation(fields: [workspaceId], references: [id])
@@map("workspace_members")
@ -106,9 +110,9 @@ model Company {
accountOwner User? @relation(fields: [accountOwnerId], references: [id])
people Person[]
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.omit(input: true, output: true)
workspaceId String
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.omit(input: true, output: true)
workspace Workspace @relation(fields: [workspaceId], references: [id])
@@map("companies")
@ -127,9 +131,9 @@ model Person {
companyId String?
company Company? @relation(fields: [companyId], references: [id])
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.omit(input: true, output: true)
workspaceId String
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.omit(input: true, output: true)
workspace Workspace @relation(fields: [workspaceId], references: [id])
@@map("people")
@ -154,9 +158,9 @@ model CommentThread {
deletedAt DateTime?
commentThreadTargets CommentThreadTarget[]
comments Comment[]
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.omit(input: true, output: true)
workspaceId String
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.omit(input: true, output: true)
workspace Workspace @relation(fields: [workspaceId], references: [id])
@@map("comment_threads")
@ -172,9 +176,9 @@ model Comment {
author User @relation(fields: [authorId], references: [id])
commentThreadId String
commentThread CommentThread @relation(fields: [commentThreadId], references: [id])
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.omit(input: true, output: true)
workspaceId String
/// @TypeGraphQL.omit(input: true)
/// @TypeGraphQL.omit(input: true, output: true)
workspace Workspace @relation(fields: [workspaceId], references: [id])
@@map("comments")
@ -197,4 +201,68 @@ model CommentThreadTarget {
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[]
pipelineAssociations PipelineAssociation[]
/// @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])
pipelineAssociations PipelineAssociation[]
/// @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 PipelineAssociableType {
Person
Company
}
model PipelineAssociation {
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])
associableType PipelineAssociableType
associableId String
@@map("pipeline_associations")
}