* Added comments and authors on drawer with proper resolving * Fixed generated front graphql from rebase * Fixed comment chip * wip * wip 2 * - Added string typing for DateTime scalar - Refactored user in a recoil state and workspace using it - Added comment creation * Put theme and user state in generic providers * Fix from rebase * Fixed app theme provider removed from storybook * Wip * Fix graphql front * Fixed backend bug * - Added comment fetching in creation mode - Fixed drawer overflows and heights * - Fixed autosize validation button CSS bug * Fixed CSS bug with drawer changing height if overflow * Fixed text input too many event catched and useless error message * Removed console.log * Fixed comment cell chip * Create comment thread on each comment action bar click * Fixed lint * Fixed TopBar height
81 lines
1.9 KiB
TypeScript
81 lines
1.9 KiB
TypeScript
import { gql } from '@apollo/client';
|
|
|
|
import {
|
|
useGetCompanyCommentsCountQuery,
|
|
useGetPeopleCommentsCountQuery,
|
|
} from '../../../generated/graphql';
|
|
|
|
export const GET_COMPANY_COMMENT_COUNT = gql`
|
|
query GetCompanyCommentsCount($where: CompanyWhereInput) {
|
|
companies: findManyCompany(where: $where) {
|
|
commentsCount: _commentCount
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const useCompanyCommentsCountQuery = (companyId: string) => {
|
|
const { data, ...rest } = useGetCompanyCommentsCountQuery({
|
|
variables: { where: { id: { equals: companyId } } },
|
|
});
|
|
return { ...rest, data: data?.companies[0].commentsCount };
|
|
};
|
|
|
|
export const GET_PEOPLE_COMMENT_COUNT = gql`
|
|
query GetPeopleCommentsCount($where: PersonWhereInput) {
|
|
people: findManyPerson(where: $where) {
|
|
commentsCount: _commentCount
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const usePeopleCommentsCountQuery = (personId: string) => {
|
|
const { data, ...rest } = useGetPeopleCommentsCountQuery({
|
|
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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const GET_COMMENT_THREAD = gql`
|
|
query GetCommentThread($commentThreadId: String!) {
|
|
findManyCommentThreads(where: { id: { equals: $commentThreadId } }) {
|
|
id
|
|
comments {
|
|
id
|
|
body
|
|
createdAt
|
|
updatedAt
|
|
author {
|
|
id
|
|
displayName
|
|
avatarUrl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|