Rename recordPosition into position (#3864)

* Rename recordPosition into position

* Fix according to review

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Thomas Trompette
2024-02-07 09:40:35 +01:00
committed by GitHub
parent eb54401afe
commit 9f59ddc059
10 changed files with 68 additions and 25 deletions

View File

@ -9,7 +9,13 @@ export const seedCompanies = async (
await workspaceDataSource
.createQueryBuilder()
.insert()
.into(`${schemaName}.${tableName}`, ['id', 'name', 'domainName', 'address'])
.into(`${schemaName}.${tableName}`, [
'id',
'name',
'domainName',
'address',
'position',
])
.orIgnore()
.values([
{
@ -17,78 +23,91 @@ export const seedCompanies = async (
name: 'Linkedin',
domainName: 'linkedin.com',
address: '',
position: 1,
},
{
id: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
name: 'Facebook',
domainName: 'facebook.com',
address: '',
position: 2,
},
{
id: '04b2e9f5-0713-40a5-8216-82802401d33e',
name: 'Qonto',
domainName: 'qonto.com',
address: '',
position: 3,
},
{
id: '460b6fb1-ed89-413a-b31a-962986e67bb4',
name: 'Microsoft',
domainName: 'microsoft.com',
address: '',
position: 4,
},
{
id: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
name: 'Airbnb',
domainName: 'airbnb.com',
address: '',
position: 5,
},
{
id: '0d940997-c21e-4ec2-873b-de4264d89025',
name: 'Google',
domainName: 'google.com',
address: '',
position: 6,
},
{
id: '1d3a1c6e-707e-44dc-a1d2-30030bf1a944',
name: 'Netflix',
domainName: 'netflix.com',
address: '',
position: 7,
},
{
id: '7a93d1e5-3f74-492d-a101-2a70f50a1645',
name: 'Libeo',
domainName: 'libeo.io',
address: '',
position: 8,
},
{
id: '9d162de6-cfbf-4156-a790-e39854dcd4eb',
name: 'Claap',
domainName: 'claap.io',
address: '',
position: 9,
},
{
id: 'aaffcfbd-f86b-419f-b794-02319abe8637',
name: 'Hasura',
domainName: 'hasura.io',
address: '',
position: 10,
},
{
id: 'f33dc242-5518-4553-9433-42d8eb82834b',
name: 'Wework',
domainName: 'wework.com',
address: '',
position: 11,
},
{
id: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
name: 'Samsung',
domainName: 'samsung.com',
address: '',
position: 12,
},
{
id: 'a674fa6c-1455-4c57-afaf-dd5dc086361d',
name: 'Algolia',
domainName: 'algolia.com',
address: '',
position: 13,
},
])
.execute();

View File

@ -17,7 +17,7 @@ export const seedOpportunity = async (
'closeDate',
'probability',
'stage',
'recordPosition',
'position',
'pipelineStepId',
'pointOfContactId',
'companyId',
@ -32,7 +32,7 @@ export const seedOpportunity = async (
closeDate: new Date(),
probability: 0.5,
stage: 'new',
recordPosition: 0,
position: 0,
pipelineStepId: '6edf4ead-006a-46e1-9c6d-228f1d0143c9',
pointOfContactId: '86083141-1c0e-494c-a1b6-85b1c6fefaa5',
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
@ -45,7 +45,7 @@ export const seedOpportunity = async (
closeDate: new Date(),
probability: 0.5,
stage: 'meeting',
recordPosition: 0,
position: 1,
pipelineStepId: 'd8361722-03fb-4e65-bd4f-ec9e52e5ec0a',
pointOfContactId: '93c72d2e-f517-42fd-80ae-14173b3b70ae',
companyId: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
@ -58,7 +58,7 @@ export const seedOpportunity = async (
closeDate: new Date(),
probability: 0.5,
stage: 'proposal',
recordPosition: 0,
position: 2,
pipelineStepId: '30b14887-d592-427d-bd97-6e670158db02',
pointOfContactId: '9b324a88-6784-4449-afdf-dc62cb8702f2',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
@ -71,7 +71,7 @@ export const seedOpportunity = async (
closeDate: new Date(),
probability: 0.5,
stage: 'proposal',
recordPosition: 1,
position: 3,
pipelineStepId: '30b14887-d592-427d-bd97-6e670158db02',
pointOfContactId: '98406e26-80f1-4dff-b570-a74942528de3',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',

View File

@ -17,6 +17,7 @@ export const seedPeople = async (
'city',
'companyId',
'email',
'position',
])
.orIgnore()
.values([
@ -28,6 +29,7 @@ export const seedPeople = async (
city: 'Seattle',
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
email: 'christoph.calisto@linkedin.com',
position: 0,
},
{
id: '0aa00beb-ac73-4797-824e-87a1f5aea9e0',
@ -37,6 +39,7 @@ export const seedPeople = async (
city: 'Los Angeles',
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
email: 'sylvie.palmer@linkedin.com',
position: 1,
},
{
id: '93c72d2e-f517-42fd-80ae-14173b3b70ae',
@ -46,6 +49,7 @@ export const seedPeople = async (
city: 'Seattle',
companyId: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
email: 'christopher.gonzalez@qonto.com',
position: 2,
},
{
id: 'eeeacacf-eee1-4690-ad2c-8619e5b56a2e',
@ -55,6 +59,7 @@ export const seedPeople = async (
city: 'Los Angeles',
companyId: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
email: 'ashley.parker@qonto.com',
position: 3,
},
{
id: '9b324a88-6784-4449-afdf-dc62cb8702f2',
@ -64,6 +69,7 @@ export const seedPeople = async (
city: 'Seattle',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
email: 'nicholas.wright@microsoft.com',
position: 4,
},
{
id: '1d151852-490f-4466-8391-733cfd66a0c8',
@ -73,6 +79,7 @@ export const seedPeople = async (
city: 'New York',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
email: 'isabella.scott@microsoft.com',
position: 5,
},
{
id: '98406e26-80f1-4dff-b570-a74942528de3',
@ -82,6 +89,7 @@ export const seedPeople = async (
city: 'Seattle',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
email: 'matthew.green@microsoft.com',
position: 6,
},
{
id: 'a2e78a5f-338b-46df-8811-fa08c7d19d35',
@ -91,6 +99,7 @@ export const seedPeople = async (
city: 'New York',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'elizabeth.baker@airbnb.com',
position: 7,
},
{
id: 'ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016',
@ -100,6 +109,7 @@ export const seedPeople = async (
city: 'San Francisco',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'christopher.nelson@airbnb.com',
position: 8,
},
{
id: '56955422-5d54-41b7-ba36-f0d20e1417ae',
@ -109,6 +119,7 @@ export const seedPeople = async (
city: 'New York',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'avery.carter@airbnb.com',
position: 9,
},
{
id: '755035db-623d-41fe-92e7-dd45b7c568e1',
@ -118,6 +129,7 @@ export const seedPeople = async (
city: 'Los Angeles',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'ethan.mitchell@google.com',
position: 10,
},
{
id: '240da2ec-2d40-4e49-8df4-9c6a049190ef',
@ -127,6 +139,7 @@ export const seedPeople = async (
city: 'Seattle',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'madison.perez@google.com',
position: 11,
},
{
id: '240da2ec-2d40-4e49-8df4-9c6a049190df',
@ -136,6 +149,7 @@ export const seedPeople = async (
city: 'Seattle',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'bertrand.voulzy@google.com',
position: 12,
},
{
id: '240da2ec-2d40-4e49-8df4-9c6a049191de',
@ -145,6 +159,7 @@ export const seedPeople = async (
city: 'Seattle',
companyId: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
email: 'louis.duss@google.com',
position: 13,
},
{
id: '240da2ec-2d40-4e49-8df4-9c6a049191df',
@ -154,6 +169,7 @@ export const seedPeople = async (
city: 'Seattle',
companyId: 'a674fa6c-1455-4c57-afaf-dd5dc086361d',
email: 'lorie.vladim@google.com',
position: 14,
},
])
.execute();

View File

@ -293,13 +293,13 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
},
{
type: FieldMetadataType.NUMBER,
name: 'recordPosition',
label: 'Record position',
name: 'position',
label: 'Position',
targetColumnMap: {
value: 'recordPosition',
value: 'position',
},
icon: 'IconHierarchy2',
description: 'Record position',
description: 'Position',
isNullable: true,
isActive: true,
isCustom: false,
@ -397,7 +397,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
columns: [
{
action: WorkspaceMigrationColumnActionType.CREATE,
columnName: 'recordPosition',
columnName: 'position',
columnType: 'float',
isNullable: true,
} satisfies WorkspaceMigrationColumnCreate,

View File

@ -15,9 +15,12 @@ export const companyPrefillData = async (
'address',
'employees',
'linkedinLinkUrl',
'position',
])
.orIgnore()
.values(companiesDemo)
.values(
companiesDemo.map((company, index) => ({ ...company, position: index })),
)
.returning('*')
.execute();
};

View File

@ -38,7 +38,7 @@ const generateOpportunities = (
amountCurrencyCode: 'USD',
closeDate: new Date(),
stage: getRandomStage(),
recordPosition: null,
position: null,
probability: getRandomProbability(),
pipelineStepId: getRandomPipelineStepId(pipelineStepIds),
pointOfContactId: company.personId,
@ -74,13 +74,18 @@ export const seedDemoOpportunity = async (
'amountCurrencyCode',
'closeDate',
'stage',
'recordPosition',
'probability',
'pipelineStepId',
'pointOfContactId',
'companyId',
'position',
])
.orIgnore()
.values(opportunities)
.values(
opportunities.map((opportunity, index) => ({
...opportunity,
position: index,
})),
)
.execute();
};

View File

@ -19,7 +19,7 @@ export const personPrefillData = async (
jobTitle: person.jobTitle,
city: person.city,
avatarUrl: person.avatarUrl,
recordPosition: null,
position: index,
companyId: companies[Math.floor(index / 2)].id,
}));
@ -34,7 +34,7 @@ export const personPrefillData = async (
'jobTitle',
'city',
'avatarUrl',
'recordPosition',
'position',
'companyId',
])
.orIgnore()

View File

@ -97,13 +97,13 @@ export class CompanyObjectMetadata extends BaseObjectMetadata {
@FieldMetadata({
type: FieldMetadataType.NUMBER,
label: 'RecordPosition',
description: 'Record Position',
label: 'Position',
description: 'Position',
icon: 'IconHierarchy2',
})
@IsSystem()
@IsNullable()
recordPosition: number;
position: number;
// Relations
@FieldMetadata({

View File

@ -79,13 +79,13 @@ export class OpportunityObjectMetadata extends BaseObjectMetadata {
@FieldMetadata({
type: FieldMetadataType.NUMBER,
label: 'RecordPosition',
description: 'Record Position',
label: 'Position',
description: 'Position',
icon: 'IconHierarchy2',
})
@IsSystem()
@IsNullable()
recordPosition: number;
position: number;
// Relations
@FieldMetadata({

View File

@ -94,13 +94,13 @@ export class PersonObjectMetadata extends BaseObjectMetadata {
@FieldMetadata({
type: FieldMetadataType.NUMBER,
label: 'RecordPosition',
label: 'Position',
description: 'Record Position',
icon: 'IconHierarchy2',
})
@IsSystem()
@IsNullable()
recordPosition: number;
position: number;
// Relations
@FieldMetadata({