refactor: extract mapper

This commit is contained in:
Sammy Teillet
2023-04-20 13:57:04 +02:00
parent 33e12a52c7
commit 7a89e5591d
2 changed files with 16 additions and 14 deletions

View File

@ -0,0 +1,14 @@
import { GraphqlPerson, Person } from './types';
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',
});