Add seeds and move to uuid (#80)

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Charles Bochet
2023-04-26 16:42:01 +02:00
committed by GitHub
parent 5aec7ca730
commit 6c7eb53333
38 changed files with 523 additions and 5935 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -39,11 +39,12 @@ const StyledEditable = styled.div`
left: -1px;
width: calc(100% + 2px);
height: calc(100% + 2px);
border: 1px solid ${(props) => props.theme.blue};
border: 1px solid ${(props) => props.theme.text20};
border-radius: 4px;
pointer-events: none;
display: block;
z-index: 1;
box-shadow: 0px 3px 12px rgba(0, 0, 0, 0.09);
}
`;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
export interface Company {
id: number;
id: string;
name: string;
domain: string;
domain_name: string;
}

View File

@ -3,7 +3,7 @@ import { mapGqlPerson, mapPerson } from './person.interface';
describe('mapPerson', () => {
it('should map person', () => {
const person = mapPerson({
id: 1,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
firstname: 'John',
lastname: 'Doe',
email: '',
@ -12,9 +12,9 @@ describe('mapPerson', () => {
created_at: '',
company: {
__typename: '',
id: 1,
company_name: '',
company_domain: '',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
name: '',
domain_name: '',
},
__typename: '',
});
@ -23,19 +23,19 @@ describe('mapPerson', () => {
it('should map person back', () => {
const person = mapGqlPerson({
id: 1,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
fullName: 'John Doe',
email: '',
phone: '',
city: '',
company: {
id: 1,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
name: '',
domain: '',
domain_name: '',
},
creationDate: new Date(),
pipe: {
id: 3,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6c',
name: '',
icon: '',
},

View File

@ -2,7 +2,7 @@ import { Company } from './company.interface';
import { Pipe } from './pipe.interface';
export type Person = {
id: number;
id: string;
fullName: string;
picture?: string;
email: string;
@ -18,14 +18,14 @@ export type GraphqlQueryPerson = {
city: string;
company: {
__typename: string;
id: number;
company_name: string;
company_domain: string;
id: string;
name: string;
domain_name: string;
};
created_at: string;
email: string;
firstname: string;
id: number;
id: string;
lastname: string;
phone: string;
__typename: string;
@ -33,11 +33,11 @@ export type GraphqlQueryPerson = {
export type GraphqlMutationPerson = {
city: string;
company_id?: number;
company_id?: string;
created_at: string;
email: string;
firstname: string;
id: number;
id: string;
lastname: string;
phone: string;
__typename: string;
@ -46,12 +46,16 @@ export type GraphqlMutationPerson = {
export const mapPerson = (person: GraphqlQueryPerson): Person => ({
fullName: `${person.firstname} ${person.lastname}`,
creationDate: new Date(person.created_at),
pipe: { name: 'coucou', id: 1, icon: '💰' },
pipe: {
name: 'coucou',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
icon: '💰',
},
...person,
company: {
id: person.company.id,
name: person.company.company_name,
domain: person.company.company_domain,
name: person.company.name,
domain_name: person.company.domain_name,
},
countryCode: 'FR',
});

View File

@ -1,5 +1,5 @@
export interface Pipe {
id: number;
id: string;
name: string;
icon: string;
}

View File

@ -1,5 +1,5 @@
export interface User {
id: number;
id: string;
email: string;
first_name: string;
last_name: string;

View File

@ -1,5 +1,5 @@
export interface Workspace {
id: number;
id: string;
name: string;
logo: string;
}

File diff suppressed because one or more lines are too long

View File

@ -2,15 +2,15 @@ import { GraphqlQueryPerson } from '../../interfaces/person.interface';
export const defaultData: Array<GraphqlQueryPerson> = [
{
id: 1,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
__typename: 'Person',
firstname: 'Alexandre',
lastname: 'Prot',
email: 'alexandre@qonto.com',
company: {
id: 1,
company_name: 'Qonto',
company_domain: 'qonto.com',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6c',
name: 'Qonto',
domain_name: 'qonto.com',
__typename: 'Company',
},
phone: '06 12 34 56 78',
@ -19,15 +19,15 @@ export const defaultData: Array<GraphqlQueryPerson> = [
city: 'Paris',
},
{
id: 2,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
__typename: 'Person',
firstname: 'Alexandre',
lastname: 'Prot',
email: 'alexandre@qonto.com',
company: {
id: 1,
company_name: 'LinkedIn',
company_domain: 'linkedin.com',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6e',
name: 'LinkedIn',
domain_name: 'linkedin.com',
__typename: 'Company',
},
phone: '06 12 34 56 78',
@ -36,15 +36,15 @@ export const defaultData: Array<GraphqlQueryPerson> = [
city: 'Paris',
},
{
id: 3,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6f',
__typename: 'Person',
firstname: 'Alexandre',
lastname: 'Prot',
email: 'alexandre@qonto.com',
company: {
id: 1,
company_name: 'Sequoia',
company_domain: 'sequoiacap.com',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6g',
name: 'Sequoia',
domain_name: 'sequoiacap.com',
__typename: 'Company',
},
phone: '06 12 34 56 78',
@ -54,15 +54,15 @@ export const defaultData: Array<GraphqlQueryPerson> = [
},
{
id: 4,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6h',
__typename: 'Person',
firstname: 'Alexandre',
lastname: 'Prot',
email: 'alexandre@qonto.com',
company: {
id: 1,
company_name: 'Facebook',
company_domain: 'facebook.com',
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6i',
name: 'Facebook',
domain_name: 'facebook.com',
__typename: 'Company',
},
phone: '06 12 34 56 78',

View File

@ -112,7 +112,7 @@ export const peopleColumns = [
<ClickableCell href="#">
<CompanyChip
name={props.row.original.company.name}
picture={`https://www.google.com/s2/favicons?domain=${props.row.original.company.domain}&sz=256`}
picture={`https://www.google.com/s2/favicons?domain=${props.row.original.company.domain_name}&sz=256`}
/>
</ClickableCell>
),

View File

@ -24,16 +24,16 @@ jest.mock('../../../apollo', () => {
it('updates a person', async () => {
const result = await updatePerson({
fullName: 'John Doe',
id: 1,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6c',
email: 'john@example.com',
company: {
id: 2,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6b',
name: 'ACME',
domain: 'example.com',
domain_name: 'example.com',
},
phone: '+1 (555) 123-4567',
pipe: {
id: 3,
id: '7dfbc3f7-6e5e-4128-957e-8d86808cdf6d',
name: 'Customer',
icon: '!',
},

View File

@ -21,7 +21,7 @@ export const reduceSortsToOrderBy = (
acc['firstname'] = order;
acc['lastname'] = order;
} else if (id === 'company_name') {
acc['company'] = { company_name: order };
acc['company'] = { name: order };
} else {
acc[id] = order;
}
@ -42,8 +42,8 @@ export const GET_PEOPLE = gql`
created_at
company {
id
company_name
company_domain
name
domain_name
}
}
}

View File

@ -4,12 +4,12 @@ import { apiClient } from '../../apollo';
export const UPDATE_PERSON = gql`
mutation UpdatePeople(
$id: Int
$id: uuid
$firstname: String
$lastname: String
$phone: String
$city: String
$company_id: Int
$company_id: uuid
$email: String
) {
update_people(
@ -27,8 +27,8 @@ export const UPDATE_PERSON = gql`
returning {
city
company {
company_domain
company_name
domain_name
name
id
}
email