Chore: Use Fragments as types (#1670)

* Use Fragments as types

Co-authored-by: v1b3m <vibenjamin6@gmail.com>

* Use Fragments as types in GraphQL queries and mutations

Co-authored-by: v1b3m <vibenjamin6@gmail.com>

---------

Co-authored-by: v1b3m <vibenjamin6@gmail.com>
This commit is contained in:
gitstart-twenty
2023-09-20 09:58:59 +01:00
committed by GitHub
parent 3f600146b1
commit 103fb701e7
25 changed files with 354 additions and 561 deletions

View File

@ -1,7 +1,7 @@
import { gql } from '@apollo/client';
export const PERSON_FIELDS_FRAGMENT = gql`
fragment personFieldsFragment on Person {
export const BASE_PERSON_FIELDS_FRAGMENT = gql`
fragment basePersonFieldsFragment on Person {
id
phone
email
@ -9,11 +9,17 @@ export const PERSON_FIELDS_FRAGMENT = gql`
firstName
lastName
displayName
avatarUrl
createdAt
}
`;
export const PERSON_FIELDS_FRAGMENT = gql`
fragment personFieldsFragment on Person {
...basePersonFieldsFragment
jobTitle
linkedinUrl
xUrl
avatarUrl
createdAt
_activityCount
company {
id

View File

@ -6,23 +6,7 @@ export const UPDATE_ONE_PERSON = gql`
$data: PersonUpdateInput!
) {
updateOnePerson(data: $data, where: $where) {
id
city
company {
domainName
name
id
}
avatarUrl
email
jobTitle
linkedinUrl
xUrl
firstName
lastName
displayName
phone
createdAt
...personFieldsFragment
}
}
`;

View File

@ -7,24 +7,7 @@ export const GET_PEOPLE = gql`
$limit: Int
) {
people: findManyPerson(orderBy: $orderBy, where: $where, take: $limit) {
id
phone
email
city
firstName
lastName
displayName
jobTitle
linkedinUrl
xUrl
avatarUrl
createdAt
_activityCount
company {
id
name
domainName
}
...personFieldsFragment
}
}
`;

View File

@ -3,24 +3,7 @@ import { gql } from '@apollo/client';
export const GET_PERSON = gql`
query GetPerson($id: String!) {
findUniquePerson(id: $id) {
id
firstName
lastName
displayName
email
createdAt
city
jobTitle
linkedinUrl
xUrl
avatarUrl
phone
_activityCount
company {
id
name
domainName
}
...personFieldsFragment
Favorite {
id
person {