Rename mutation maximum affected records (#6042)

As per my last comment on https://github.com/twentyhq/twenty/pull/6039,
we decided to rename this var
This commit is contained in:
Weiko 2024-06-26 18:00:25 +02:00 committed by GitHub
parent 87abc1b31d
commit 1eb9c582f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 26 additions and 13 deletions

View File

@ -32,7 +32,7 @@ export type Analytics = {
export type ApiConfig = {
__typename?: 'ApiConfig';
mutationMaximumRecordAffected: Scalars['Float'];
mutationMaximumAffectedRecords: Scalars['Float'];
};
export type ApiKeyToken = {
@ -1235,7 +1235,7 @@ export type UpdateBillingSubscriptionMutation = { __typename?: 'Mutation', updat
export type GetClientConfigQueryVariables = Exact<{ [key: string]: never; }>;
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, signUpDisabled: boolean, debugMode: boolean, chromeExtensionId?: string | null, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean, microsoft: boolean }, billing: { __typename?: 'Billing', isBillingEnabled: boolean, billingUrl?: string | null, billingFreeTrialDurationInDays?: number | null }, telemetry: { __typename?: 'Telemetry', enabled: boolean }, support: { __typename?: 'Support', supportDriver: string, supportFrontChatId?: string | null }, sentry: { __typename?: 'Sentry', dsn?: string | null, environment?: string | null, release?: string | null }, captcha: { __typename?: 'Captcha', provider?: CaptchaDriverType | null, siteKey?: string | null }, api: { __typename?: 'ApiConfig', mutationMaximumRecordAffected: number } } };
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, signUpDisabled: boolean, debugMode: boolean, chromeExtensionId?: string | null, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean, microsoft: boolean }, billing: { __typename?: 'Billing', isBillingEnabled: boolean, billingUrl?: string | null, billingFreeTrialDurationInDays?: number | null }, telemetry: { __typename?: 'Telemetry', enabled: boolean }, support: { __typename?: 'Support', supportDriver: string, supportFrontChatId?: string | null }, sentry: { __typename?: 'Sentry', dsn?: string | null, environment?: string | null, release?: string | null }, captcha: { __typename?: 'Captcha', provider?: CaptchaDriverType | null, siteKey?: string | null }, api: { __typename?: 'ApiConfig', mutationMaximumAffectedRecords: number } } };
export type SkipSyncEmailOnboardingStepMutationVariables = Exact<{ [key: string]: never; }>;
@ -2362,7 +2362,7 @@ export const GetClientConfigDocument = gql`
siteKey
}
api {
mutationMaximumRecordAffected
mutationMaximumAffectedRecords
}
chromeExtensionId
}

View File

@ -1,6 +1,7 @@
import { useEffect } from 'react';
import { useRecoilState, useSetRecoilState } from 'recoil';
import { apiConfigState } from '@/client-config/states/apiConfigState';
import { authProvidersState } from '@/client-config/states/authProvidersState';
import { billingState } from '@/client-config/states/billingState';
import { captchaProviderState } from '@/client-config/states/captchaProviderState';
@ -35,6 +36,8 @@ export const ClientConfigProviderEffect = () => {
const setChromeExtensionId = useSetRecoilState(chromeExtensionIdState);
const setApiConfig = useSetRecoilState(apiConfigState);
const { data, loading } = useGetClientConfigQuery({
skip: isClientConfigLoaded,
});
@ -68,6 +71,7 @@ export const ClientConfigProviderEffect = () => {
});
setChromeExtensionId(data?.clientConfig?.chromeExtensionId);
setApiConfig(data?.clientConfig?.api);
}
}, [
data,
@ -83,6 +87,7 @@ export const ClientConfigProviderEffect = () => {
setIsClientConfigLoaded,
setCaptchaProvider,
setChromeExtensionId,
setApiConfig,
]);
return <></>;

View File

@ -33,7 +33,7 @@ export const GET_CLIENT_CONFIG = gql`
siteKey
}
api {
mutationMaximumRecordAffected
mutationMaximumAffectedRecords
}
chromeExtensionId
}

View File

@ -0,0 +1,8 @@
import { createState } from 'twenty-ui';
import { ApiConfig } from '~/generated/graphql';
export const apiConfigState = createState<ApiConfig | null>({
key: 'apiConfigState',
defaultValue: null,
});

View File

@ -70,6 +70,6 @@ SIGN_IN_PREFILLED=true
# CAPTCHA_SECRET_KEY=
# API_RATE_LIMITING_TTL=
# API_RATE_LIMITING_LIMIT=
# MUTATION_MAXIMUM_RECORD_AFFECTED=100
# MUTATION_MAXIMUM_AFFECTED_RECORDS=100
# CHROME_EXTENSION_ID=bggmipldbceihilonnbpgoeclgbkblkp
# PG_SSL_ALLOW_SELF_SIGNED=true

View File

@ -23,4 +23,4 @@ FILE_TOKEN_SECRET=secret_file_token
# MESSAGING_PROVIDER_GMAIL_ENABLED=false
# STORAGE_TYPE=local
# STORAGE_LOCAL_PATH=.local-storage
# MUTATION_MAXIMUM_RECORD_AFFECTED=100
# MUTATION_MAXIMUM_AFFECTED_RECORDS=100

View File

@ -432,7 +432,7 @@ export class WorkspaceQueryRunnerService {
args.filter?.id?.in?.forEach((id) => assertIsValidUuid(id));
const maximumRecordAffected = this.environmentService.get(
'MUTATION_MAXIMUM_RECORD_AFFECTED',
'MUTATION_MAXIMUM_AFFECTED_RECORDS',
);
const query = await this.workspaceQueryBuilderFactory.updateMany(args, {
...options,
@ -484,7 +484,7 @@ export class WorkspaceQueryRunnerService {
assertMutationNotOnRemoteObject(objectMetadataItem);
const maximumRecordAffected = this.environmentService.get(
'MUTATION_MAXIMUM_RECORD_AFFECTED',
'MUTATION_MAXIMUM_AFFECTED_RECORDS',
);
const query = await this.workspaceQueryBuilderFactory.deleteMany(args, {
...options,
@ -691,7 +691,7 @@ export class WorkspaceQueryRunnerService {
errors,
{
atMost: this.environmentService.get(
'MUTATION_MAXIMUM_RECORD_AFFECTED',
'MUTATION_MAXIMUM_AFFECTED_RECORDS',
),
} satisfies PgGraphQLConfig,
);

View File

@ -68,7 +68,7 @@ class Captcha {
@ObjectType()
class ApiConfig {
@Field(() => Number, { nullable: false })
mutationMaximumRecordAffected: number;
mutationMaximumAffectedRecords: number;
}
@ObjectType()

View File

@ -47,8 +47,8 @@ export class ClientConfigResolver {
},
chromeExtensionId: this.environmentService.get('CHROME_EXTENSION_ID'),
api: {
mutationMaximumRecordAffected: this.environmentService.get(
'MUTATION_MAXIMUM_RECORD_AFFECTED',
mutationMaximumAffectedRecords: this.environmentService.get(
'MUTATION_MAXIMUM_AFFECTED_RECORDS',
),
},
};

View File

@ -324,7 +324,7 @@ export class EnvironmentVariables {
@CastToPositiveNumber()
@IsOptional()
@IsNumber()
MUTATION_MAXIMUM_RECORD_AFFECTED = 100;
MUTATION_MAXIMUM_AFFECTED_RECORDS = 100;
REDIS_HOST = '127.0.0.1';