Add workspace scoping to pipeline progress and expose findManyPipelineeProgress on graphql (#292)

Add workspace scoping to pipeline progress and expose findManyPipelineProgress on graphql
This commit is contained in:
Charles Bochet
2023-06-14 17:05:15 +02:00
committed by GitHub
parent 31f3950439
commit 5381e28253
104 changed files with 1393 additions and 98 deletions

View File

@ -0,0 +1,13 @@
/*
Warnings:
- You are about to drop the column `associableId` on the `pipeline_progresses` table. All the data in the column will be lost.
- You are about to drop the column `associableType` on the `pipeline_progresses` table. All the data in the column will be lost.
- Added the required column `progressableId` to the `pipeline_progresses` table without a default value. This is not possible if the table is not empty.
- Added the required column `progressableType` to the `pipeline_progresses` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "pipeline_progresses" RENAME "associableId" TO "progressableId";
ALTER TABLE "pipeline_progresses" RENAME "associableType" TO "progressableType";

View File

@ -0,0 +1,11 @@
/*
Warnings:
- Added the required column `workspaceId` to the `pipeline_progresses` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "pipeline_progresses" ADD COLUMN "workspaceId" TEXT NOT NULL;
-- AddForeignKey
ALTER TABLE "pipeline_progresses" ADD CONSTRAINT "pipeline_progresses_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "workspaces"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -113,20 +113,21 @@ model User {
/// @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[]
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")
}
@ -310,8 +311,13 @@ model PipelineProgress {
pipelineStageId String
pipelineStage PipelineStage @relation(fields: [pipelineStageId], references: [id])
associableType PipelineProgressableType
associableId String
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")
}

View File

@ -83,8 +83,9 @@ export const seedPipelines = async (prisma: PrismaClient) => {
id: 'twenty-fe256b39-3ec3-4fe7-8998-b76aa0bfb600',
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
pipelineStageId: 'twenty-fe256b39-3ec3-4fe3-8998-b76aa0bfb600',
associableType: 'Person',
associableId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
progressableType: 'Person',
progressableId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
});
@ -119,8 +120,9 @@ export const seedPipelines = async (prisma: PrismaClient) => {
id: 'twenty-fe256b39-3ec3-4fe7-8998-b76aa0bfb600',
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b74aa0bfb400',
pipelineStageId: 'twenty-fe256b39-3ec3-4fe3-8998-a76aa0bfb600',
associableType: 'Person',
associableId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
progressableType: 'Person',
progressableId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
});
@ -207,8 +209,9 @@ export const seedPipelines = async (prisma: PrismaClient) => {
id: 'twenty-dev-fe256b39-3ec3-4fe7-8998-b76aa0bfb600',
pipelineId: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
pipelineStageId: 'twenty-dev-fe256b39-3ec3-4fe3-8998-b76aa0bfb600',
associableType: 'Company',
associableId: 'twenty-dev-a674fa6c-1455-4c57-afaf-dd5dc086361e',
progressableType: 'Company',
progressableId: 'twenty-dev-a674fa6c-1455-4c57-afaf-dd5dc086361e',
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
},
});
};