diff --git a/front/src/interfaces/person.interface.test.ts b/front/src/interfaces/person.interface.test.ts index e5c01f812..75aa9f4f5 100644 --- a/front/src/interfaces/person.interface.test.ts +++ b/front/src/interfaces/person.interface.test.ts @@ -12,6 +12,7 @@ describe('mapPerson', () => { created_at: '', company: { __typename: '', + id: 1, company_name: '', company_domain: '', }, diff --git a/front/src/interfaces/person.interface.ts b/front/src/interfaces/person.interface.ts index c9c8b56c4..f88f9bea4 100644 --- a/front/src/interfaces/person.interface.ts +++ b/front/src/interfaces/person.interface.ts @@ -14,10 +14,11 @@ export type Person = { countryCode: string; }; -export type GraphqlPerson = { +export type GraphqlQueryPerson = { city: string; company: { __typename: string; + id: number; company_name: string; company_domain: string; }; @@ -48,7 +49,7 @@ export const mapPerson = (person: GraphqlQueryPerson): Person => ({ pipe: { name: 'coucou', id: 1, icon: '💰' }, ...person, company: { - id: 1, + id: person.company.id, name: person.company.company_name, domain: person.company.company_domain, }, diff --git a/front/src/pages/people/default-data.ts b/front/src/pages/people/default-data.ts index b0efc97a5..16b30571a 100644 --- a/front/src/pages/people/default-data.ts +++ b/front/src/pages/people/default-data.ts @@ -1,6 +1,6 @@ -import { GraphqlPerson } from '../../interfaces/person.interface'; +import { GraphqlQueryPerson } from '../../interfaces/person.interface'; -export const defaultData: Array = [ +export const defaultData: Array = [ { id: 1, __typename: 'Person', @@ -8,6 +8,7 @@ export const defaultData: Array = [ lastname: 'Prot', email: 'alexandre@qonto.com', company: { + id: 1, company_name: 'Qonto', company_domain: 'qonto.com', __typename: 'Company', @@ -24,6 +25,7 @@ export const defaultData: Array = [ lastname: 'Prot', email: 'alexandre@qonto.com', company: { + id: 1, company_name: 'LinkedIn', company_domain: 'linkedin.com', __typename: 'Company', @@ -40,6 +42,7 @@ export const defaultData: Array = [ lastname: 'Prot', email: 'alexandre@qonto.com', company: { + id: 1, company_name: 'Sequoia', company_domain: 'sequoiacap.com', __typename: 'Company', @@ -57,6 +60,7 @@ export const defaultData: Array = [ lastname: 'Prot', email: 'alexandre@qonto.com', company: { + id: 1, company_name: 'Facebook', company_domain: 'facebook.com', __typename: 'Company', diff --git a/front/src/pages/people/people-table.tsx b/front/src/pages/people/people-table.tsx index f7fd24ad4..81b00743e 100644 --- a/front/src/pages/people/people-table.tsx +++ b/front/src/pages/people/people-table.tsx @@ -15,9 +15,11 @@ import Checkbox from '../../components/form/Checkbox'; import HorizontalyAlignedContainer from '../../layout/containers/HorizontalyAlignedContainer'; import CompanyChip from '../../components/chips/CompanyChip'; import PersonChip from '../../components/chips/PersonChip'; -import { GraphqlPerson, Person } from '../../interfaces/person.interface'; +import { GraphqlQueryPerson, Person } from '../../interfaces/person.interface'; import PipeChip from '../../components/chips/PipeChip'; import { SortType } from '../../components/table/table-header/SortAndFilterBar'; +import EditableCell from '../../components/table/EditableCell'; +import { updatePerson } from '../../services/people'; export const sortsAvailable = [ { @@ -34,9 +36,7 @@ export const sortsAvailable = [ icon: faCalendar, }, { id: 'city', label: 'City', order: 'asc', icon: faMapPin }, -] satisfies Array>; -import EditableCell from '../../components/table/EditableCell'; -import { updatePerson } from '../../services/people'; +] satisfies Array>; const columnHelper = createColumnHelper(); export const peopleColumns = [ diff --git a/front/src/services/people/select.ts b/front/src/services/people/select.ts index 9cc91a5f5..6cffc3fdd 100644 --- a/front/src/services/people/select.ts +++ b/front/src/services/people/select.ts @@ -1,5 +1,5 @@ import { QueryResult, gql, useQuery } from '@apollo/client'; -import { GraphqlPerson } from '../../interfaces/person.interface'; +import { GraphqlQueryPerson } from '../../interfaces/person.interface'; export type OrderBy = Record; @@ -14,6 +14,7 @@ export const GET_PEOPLE = gql` lastname created_at company { + id company_name company_domain } @@ -23,8 +24,8 @@ export const GET_PEOPLE = gql` export function usePeopleQuery( orderBy: OrderBy[], -): QueryResult<{ people: GraphqlPerson[] }> { - return useQuery<{ people: GraphqlPerson[] }>(GET_PEOPLE, { +): QueryResult<{ people: GraphqlQueryPerson[] }> { + return useQuery<{ people: GraphqlQueryPerson[] }>(GET_PEOPLE, { variables: { orderBy }, }); }