Build stripe integration on backend side (#5246)

Adding stripe integration by making the server logic independent of the
input fields:
- query factories (remote server, foreign data wrapper, foreign table)
to loop on fields and values without hardcoding the names of the fields
- adding stripe input and type
- add the logic to handle static schema. Simply creating a big object to
store into the server

Additional work:
- rename username field to user. This is the input intended for postgres
user mapping and we now need a matching by name

---------

Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
Thomas Trompette
2024-05-02 17:13:15 +02:00
committed by GitHub
parent 5128ea3ffb
commit f9c19c839b
30 changed files with 396 additions and 283 deletions

View File

@ -8,7 +8,7 @@ export const DATABASE_CONNECTION_FRAGMENT = gql`
foreignDataWrapperOptions
foreignDataWrapperType
userMappingOptions {
username
user
}
updatedAt
schema

View File

@ -8,7 +8,7 @@ export const settingsIntegrationPostgreSQLConnectionFormSchema = z.object({
dbname: z.string().min(1),
host: z.string().min(1),
port: z.preprocess((val) => parseInt(val as string), z.number().positive()),
username: z.string().min(1),
user: z.string().min(1),
password: z.string().min(1),
schema: z.string().min(1),
});
@ -52,9 +52,9 @@ export const SettingsIntegrationPostgreSQLConnectionForm = ({
{ name: 'host' as const, label: 'Host', placeholder: 'host' },
{ name: 'port' as const, label: 'Port', placeholder: '5432' },
{
name: 'username' as const,
label: 'Username',
placeholder: 'username',
name: 'user' as const,
label: 'User',
placeholder: 'user',
},
{
name: 'password' as const,

View File

@ -28,7 +28,7 @@ export const getFormDefaultValuesFromConnection = ({
dbname: connection.foreignDataWrapperOptions.dbname,
host: connection.foreignDataWrapperOptions.host,
port: connection.foreignDataWrapperOptions.port,
username: connection.userMappingOptions?.username || undefined,
user: connection.userMappingOptions?.user || undefined,
schema: connection.schema || undefined,
password: '',
};
@ -51,7 +51,7 @@ export const formatValuesForUpdate = ({
const formattedValues = {
userMappingOptions: pickBy(
{
username: formValues.username,
user: formValues.user,
password: formValues.password,
},
identity,