mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-29 15:25:45 +03:00
Add updatePerson function
This commit is contained in:
parent
24a228bd44
commit
38132749c2
@ -1 +1,2 @@
|
||||
export * from './select';
|
||||
export * from './update';
|
||||
|
50
front/src/services/people/update.ts
Normal file
50
front/src/services/people/update.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import { gql } from '@apollo/client';
|
||||
import { Person, mapGqlPerson } from '../../interfaces/person.interface';
|
||||
import { apiClient } from '../../apollo';
|
||||
|
||||
const UPDATE_PERSON = gql`
|
||||
mutation UpdatePeople(
|
||||
$id: Int
|
||||
$firstname: String
|
||||
$lastname: String
|
||||
$phone: String
|
||||
$city: String
|
||||
$company_id: Int
|
||||
$email: String
|
||||
) {
|
||||
update_people(
|
||||
where: { id: { _eq: $id } }
|
||||
_set: {
|
||||
city: $city
|
||||
company_id: $company_id
|
||||
email: $email
|
||||
firstname: $firstname
|
||||
id: $id
|
||||
lastname: $lastname
|
||||
phone: $phone
|
||||
}
|
||||
) {
|
||||
returning {
|
||||
city
|
||||
company {
|
||||
company_domain
|
||||
company_name
|
||||
id
|
||||
}
|
||||
email
|
||||
firstname
|
||||
id
|
||||
lastname
|
||||
phone
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export async function updatePerson(person: Person) {
|
||||
const result = await apiClient.mutate({
|
||||
mutation: UPDATE_PERSON,
|
||||
variables: mapGqlPerson(person),
|
||||
});
|
||||
return result;
|
||||
}
|
Loading…
Reference in New Issue
Block a user