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:
214
server/src/database/seeds/pipelines.ts
Normal file
214
server/src/database/seeds/pipelines.ts
Normal file
@ -0,0 +1,214 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
await prisma.pipeline.upsert({
|
||||
where: { id: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
name: 'Sales pipeline',
|
||||
icon: '💰',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-fe256b39-3ec3-4fe3-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8998-b76aa0bfb600',
|
||||
name: 'New',
|
||||
color: '#B76796',
|
||||
type: 'open',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-fe256b39-3ec3-4fe4-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe4-8998-b76aa0bfb600',
|
||||
name: 'Screening',
|
||||
color: '#CB912F',
|
||||
type: 'ongoing',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-fe256b39-3ec3-4fe5-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe5-8998-b76aa0bfb600',
|
||||
name: 'Meeting',
|
||||
color: '#9065B0',
|
||||
type: 'ongoing',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-fe256b39-3ec3-4fe6-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe6-8998-b76aa0bfb600',
|
||||
name: 'Proposal',
|
||||
color: '#337EA9',
|
||||
type: 'ongoing',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-fe256b39-3ec3-4fe7-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe7-8998-b76aa0bfb600',
|
||||
name: 'Customer',
|
||||
color: '#079039',
|
||||
type: 'won',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineAssociation.upsert({
|
||||
where: { id: 'twenty-fe256b39-3ec3-4fe7-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
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',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipeline.upsert({
|
||||
where: { id: 'twenty-fe256b39-3ec3-4fe3-8997-b74aa0bfb400' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-b74aa0bfb400',
|
||||
name: 'Customer support pipeline',
|
||||
icon: '📔',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-fe256b39-3ec3-4fe3-8998-a76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8998-a76aa0bfb600',
|
||||
name: 'New',
|
||||
color: '#B76796',
|
||||
type: 'open',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b74aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineAssociation.upsert({
|
||||
where: { id: 'twenty-fe256b39-3ec3-4fe7-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
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',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipeline.upsert({
|
||||
where: { id: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b75aa0bfb400' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
name: 'Sales pipeline',
|
||||
icon: '💰',
|
||||
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-dev-fe256b39-3ec3-4fe3-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-dev-fe256b39-3ec3-4fe3-8998-b76aa0bfb600',
|
||||
name: 'New',
|
||||
color: '#B76796',
|
||||
type: 'open',
|
||||
pipelineId: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-dev-fe256b39-3ec3-4fe4-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-dev-fe256b39-3ec3-4fe4-8998-b76aa0bfb600',
|
||||
name: 'Screening',
|
||||
color: '#CB912F',
|
||||
type: 'ongoing',
|
||||
pipelineId: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-dev-fe256b39-3ec3-4fe5-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-dev-fe256b39-3ec3-4fe5-8998-b76aa0bfb600',
|
||||
name: 'Meeting',
|
||||
color: '#9065B0',
|
||||
type: 'ongoing',
|
||||
pipelineId: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-dev-fe256b39-3ec3-4fe6-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-dev-fe256b39-3ec3-4fe6-8998-b76aa0bfb600',
|
||||
name: 'Proposal',
|
||||
color: '#337EA9',
|
||||
type: 'ongoing',
|
||||
pipelineId: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineStage.upsert({
|
||||
where: { id: 'twenty-dev-fe256b39-3ec3-4fe7-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-dev-fe256b39-3ec3-4fe7-8998-b76aa0bfb600',
|
||||
name: 'Customer',
|
||||
color: '#079039',
|
||||
type: 'won',
|
||||
pipelineId: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.pipelineAssociation.upsert({
|
||||
where: { id: 'twenty-dev-fe256b39-3ec3-4fe7-8998-b76aa0bfb600' },
|
||||
update: {},
|
||||
create: {
|
||||
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',
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user