* Added prisma to suggested extension in container * Added comments and authors on drawer with proper resolving * Fix lint * Fix console log * Fixed generated front graphql from rebase
62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
TypeScript
import { gql } from '@apollo/client';
|
|
|
|
import {
|
|
useGetCompanyCountsQuery,
|
|
useGetPeopleCountsQuery,
|
|
} from '../../../generated/graphql';
|
|
|
|
export const GET_COMPANY_COMMENT_COUNT = gql`
|
|
query GetCompanyCounts($where: CompanyWhereInput) {
|
|
companies: findManyCompany(where: $where) {
|
|
commentsCount: _commentCount
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const useCompanyCommentsCountQuery = (companyId: string) => {
|
|
const { data, ...rest } = useGetCompanyCountsQuery({
|
|
variables: { where: { id: { equals: companyId } } },
|
|
});
|
|
return { ...rest, data: data?.companies[0].commentsCount };
|
|
};
|
|
|
|
export const GET_PEOPLE_COMMENT_COUNT = gql`
|
|
query GetPeopleCounts($where: PersonWhereInput) {
|
|
people: findManyPerson(where: $where) {
|
|
commentsCount: _commentCount
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const usePeopleCommentsCountQuery = (personId: string) => {
|
|
const { data, ...rest } = useGetPeopleCountsQuery({
|
|
variables: { where: { id: { equals: personId } } },
|
|
});
|
|
return { ...rest, data: data?.people[0].commentsCount };
|
|
};
|
|
|
|
export const GET_COMMENT_THREADS_BY_TARGETS = gql`
|
|
query GetCommentThreadsByTargets($commentThreadTargetIds: [String!]!) {
|
|
findManyCommentThreads(
|
|
where: {
|
|
commentThreadTargets: {
|
|
some: { commentableId: { in: $commentThreadTargetIds } }
|
|
}
|
|
}
|
|
) {
|
|
id
|
|
comments {
|
|
id
|
|
body
|
|
createdAt
|
|
updatedAt
|
|
author {
|
|
id
|
|
displayName
|
|
avatarUrl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|