Sync table from frontend (#4894)

This PR:
- separates the existing updateSyncStatus endpoint into 2 endpoints
- creates mutations and hooks that will call those endpoints
- trigger the hook on toggle
- removes form logic and add a separated component for toggling

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
Thomas Trompette
2024-04-11 11:51:49 +02:00
committed by GitHub
parent bea6d4173c
commit aecf8783a0
20 changed files with 372 additions and 149 deletions

View File

@ -1,10 +1,10 @@
import { useQuery } from '@apollo/client';
import { GET_MANY_DATABASE_CONNECTION_TABLES } from '@/databases/graphql/queries/findManyDatabaseConnectionTables';
import { GET_MANY_REMOTE_TABLES } from '@/databases/graphql/queries/findManyRemoteTables';
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
import {
GetManyDatabaseConnectionTablesQuery,
GetManyDatabaseConnectionTablesQueryVariables,
GetManyRemoteTablesQuery,
GetManyRemoteTablesQueryVariables,
} from '~/generated-metadata/graphql';
type UseGetDatabaseConnectionTablesParams = {
@ -19,9 +19,9 @@ export const useGetDatabaseConnectionTables = ({
const apolloMetadataClient = useApolloMetadataClient();
const { data } = useQuery<
GetManyDatabaseConnectionTablesQuery,
GetManyDatabaseConnectionTablesQueryVariables
>(GET_MANY_DATABASE_CONNECTION_TABLES, {
GetManyRemoteTablesQuery,
GetManyRemoteTablesQueryVariables
>(GET_MANY_REMOTE_TABLES, {
client: apolloMetadataClient ?? undefined,
skip: skip || !apolloMetadataClient,
variables: {