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:
@ -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
|
||||
}
|
||||
`;
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user