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,23 +1,35 @@
import { gql } from '@apollo/client';
export const BASE_COMPANY_FIELDS_FRAGMENT = gql`
fragment baseCompanyFieldsFragment on Company {
address
annualRecurringRevenue
createdAt
domainName
employees
id
idealCustomerProfile
linkedinUrl
name
xUrl
_activityCount
}
`;
export const BASE_ACCOUNT_OWNER_FRAGMENT = gql`
fragment baseAccountOwnerFragment on User {
id
email
displayName
avatarUrl
}
`;
export const COMPANY_FIELDS_FRAGMENT = gql`
fragment companyFieldsFragment on Company {
accountOwner {
id
email
displayName
avatarUrl
...baseAccountOwnerFragment
}
address
createdAt
domainName
employees
linkedinUrl
xUrl
annualRecurringRevenue
idealCustomerProfile
id
name
_activityCount
...baseCompanyFieldsFragment
}
`;

View File

@ -6,25 +6,12 @@ export const GET_COMPANIES = gql`
$where: CompanyWhereInput
) {
companies: findManyCompany(orderBy: $orderBy, where: $where) {
id
domainName
name
createdAt
address
linkedinUrl
xUrl
annualRecurringRevenue
idealCustomerProfile
employees
_activityCount
accountOwner {
id
email
displayName
...baseAccountOwnerFragment
firstName
lastName
avatarUrl
}
...baseCompanyFieldsFragment
}
}
`;

View File

@ -3,23 +3,7 @@ import { gql } from '@apollo/client';
export const GET_COMPANY = gql`
query GetCompany($where: CompanyWhereUniqueInput!) {
findUniqueCompany(where: $where) {
id
domainName
name
createdAt
address
linkedinUrl
xUrl
annualRecurringRevenue
idealCustomerProfile
employees
_activityCount
accountOwner {
id
email
displayName
avatarUrl
}
...companyFieldsFragment
Favorite {
id
person {