feat: disable atomic operation on nestjs graphql models (#751)
* feat: no atomic * feat: update front not atomic operations * feat: optional fields for person model & use proper gql type * Fix bug display name * Fix bug update user * Fixed bug avatar URL * Fixed display name on people cell * Fix lint * Fixed storybook display name * Fix storybook requests --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
@ -8,7 +8,7 @@ import {
|
||||
Company,
|
||||
User,
|
||||
useSearchUserQuery,
|
||||
useUpdateCompanyMutation,
|
||||
useUpdateOneCompanyMutation,
|
||||
} from '~/generated/graphql';
|
||||
|
||||
export type OwnProps = {
|
||||
@ -31,7 +31,7 @@ export function CompanyAccountOwnerPicker({
|
||||
const [searchFilter] = useRecoilScopedState(
|
||||
relationPickerSearchFilterScopedState,
|
||||
);
|
||||
const [updateCompany] = useUpdateCompanyMutation();
|
||||
const [updateCompany] = useUpdateOneCompanyMutation();
|
||||
|
||||
const companies = useFilteredSearchEntityQuery({
|
||||
queryHook: useSearchUserQuery,
|
||||
@ -51,8 +51,10 @@ export function CompanyAccountOwnerPicker({
|
||||
async function handleEntitySelected(selectedUser: UserForSelect) {
|
||||
await updateCompany({
|
||||
variables: {
|
||||
...company,
|
||||
accountOwnerId: selectedUser.id,
|
||||
where: { id: company.id },
|
||||
data: {
|
||||
accountOwner: { connect: { id: selectedUser.id } },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import { getOperationName } from '@apollo/client/utilities';
|
||||
import { EditableCellChip } from '@/ui/table/editable-cell/types/EditableChip';
|
||||
import {
|
||||
GetCompaniesQuery,
|
||||
useUpdateCompanyMutation,
|
||||
useUpdateOneCompanyMutation,
|
||||
} from '~/generated/graphql';
|
||||
import { getLogoUrlFromDomainName } from '~/utils';
|
||||
|
||||
@ -20,7 +20,7 @@ type OwnProps = {
|
||||
};
|
||||
|
||||
export function CompanyEditableNameChipCell({ company }: OwnProps) {
|
||||
const [updateCompany] = useUpdateCompanyMutation();
|
||||
const [updateCompany] = useUpdateOneCompanyMutation();
|
||||
|
||||
const [internalValue, setInternalValue] = useState(company.name ?? '');
|
||||
|
||||
@ -44,8 +44,10 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) {
|
||||
onSubmit={() =>
|
||||
updateCompany({
|
||||
variables: {
|
||||
id: company.id,
|
||||
name: internalValue,
|
||||
where: { id: company.id },
|
||||
data: {
|
||||
name: internalValue,
|
||||
},
|
||||
},
|
||||
refetchQueries: [getOperationName(GET_COMPANY) ?? ''],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user