Use Graphql types in FE and complete mappers removal (#348)

Fix Typescript build issues
This commit is contained in:
Charles Bochet
2023-06-21 10:52:00 -07:00
committed by GitHub
parent b179d1f1f0
commit 8a330b9746
35 changed files with 398 additions and 574 deletions

View File

@ -2,19 +2,24 @@ import { CellCommentChip } from '@/comments/components/CellCommentChip';
import { useOpenCommentRightDrawer } from '@/comments/hooks/useOpenCommentRightDrawer';
import EditableChip from '@/ui/components/editable-cell/types/EditableChip';
import { getLogoUrlFromDomainName } from '@/utils/utils';
import { CommentableType } from '~/generated/graphql';
import { Company } from '../interfaces/company.interface';
import { updateCompany } from '../services';
import {
CommentableType,
GetCompaniesQuery,
useUpdateCompanyMutation,
} from '~/generated/graphql';
import CompanyChip from './CompanyChip';
type OwnProps = {
company: Company;
company: Pick<
GetCompaniesQuery['companies'][0],
'id' | 'name' | 'domainName' | '_commentCount' | 'accountOwner'
>;
};
export function CompanyEditableNameChipCell({ company }: OwnProps) {
const openCommentRightDrawer = useOpenCommentRightDrawer();
const [updateCompany] = useUpdateCompanyMutation();
function handleCommentClick(event: React.MouseEvent<HTMLDivElement>) {
event.preventDefault();
@ -35,8 +40,11 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) {
picture={getLogoUrlFromDomainName(company.domainName)}
changeHandler={(value: string) => {
updateCompany({
...company,
name: value,
variables: {
...company,
name: value,
accountOwnerId: company.accountOwner?.id,
},
});
}}
ChipComponent={CompanyChip}