refactor: move mapper in interface

This commit is contained in:
Sammy Teillet
2023-04-20 15:41:18 +02:00
parent b8032e9605
commit b3acfa465b
3 changed files with 18 additions and 16 deletions

View File

@ -28,3 +28,16 @@ export type GraphqlPerson = {
phone: string;
__typename: string;
};
export const mapPerson = (person: GraphqlPerson): Person => ({
fullName: `${person.firstname} ${person.lastname}`,
creationDate: new Date(person.created_at),
pipe: { name: 'coucou', id: 1, icon: 'faUser' },
...person,
company: {
id: 1,
name: person.company.company_name,
domain: person.company.company_domain,
},
countryCode: 'FR',
});