feat: fetch database connection tables in Settings/Integrations/Datab… (#4882)

…ase/Connection

Closes #4758

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
Thaïs
2024-04-09 14:22:15 +02:00
committed by GitHub
parent 19df43156e
commit 704f7f6d8e
21 changed files with 275 additions and 87 deletions

View File

@ -0,0 +1,12 @@
import { gql } from '@apollo/client';
export const DATABASE_CONNECTION_FRAGMENT = gql`
fragment RemoteServerFields on RemoteServer {
id
createdAt
foreignDataWrapperId
foreignDataWrapperOptions
foreignDataWrapperType
updatedAt
}
`;

View File

@ -1,12 +1,12 @@
import { gql } from '@apollo/client';
import { DATABASE_CONNECTION_FRAGMENT } from '@/databases/graphql/fragments/databaseConnectionFragment';
export const CREATE_ONE_DATABASE_CONNECTION = gql`
${DATABASE_CONNECTION_FRAGMENT}
mutation createServer($input: CreateRemoteServerInput!) {
createOneRemoteServer(input: $input) {
id
foreignDataWrapperId
foreignDataWrapperOptions
foreignDataWrapperType
...RemoteServerFields
}
}
`;

View File

@ -0,0 +1,11 @@
import { gql } from '@apollo/client';
export const GET_MANY_DATABASE_CONNECTION_TABLES = gql`
query GetManyDatabaseConnectionTables($input: RemoteServerIdInput!) {
findAvailableRemoteTablesByServerId(input: $input) {
name
schema
status
}
}
`;

View File

@ -1,14 +1,12 @@
import { gql } from '@apollo/client';
import { DATABASE_CONNECTION_FRAGMENT } from '@/databases/graphql/fragments/databaseConnectionFragment';
export const GET_MANY_DATABASE_CONNECTIONS = gql`
${DATABASE_CONNECTION_FRAGMENT}
query GetManyDatabaseConnections($input: RemoteServerTypeInput!) {
findManyRemoteServersByType(input: $input) {
id
createdAt
foreignDataWrapperId
foreignDataWrapperOptions
foreignDataWrapperType
updatedAt
...RemoteServerFields
}
}
`;

View File

@ -0,0 +1,12 @@
import { gql } from '@apollo/client';
import { DATABASE_CONNECTION_FRAGMENT } from '@/databases/graphql/fragments/databaseConnectionFragment';
export const GET_ONE_DATABASE_CONNECTION = gql`
${DATABASE_CONNECTION_FRAGMENT}
query GetOneDatabaseConnection($input: RemoteServerIdInput!) {
findOneRemoteServerById(input: $input) {
...RemoteServerFields
}
}
`;