V2 opportunities (#2565)

* changed isSystem to false

* wip

* wip

* wip

* add amount viewfield seed

* seed other viewFields

* upate tenant seeds

* Remove calls to old pipelines

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
bosiraphael
2023-11-17 19:12:22 +01:00
committed by GitHub
parent f62108d539
commit d481da183f
43 changed files with 454 additions and 864 deletions

View File

@ -0,0 +1,33 @@
import { EntityManager } from 'typeorm';
export const opportunityPrefillData = async (
entityManager: EntityManager,
schemaName: string,
) => {
await entityManager
.createQueryBuilder()
.insert()
.into(`${schemaName}.opportunity`, [
'amount',
'closeDate',
'probability',
'pipelineStepId',
'pointOfContactId',
'personId',
'companyId',
])
.orIgnore()
.values([
{
amount: 100000,
closeDate: new Date(),
probability: 0.5,
pipelineStepId: '73ac09c6-2b90-4874-9e5d-553ea76912ee',
pointOfContactId: 'bb757987-ae38-4d16-96ec-b25b595e7bd8',
personId: 'a4a2b8e9-7a2b-4b6a-8c8b-7e9a0a0a0a0a',
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
},
])
.returning('*')
.execute();
};

View File

@ -5,6 +5,7 @@ import { viewPrefillData } from 'src/workspace/workspace-manager/standard-object
import { companyPrefillData } from 'src/workspace/workspace-manager/standard-objects-prefill-data/company';
import { personPrefillData } from 'src/workspace/workspace-manager/standard-objects-prefill-data/person';
import { pipelineStepPrefillData } from 'src/workspace/workspace-manager/standard-objects-prefill-data/pipeline-step';
import { opportunityPrefillData } from 'src/workspace/workspace-manager/standard-objects-prefill-data/opportunity';
export const standardObjectsPrefillData = async (
workspaceDataSource: DataSource,
@ -27,5 +28,6 @@ export const standardObjectsPrefillData = async (
await personPrefillData(entityManager, schemaName);
await viewPrefillData(entityManager, schemaName, objectMetadataMap);
await pipelineStepPrefillData(entityManager, schemaName);
await opportunityPrefillData(entityManager, schemaName);
});
};

View File

@ -9,7 +9,7 @@ const opportunityMetadata = {
description: 'An opportunity',
icon: 'IconTargetArrow',
isActive: true,
isSystem: true,
isSystem: false,
fields: [
{
isCustom: false,