Added working peopleV2 table (#2527)

This commit is contained in:
Lucas Bordeau 2023-11-15 19:17:20 +01:00 committed by GitHub
parent c02717c1e3
commit 82142ab70e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 166 additions and 38 deletions

View File

@ -1,4 +1,4 @@
import { useLocation, useNavigate } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
import { useCurrentUserTaskCount } from '@/activities/tasks/hooks/useCurrentUserDueTaskCount'; import { useCurrentUserTaskCount } from '@/activities/tasks/hooks/useCurrentUserDueTaskCount';
import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu'; import { useCommandMenu } from '@/command-menu/hooks/useCommandMenu';
@ -7,26 +7,19 @@ import { ObjectMetadataNavItems } from '@/object-metadata/components/ObjectMetad
import { SettingsNavbar } from '@/settings/components/SettingsNavbar'; import { SettingsNavbar } from '@/settings/components/SettingsNavbar';
import { import {
IconBell, IconBell,
IconBuildingSkyscraper,
IconCheckbox, IconCheckbox,
IconSearch, IconSearch,
IconSettings, IconSettings,
IconTargetArrow,
IconUser,
} from '@/ui/display/icon/index'; } from '@/ui/display/icon/index';
import { useIsSubMenuNavbarDisplayed } from '@/ui/layout/hooks/useIsSubMenuNavbarDisplayed'; import { useIsSubMenuNavbarDisplayed } from '@/ui/layout/hooks/useIsSubMenuNavbarDisplayed';
import MainNavbar from '@/ui/navigation/navbar/components/MainNavbar'; import MainNavbar from '@/ui/navigation/navbar/components/MainNavbar';
import NavItem from '@/ui/navigation/navbar/components/NavItem'; import NavItem from '@/ui/navigation/navbar/components/NavItem';
import NavTitle from '@/ui/navigation/navbar/components/NavTitle'; import NavTitle from '@/ui/navigation/navbar/components/NavTitle';
import { measureTotalFrameLoad } from './utils/measureTotalFrameLoad';
export const AppNavbar = () => { export const AppNavbar = () => {
const currentPath = useLocation().pathname; const currentPath = useLocation().pathname;
const { openCommandMenu } = useCommandMenu(); const { openCommandMenu } = useCommandMenu();
const navigate = useNavigate();
const isInSubMenu = useIsSubMenuNavbarDisplayed(); const isInSubMenu = useIsSubMenuNavbarDisplayed();
const { currentUserDueTaskCount } = useCurrentUserTaskCount(); const { currentUserDueTaskCount } = useCurrentUserTaskCount();
@ -62,34 +55,6 @@ export const AppNavbar = () => {
/> />
<Favorites /> <Favorites />
<NavTitle label="Workspace" /> <NavTitle label="Workspace" />
<NavItem
label="Companies"
to="/companies"
Icon={IconBuildingSkyscraper}
active={currentPath === '/companies'}
/>
<NavItem
label="People"
to="/people"
onClick={() => {
measureTotalFrameLoad('people');
navigate('/people');
}}
Icon={IconUser}
active={currentPath === '/people'}
/>
<NavItem
label="Opportunities"
// to="/opportunities"
onClick={() => {
measureTotalFrameLoad('opportunities');
navigate('/opportunities');
}}
Icon={IconTargetArrow}
active={currentPath === '/opportunities'}
/>
<ObjectMetadataNavItems /> <ObjectMetadataNavItems />
</MainNavbar> </MainNavbar>
) : ( ) : (

View File

@ -12,6 +12,7 @@ import { seedViews } from 'src/database/typeorm-seeds/tenant/views';
import { TypeORMService } from 'src/database/typeorm/typeorm.service'; import { TypeORMService } from 'src/database/typeorm/typeorm.service';
import { seedMetadataSchema } from 'src/database/typeorm-seeds/metadata'; import { seedMetadataSchema } from 'src/database/typeorm-seeds/metadata';
import { seedWorkspaceMember } from 'src/database/typeorm-seeds/tenant/workspaceMember'; import { seedWorkspaceMember } from 'src/database/typeorm-seeds/tenant/workspaceMember';
import { seedPeople } from 'src/database/typeorm-seeds/tenant/people';
// TODO: implement dry-run // TODO: implement dry-run
@Command({ @Command({
@ -58,6 +59,8 @@ export class DataSeedTenantCommand extends CommandRunner {
); );
await seedCompanies(workspaceDataSource, dataSourceMetadata.schema); await seedCompanies(workspaceDataSource, dataSourceMetadata.schema);
await seedPeople(workspaceDataSource, dataSourceMetadata.schema);
await seedViews(workspaceDataSource, dataSourceMetadata.schema); await seedViews(workspaceDataSource, dataSourceMetadata.schema);
await seedViewFields(workspaceDataSource, dataSourceMetadata.schema); await seedViewFields(workspaceDataSource, dataSourceMetadata.schema);
await seedWorkspaceMember(workspaceDataSource, dataSourceMetadata.schema); await seedWorkspaceMember(workspaceDataSource, dataSourceMetadata.schema);

View File

@ -193,7 +193,7 @@ export const seedPersonFieldMetadata = async (
}, },
description: 'Contacts avatar', description: 'Contacts avatar',
icon: 'IconFileUpload', icon: 'IconFileUpload',
isNullable: false, isNullable: true,
}, },
// Relationships // Relationships
@ -225,7 +225,7 @@ export const seedPersonFieldMetadata = async (
targetColumnMap: {}, targetColumnMap: {},
description: 'Point of Contact for Opportuniites', description: 'Point of Contact for Opportuniites',
icon: 'IconArrowTarget', icon: 'IconArrowTarget',
isNullable: false, isNullable: true,
}, },
{ {
id: SeedPersonFieldMetadataIds.ActivityTargets, id: SeedPersonFieldMetadataIds.ActivityTargets,

View File

@ -0,0 +1,160 @@
import { DataSource } from 'typeorm';
const tableName = 'person';
export const seedPeople = async (
workspaceDataSource: DataSource,
schemaName: string,
) => {
await workspaceDataSource
.createQueryBuilder()
.insert()
.into(`${schemaName}.${tableName}`, [
'id',
'firstName',
'lastName',
'phone',
'city',
'companyId',
'email',
])
.orIgnore()
.values([
{
id: '86083141-1c0e-494c-a1b6-85b1c6fefaa5',
firstName: 'Christoph',
lastName: 'Callisto',
phone: '+33789012345',
city: 'Seattle',
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
email: 'christoph.calisto@linkedin.com',
},
{
id: '0aa00beb-ac73-4797-824e-87a1f5aea9e0',
firstName: 'Sylvie',
lastName: 'Palmer',
phone: '+33780123456',
city: 'Los Angeles',
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
email: 'sylvie.palmer@linkedin.com',
},
{
id: '93c72d2e-f517-42fd-80ae-14173b3b70ae',
firstName: 'Christopher',
lastName: 'Gonzalez',
phone: '+33789012345',
city: 'Seattle',
companyId: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
email: 'christopher.gonzalez@qonto.com',
},
{
id: 'eeeacacf-eee1-4690-ad2c-8619e5b56a2e',
firstName: 'Ashley',
lastName: 'Parker',
phone: '+33780123456',
city: 'Los Angeles',
companyId: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
email: 'ashley.parker@qonto.com',
},
{
id: '9b324a88-6784-4449-afdf-dc62cb8702f2',
firstName: 'Nicholas',
lastName: 'Wright',
phone: '+33781234567',
city: 'Seattle',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
email: 'nicholas.wright@microsoft.com',
},
{
id: '1d151852-490f-4466-8391-733cfd66a0c8',
firstName: 'Isabella',
lastName: 'Scott',
phone: '+33782345678',
city: 'New York',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
email: 'isabella.scott@microsoft.com',
},
{
id: '98406e26-80f1-4dff-b570-a74942528de3',
firstName: 'Matthew',
lastName: 'Green',
phone: '+33783456789',
city: 'Seattle',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
email: 'matthew.green@microsoft.com',
},
{
id: 'a2e78a5f-338b-46df-8811-fa08c7d19d35',
firstName: 'Elizabeth',
lastName: 'Baker',
phone: '+33784567890',
city: 'New York',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'elizabeth.baker@airbnb.com',
},
{
id: 'ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016',
firstName: 'Christopher',
lastName: 'Nelson',
phone: '+33785678901',
city: 'San Francisco',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'christopher.nelson@airbnb.com',
},
{
id: '56955422-5d54-41b7-ba36-f0d20e1417ae',
firstName: 'Avery',
lastName: 'Carter',
phone: '+33786789012',
city: 'New York',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'avery.carter@airbnb.com',
},
{
id: '755035db-623d-41fe-92e7-dd45b7c568e1',
firstName: 'Ethan',
lastName: 'Mitchell',
phone: '+33787890123',
city: 'Los Angeles',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'ethan.mitchell@google.com',
},
{
id: '240da2ec-2d40-4e49-8df4-9c6a049190ef',
firstName: 'Madison',
lastName: 'Perez',
phone: '+33788901234',
city: 'Seattle',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'madison.perez@google.com',
},
{
id: '240da2ec-2d40-4e49-8df4-9c6a049190df',
firstName: 'Bertrand',
lastName: 'Voulzy',
phone: '+33788901234',
city: 'Seattle',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
email: 'bertrand.voulzy@google.com',
},
{
id: '240da2ec-2d40-4e49-8df4-9c6a049191de',
firstName: 'Louis',
lastName: 'Duss',
phone: '+33788901234',
city: 'Seattle',
companyId: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
email: 'louis.duss@google.com',
},
{
id: '240da2ec-2d40-4e49-8df4-9c6a049191df',
firstName: 'Lorie',
lastName: 'Vladim',
phone: '+33788901235',
city: 'Seattle',
companyId: 'a674fa6c-1455-4c57-afaf-dd5dc086361d',
email: 'lorie.vladim@google.com',
},
])
.execute();
};