Skip to content

The open alternative to Salesforce, designed for AI.

Update enums to be all caps (#12372)

Félix Malfait4485e8e3db8b
diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts
index b7b8ec8f58f..83e6be4b395 100644
--- a/packages/twenty-front/src/generated-metadata/graphql.ts
+++ b/packages/twenty-front/src/generated-metadata/graphql.ts
@@ -292,8 +292,8 @@ export type Captcha = {
};
export enum CaptchaDriverType {
- GoogleRecaptcha = 'GoogleRecaptcha',
- Turnstile = 'Turnstile'
+ GOOGLE_RECAPTCHA = 'GOOGLE_RECAPTCHA',
+ TURNSTILE = 'TURNSTILE'
}
export type ClientConfig = {
@@ -652,15 +652,14 @@ export type FeatureFlagDto = {
};
export enum FeatureFlagKey {
- IsAirtableIntegrationEnabled = 'IsAirtableIntegrationEnabled',
- IsCopilotEnabled = 'IsCopilotEnabled',
- IsCustomDomainEnabled = 'IsCustomDomainEnabled',
- IsJsonFilterEnabled = 'IsJsonFilterEnabled',
- IsPermissionsV2Enabled = 'IsPermissionsV2Enabled',
- IsPostgreSQLIntegrationEnabled = 'IsPostgreSQLIntegrationEnabled',
- IsStripeIntegrationEnabled = 'IsStripeIntegrationEnabled',
- IsUniqueIndexesEnabled = 'IsUniqueIndexesEnabled',
- IsWorkflowEnabled = 'IsWorkflowEnabled'
+ IS_AIRTABLE_INTEGRATION_ENABLED = 'IS_AIRTABLE_INTEGRATION_ENABLED',
+ IS_COPILOT_ENABLED = 'IS_COPILOT_ENABLED',
+ IS_JSON_FILTER_ENABLED = 'IS_JSON_FILTER_ENABLED',
+ IS_PERMISSIONS_V2_ENABLED = 'IS_PERMISSIONS_V2_ENABLED',
+ IS_POSTGRESQL_INTEGRATION_ENABLED = 'IS_POSTGRESQL_INTEGRATION_ENABLED',
+ IS_STRIPE_INTEGRATION_ENABLED = 'IS_STRIPE_INTEGRATION_ENABLED',
+ IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED',
+ IS_WORKFLOW_ENABLED = 'IS_WORKFLOW_ENABLED'
}
export type Field = {
@@ -1291,6 +1290,7 @@ export type MutationSignUpArgs = {
email: Scalars['String']['input'];
locale?: InputMaybe<Scalars['String']['input']>;
password: Scalars['String']['input'];
+ verifyEmailNextPath?: InputMaybe<Scalars['String']['input']>;
workspaceId?: InputMaybe<Scalars['String']['input']>;
workspaceInviteHash?: InputMaybe<Scalars['String']['input']>;
workspacePersonalInviteToken?: InputMaybe<Scalars['String']['input']>;
diff --git a/packages/twenty-front/src/generated/graphql.tsx b/packages/twenty-front/src/generated/graphql.tsx
index dd2b6a8d406..447f51a8585 100644
--- a/packages/twenty-front/src/generated/graphql.tsx
+++ b/packages/twenty-front/src/generated/graphql.tsx
@@ -284,8 +284,8 @@ export type Captcha = {
};
export enum CaptchaDriverType {
- GoogleRecaptcha = 'GoogleRecaptcha',
- Turnstile = 'Turnstile'
+ GOOGLE_RECAPTCHA = 'GOOGLE_RECAPTCHA',
+ TURNSTILE = 'TURNSTILE'
}
export type ClientConfig = {
@@ -583,15 +583,14 @@ export type FeatureFlagDto = {
};
export enum FeatureFlagKey {
- IsAirtableIntegrationEnabled = 'IsAirtableIntegrationEnabled',
- IsCopilotEnabled = 'IsCopilotEnabled',
- IsCustomDomainEnabled = 'IsCustomDomainEnabled',
- IsJsonFilterEnabled = 'IsJsonFilterEnabled',
- IsPermissionsV2Enabled = 'IsPermissionsV2Enabled',
- IsPostgreSQLIntegrationEnabled = 'IsPostgreSQLIntegrationEnabled',
- IsStripeIntegrationEnabled = 'IsStripeIntegrationEnabled',
- IsUniqueIndexesEnabled = 'IsUniqueIndexesEnabled',
- IsWorkflowEnabled = 'IsWorkflowEnabled'
+ IS_AIRTABLE_INTEGRATION_ENABLED = 'IS_AIRTABLE_INTEGRATION_ENABLED',
+ IS_COPILOT_ENABLED = 'IS_COPILOT_ENABLED',
+ IS_JSON_FILTER_ENABLED = 'IS_JSON_FILTER_ENABLED',
+ IS_PERMISSIONS_V2_ENABLED = 'IS_PERMISSIONS_V2_ENABLED',
+ IS_POSTGRESQL_INTEGRATION_ENABLED = 'IS_POSTGRESQL_INTEGRATION_ENABLED',
+ IS_STRIPE_INTEGRATION_ENABLED = 'IS_STRIPE_INTEGRATION_ENABLED',
+ IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED',
+ IS_WORKFLOW_ENABLED = 'IS_WORKFLOW_ENABLED'
}
export type Field = {
diff --git a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx
index b68628c0b94..83a3cd5f325 100644
--- a/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx
+++ b/packages/twenty-front/src/modules/action-menu/actions/record-agnostic-actions/run-workflow-actions/hooks/useRunWorkflowRecordAgnosticActions.tsx
@@ -13,7 +13,7 @@ import { FeatureFlagKey } from '~/generated/graphql';
export const useRunWorkflowRecordAgnosticActions = () => {
const isWorkflowEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsWorkflowEnabled,
+ FeatureFlagKey.IS_WORKFLOW_ENABLED,
);
const { actionMenuType } = useContext(ActionMenuContext);
diff --git a/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx b/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx
index f2f5bc424b5..68718cdc09f 100644
--- a/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx
+++ b/packages/twenty-front/src/modules/action-menu/contexts/ActionMenuContextProvider.tsx
@@ -20,7 +20,7 @@ export const ActionMenuContextProvider = ({
children: React.ReactNode;
}) => {
const isWorkflowEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsWorkflowEnabled,
+ FeatureFlagKey.IS_WORKFLOW_ENABLED,
);
const contextStoreCurrentObjectMetadataItemId = useRecoilComponentValueV2(
diff --git a/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts b/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts
index 29220a2a799..633fef2e1cf 100644
--- a/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts
+++ b/packages/twenty-front/src/modules/action-menu/hooks/useShouldActionBeRegisteredParams.ts
@@ -59,7 +59,7 @@ export const useShouldActionBeRegisteredParams = ({
ContextStoreViewType.ShowPage;
const isWorkflowEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsWorkflowEnabled,
+ FeatureFlagKey.IS_WORKFLOW_ENABLED,
);
const numberOfSelectedRecords = useRecoilComponentValueV2(
diff --git a/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts b/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts
index 467ce7e0eb2..53abbe2843d 100644
--- a/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts
+++ b/packages/twenty-front/src/modules/auth/states/currentWorkspaceState.ts
@@ -1,5 +1,5 @@
-import { Role, Workspace } from '~/generated/graphql';
import { createState } from 'twenty-ui/utilities';
+import { Role, Workspace } from '~/generated/graphql';
export type CurrentWorkspace = Pick<
Workspace,
@@ -17,8 +17,8 @@ export type CurrentWorkspace = Pick<
| 'isGoogleAuthEnabled'
| 'isMicrosoftAuthEnabled'
| 'isPasswordAuthEnabled'
- | 'hasValidEnterpriseKey'
| 'isCustomDomainEnabled'
+ | 'hasValidEnterpriseKey'
| 'subdomain'
| 'customDomain'
| 'workspaceUrls'
diff --git a/packages/twenty-front/src/modules/captcha/components/CaptchaProviderScriptLoaderEffect.tsx b/packages/twenty-front/src/modules/captcha/components/CaptchaProviderScriptLoaderEffect.tsx
index 301fcfe97c7..2ed72ff107e 100644
--- a/packages/twenty-front/src/modules/captcha/components/CaptchaProviderScriptLoaderEffect.tsx
+++ b/packages/twenty-front/src/modules/captcha/components/CaptchaProviderScriptLoaderEffect.tsx
@@ -35,7 +35,7 @@ export const CaptchaProviderScriptLoaderEffect = () => {
scriptElement = document.createElement('script');
scriptElement.src = scriptUrl;
scriptElement.onload = () => {
- if (captcha.provider === CaptchaDriverType.GoogleRecaptcha) {
+ if (captcha.provider === CaptchaDriverType.GOOGLE_RECAPTCHA) {
window.grecaptcha?.ready(() => {
setIsCaptchaScriptLoaded(true);
});
@@ -55,11 +55,11 @@ export const CaptchaProviderScriptLoaderEffect = () => {
let refreshInterval: NodeJS.Timeout;
switch (captcha.provider) {
- case CaptchaDriverType.GoogleRecaptcha:
+ case CaptchaDriverType.GOOGLE_RECAPTCHA:
// Google reCAPTCHA tokens expire after 120 seconds, refresh at 110 seconds
refreshInterval = setInterval(requestFreshCaptchaToken, 110 * 1000);
break;
- case CaptchaDriverType.Turnstile:
+ case CaptchaDriverType.TURNSTILE:
// Cloudflare Turnstile tokens expire after 500 seconds, refresh at 480 seconds
refreshInterval = setInterval(requestFreshCaptchaToken, 480 * 1000);
break;
diff --git a/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts b/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts
index 88cdb20a6dc..cf790b97690 100644
--- a/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts
+++ b/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts
@@ -41,7 +41,7 @@ export const useRequestFreshCaptchaToken = () => {
let captchaWidget: any;
switch (captcha.provider) {
- case CaptchaDriverType.GoogleRecaptcha:
+ case CaptchaDriverType.GOOGLE_RECAPTCHA:
window.grecaptcha
.execute(captcha.siteKey, {
action: 'submit',
@@ -51,7 +51,7 @@ export const useRequestFreshCaptchaToken = () => {
setIsRequestingCaptchaToken(false);
});
break;
- case CaptchaDriverType.Turnstile:
+ case CaptchaDriverType.TURNSTILE:
captchaWidget = window.turnstile.render('#captcha-widget', {
sitekey: captcha.siteKey,
});
diff --git a/packages/twenty-front/src/modules/captcha/utils/__tests__/getCaptchaUrlByProvider.test.ts b/packages/twenty-front/src/modules/captcha/utils/__tests__/getCaptchaUrlByProvider.test.ts
index 40cba1f4308..9a07cb95716 100644
--- a/packages/twenty-front/src/modules/captcha/utils/__tests__/getCaptchaUrlByProvider.test.ts
+++ b/packages/twenty-front/src/modules/captcha/utils/__tests__/getCaptchaUrlByProvider.test.ts
@@ -7,7 +7,7 @@ import { getCaptchaUrlByProvider } from '../getCaptchaUrlByProvider';
describe('getCaptchaUrlByProvider', () => {
it('handles GoogleRecaptcha', async () => {
const captchaUrl = getCaptchaUrlByProvider(
- CaptchaDriverType.GoogleRecaptcha,
+ CaptchaDriverType.GOOGLE_RECAPTCHA,
'siteKey',
);
@@ -16,14 +16,14 @@ describe('getCaptchaUrlByProvider', () => {
);
expect(() =>
- getCaptchaUrlByProvider(CaptchaDriverType.GoogleRecaptcha, ''),
+ getCaptchaUrlByProvider(CaptchaDriverType.GOOGLE_RECAPTCHA, ''),
).toThrow(
'SiteKey must be provided while generating url for GoogleRecaptcha provider',
);
});
it('handles Turnstile', async () => {
- const captchaUrl = getCaptchaUrlByProvider(CaptchaDriverType.Turnstile, '');
+ const captchaUrl = getCaptchaUrlByProvider(CaptchaDriverType.TURNSTILE, '');
expect(captchaUrl).toEqual(
'https://challenges.cloudflare.com/turnstile/v0/api.js',
diff --git a/packages/twenty-front/src/modules/captcha/utils/getCaptchaUrlByProvider.ts b/packages/twenty-front/src/modules/captcha/utils/getCaptchaUrlByProvider.ts
index b3c1874ea89..a0886708ed9 100644
--- a/packages/twenty-front/src/modules/captcha/utils/getCaptchaUrlByProvider.ts
+++ b/packages/twenty-front/src/modules/captcha/utils/getCaptchaUrlByProvider.ts
@@ -7,14 +7,14 @@ export const getCaptchaUrlByProvider = (
siteKey: string,
) => {
switch (name) {
- case CaptchaDriverType.GoogleRecaptcha:
+ case CaptchaDriverType.GOOGLE_RECAPTCHA:
if (!isNonEmptyString(siteKey)) {
throw new Error(
'SiteKey must be provided while generating url for GoogleRecaptcha provider',
);
}
return `https://www.google.com/recaptcha/api.js?render=${siteKey}`;
- case CaptchaDriverType.Turnstile:
+ case CaptchaDriverType.TURNSTILE:
return 'https://challenges.cloudflare.com/turnstile/v0/api.js';
default:
throw new Error('Unknown captcha provider');
diff --git a/packages/twenty-front/src/modules/error-handler/components/SentryInitEffect.tsx b/packages/twenty-front/src/modules/error-handler/components/SentryInitEffect.tsx
index c5ee54a1d53..b40f7735a12 100644
--- a/packages/twenty-front/src/modules/error-handler/components/SentryInitEffect.tsx
+++ b/packages/twenty-front/src/modules/error-handler/components/SentryInitEffect.tsx
@@ -24,6 +24,7 @@ export const SentryInitEffect = () => {
const [isSentryInitialized, setIsSentryInitialized] = useState(false);
const [isSentryInitializing, setIsSentryInitializing] = useState(false);
+ const [isSentryUserDefined, setIsSentryUserDefined] = useState(false);
useEffect(() => {
if (
@@ -47,13 +48,14 @@ export const SentryInitEffect = () => {
setIsSentryInitializing(false);
}
- if (isDefined(currentUser)) {
+ if (isDefined(currentUser) && !isSentryUserDefined) {
setUser({
email: currentUser?.email,
id: currentUser?.id,
workspaceId: currentWorkspace?.id,
workspaceMemberId: currentWorkspaceMember?.id,
});
+ setIsSentryUserDefined(true);
} else {
setUser(null);
}
@@ -64,6 +66,7 @@ export const SentryInitEffect = () => {
currentUser,
currentWorkspace,
currentWorkspaceMember,
+ isSentryUserDefined,
]);
return <></>;
};
diff --git a/packages/twenty-front/src/modules/navigation/hooks/__tests__/useDefaultHomePagePath.test.ts b/packages/twenty-front/src/modules/navigation/hooks/__tests__/useDefaultHomePagePath.test.ts
index 23774ae8afa..8b72885a63b 100644
--- a/packages/twenty-front/src/modules/navigation/hooks/__tests__/useDefaultHomePagePath.test.ts
+++ b/packages/twenty-front/src/modules/navigation/hooks/__tests__/useDefaultHomePagePath.test.ts
@@ -4,7 +4,7 @@ import { RecoilRoot, useSetRecoilState } from 'recoil';
import { currentUserState } from '@/auth/states/currentUserState';
import { useDefaultHomePagePath } from '@/navigation/hooks/useDefaultHomePagePath';
import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { prefetchViewsState } from '@/prefetch/states/prefetchViewsState';
import { AppPath } from '@/types/AppPath';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
@@ -44,7 +44,7 @@ const renderHooks = ({
viewGroups: [],
viewSorts: [],
kanbanFieldMetadataId: '',
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
icon: '',
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromFieldMetadata.test.ts b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromFieldMetadata.test.ts
index ea7148b4b77..4a4133ab213 100644
--- a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromFieldMetadata.test.ts
+++ b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/useColumnDefinitionsFromFieldMetadata.test.ts
@@ -28,8 +28,8 @@ const Wrapper = getJestMetadataAndApolloMocksAndActionMenuWrapper({
isGoogleAuthEnabled: true,
isMicrosoftAuthEnabled: false,
isPasswordAuthEnabled: true,
+ isCustomDomainEnabled: false,
customDomain: 'my-custom-domain.com',
- isCustomDomainEnabled: true,
workspaceUrls: {
subdomainUrl: 'https://twenty.twenty.com',
customUrl: 'https://my-custom-domain.com',
diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts
index 82a7e16c73e..335fd702494 100644
--- a/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts
+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useDeleteOneFieldMetadataItem.ts
@@ -7,7 +7,7 @@ import {
import { useRefreshObjectMetadataItems } from '@/object-metadata/hooks/useRefreshObjectMetadataItem';
import { recordIndexKanbanAggregateOperationState } from '@/object-record/record-index/states/recordIndexKanbanAggregateOperationState';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { useRecoilState } from 'recoil';
import { DELETE_ONE_FIELD_METADATA_ITEM } from '../graphql/mutations';
import { useApolloMetadataClient } from './useApolloMetadataClient';
@@ -37,7 +37,7 @@ export const useDeleteOneFieldMetadataItem = () => {
) => {
if (recordIndexKanbanAggregateOperation?.fieldMetadataId === idToDelete) {
setRecordIndexKanbanAggregateOperation({
- operation: AGGREGATE_OPERATIONS.count,
+ operation: AggregateOperations.COUNT,
fieldMetadataId: null,
});
}
diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useFilteredObjectMetadataItems.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useFilteredObjectMetadataItems.ts
index 58a5812581b..a0b6b770398 100644
--- a/packages/twenty-front/src/modules/object-metadata/hooks/useFilteredObjectMetadataItems.ts
+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useFilteredObjectMetadataItems.ts
@@ -10,7 +10,7 @@ export const useFilteredObjectMetadataItems = () => {
const objectMetadataItems = useRecoilValue(objectMetadataItemsState);
const isWorkflowEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsWorkflowEnabled,
+ FeatureFlagKey.IS_WORKFLOW_ENABLED,
);
const isWorkflowToBeFiltered = useCallback(
diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts
index 05bb51cbb1c..44bcbf456b1 100644
--- a/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts
+++ b/packages/twenty-front/src/modules/object-metadata/hooks/useObjectMetadataItem.ts
@@ -6,9 +6,9 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat
import { isWorkflowRelatedObjectMetadata } from '@/object-metadata/utils/isWorkflowRelatedObjectMetadata';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
+import { isDefined } from 'twenty-shared/utils';
import { FeatureFlagKey } from '~/generated-metadata/graphql';
import { ObjectMetadataItemIdentifier } from '../types/ObjectMetadataItemIdentifier';
-import { isDefined } from 'twenty-shared/utils';
export const useObjectMetadataItem = ({
objectNameSingular,
@@ -21,7 +21,7 @@ export const useObjectMetadataItem = ({
);
const isWorkflowEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsWorkflowEnabled,
+ FeatureFlagKey.IS_WORKFLOW_ENABLED,
);
const isWorkflowToBeFiltered =
diff --git a/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForFilterFamilySelector.ts b/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForFilterFamilySelector.ts
index ff3e0d40a44..c51bd276a1c 100644
--- a/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForFilterFamilySelector.ts
+++ b/packages/twenty-front/src/modules/object-metadata/states/availableFieldMetadataItemsForFilterFamilySelector.ts
@@ -3,8 +3,8 @@ import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadat
import { getFilterFilterableFieldMetadataItems } from '@/object-metadata/utils/getFilterFilterableFieldMetadataItems';
import { checkIfFeatureFlagIsEnabledOnWorkspace } from '@/workspace/utils/checkIfFeatureFlagIsEnabledOnWorkspace';
import { selectorFamily } from 'recoil';
-import { FeatureFlagKey } from '~/generated-metadata/graphql';
import { isDefined } from 'twenty-shared/utils';
+import { FeatureFlagKey } from '~/generated-metadata/graphql';
export const availableFieldMetadataItemsForFilterFamilySelector =
selectorFamily({
@@ -24,7 +24,7 @@ export const availableFieldMetadataItemsForFilterFamilySelector =
}
const isJsonFeatureFlagEnabled = checkIfFeatureFlagIsEnabledOnWorkspace(
- FeatureFlagKey.IsJsonFilterEnabled,
+ FeatureFlagKey.IS_JSON_FILTER_ENABLED,
currentWorkspace,
);
diff --git a/packages/twenty-front/src/modules/object-record/hooks/__tests__/useAggregateRecords.test.tsx b/packages/twenty-front/src/modules/object-record/hooks/__tests__/useAggregateRecords.test.tsx
index 5eab4810f55..93e1087b6c9 100644
--- a/packages/twenty-front/src/modules/object-record/hooks/__tests__/useAggregateRecords.test.tsx
+++ b/packages/twenty-front/src/modules/object-record/hooks/__tests__/useAggregateRecords.test.tsx
@@ -5,7 +5,7 @@ import {
} from '@/object-record/hooks/__mocks__/useAggregateRecords';
import { useAggregateRecords } from '@/object-record/hooks/useAggregateRecords';
import { useAggregateRecordsQuery } from '@/object-record/hooks/useAggregateRecordsQuery';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { useQuery } from '@apollo/client';
import { renderHook } from '@testing-library/react';
@@ -20,9 +20,9 @@ const mockObjectMetadataItem = {
};
const mockGqlFieldToFieldMap = {
- sumAmount: ['amount', AGGREGATE_OPERATIONS.sum],
- avgAmount: ['amount', AGGREGATE_OPERATIONS.avg],
- totalCount: ['name', AGGREGATE_OPERATIONS.count],
+ sumAmount: ['amount', AggregateOperations.SUM],
+ avgAmount: ['amount', AggregateOperations.AVG],
+ totalCount: ['name', AggregateOperations.COUNT],
};
describe('useAggregateRecords', () => {
@@ -48,19 +48,19 @@ describe('useAggregateRecords', () => {
useAggregateRecords({
objectNameSingular: 'opportunity',
recordGqlFieldsAggregate: {
- amount: [AGGREGATE_OPERATIONS.sum, AGGREGATE_OPERATIONS.avg],
- name: [AGGREGATE_OPERATIONS.count],
+ amount: [AggregateOperations.SUM, AggregateOperations.AVG],
+ name: [AggregateOperations.COUNT],
},
}),
);
expect(result.current.data).toEqual({
amount: {
- [AGGREGATE_OPERATIONS.sum]: 1000000,
- [AGGREGATE_OPERATIONS.avg]: 23800,
+ [AggregateOperations.SUM]: 1000000,
+ [AggregateOperations.AVG]: 23800,
},
name: {
- [AGGREGATE_OPERATIONS.count]: 42,
+ [AggregateOperations.COUNT]: 42,
},
});
expect(result.current.loading).toBe(false);
@@ -78,7 +78,7 @@ describe('useAggregateRecords', () => {
useAggregateRecords({
objectNameSingular: 'opportunity',
recordGqlFieldsAggregate: {
- amount: [AGGREGATE_OPERATIONS.sum],
+ amount: [AggregateOperations.SUM],
},
}),
);
@@ -99,7 +99,7 @@ describe('useAggregateRecords', () => {
useAggregateRecords({
objectNameSingular: 'opportunity',
recordGqlFieldsAggregate: {
- amount: [AGGREGATE_OPERATIONS.sum],
+ amount: [AggregateOperations.SUM],
},
}),
);
@@ -113,7 +113,7 @@ describe('useAggregateRecords', () => {
useAggregateRecords({
objectNameSingular: 'opportunity',
recordGqlFieldsAggregate: {
- amount: [AGGREGATE_OPERATIONS.sum],
+ amount: [AggregateOperations.SUM],
},
skip: true,
}),
diff --git a/packages/twenty-front/src/modules/object-record/hooks/__tests__/useAggregateRecordsQuery.test.tsx b/packages/twenty-front/src/modules/object-record/hooks/__tests__/useAggregateRecordsQuery.test.tsx
index 0c930f0e020..041c8ba19cb 100644
--- a/packages/twenty-front/src/modules/object-record/hooks/__tests__/useAggregateRecordsQuery.test.tsx
+++ b/packages/twenty-front/src/modules/object-record/hooks/__tests__/useAggregateRecordsQuery.test.tsx
@@ -2,7 +2,7 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { useAggregateRecordsQuery } from '@/object-record/hooks/useAggregateRecordsQuery';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { generateAggregateQuery } from '@/object-record/utils/generateAggregateQuery';
import { renderHook } from '@testing-library/react';
import { FieldMetadataType } from '~/generated/graphql';
@@ -71,7 +71,7 @@ describe('useAggregateRecordsQuery', () => {
useAggregateRecordsQuery({
objectNameSingular: 'company',
recordGqlFieldsAggregate: {
- name: [AGGREGATE_OPERATIONS.count],
+ name: [AggregateOperations.COUNT],
},
}),
);
@@ -92,7 +92,7 @@ describe('useAggregateRecordsQuery', () => {
useAggregateRecordsQuery({
objectNameSingular: 'company',
recordGqlFieldsAggregate: {
- amount: [AGGREGATE_OPERATIONS.sum],
+ amount: [AggregateOperations.SUM],
},
}),
);
@@ -115,7 +115,7 @@ describe('useAggregateRecordsQuery', () => {
useAggregateRecordsQuery({
objectNameSingular: 'company',
recordGqlFieldsAggregate: {
- name: [AGGREGATE_OPERATIONS.sum],
+ name: [AggregateOperations.SUM],
},
}),
),
@@ -127,8 +127,8 @@ describe('useAggregateRecordsQuery', () => {
useAggregateRecordsQuery({
objectNameSingular: 'company',
recordGqlFieldsAggregate: {
- amount: [AGGREGATE_OPERATIONS.sum],
- name: [AGGREGATE_OPERATIONS.count],
+ amount: [AggregateOperations.SUM],
+ name: [AggregateOperations.COUNT],
},
}),
);
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownContent.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownContent.tsx
index cae0be2e753..dd763f8cbf2 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownContent.tsx
@@ -3,7 +3,7 @@ import { RecordBoardColumnHeaderAggregateDropdownContext } from '@/object-record
import { RecordBoardColumnHeaderAggregateDropdownFieldsContent } from '@/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownFieldsContent';
import { RecordBoardColumnHeaderAggregateDropdownMenuContent } from '@/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownMenuContent';
import { RecordBoardColumnHeaderAggregateDropdownOptionsContent } from '@/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownOptionsContent';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { COUNT_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/countAggregateOperationOptions';
import { NON_STANDARD_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/nonStandardAggregateOperationsOptions';
import { PERCENT_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/percentAggregateOperationOptions';
@@ -47,10 +47,7 @@ export const AggregateDropdownContent = () => {
const datesAvailableAggregations: AvailableFieldsForAggregateOperation =
getAvailableFieldsIdsForAggregationFromObjectFields(
objectMetadataItem.fields,
- [
- DATE_AGGREGATE_OPERATIONS.earliest,
- DATE_AGGREGATE_OPERATIONS.latest,
- ],
+ [DateAggregateOperations.EARLIEST, DateAggregateOperations.LATEST],
);
return (
<RecordBoardColumnHeaderAggregateDropdownOptionsContent
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownOptionsContent.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownOptionsContent.tsx
index b6942564954..5c1e08ced77 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownOptionsContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnHeaderAggregateDropdownOptionsContent.tsx
@@ -8,7 +8,7 @@ import { aggregateOperationComponentState } from '@/object-record/record-board/r
import { availableFieldIdsForAggregateOperationComponentState } from '@/object-record/record-board/record-board-column/states/availableFieldIdsForAggregateOperationComponentState';
import { getAggregateOperationLabel } from '@/object-record/record-board/record-board-column/utils/getAggregateOperationLabel';
import { recordIndexKanbanAggregateOperationState } from '@/object-record/record-index/states/recordIndexKanbanAggregateOperationState';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations';
import { TableOptionsHotkeyScope } from '@/object-record/record-table/types/TableOptionsHotkeyScope';
import { AvailableFieldsForAggregateOperation } from '@/object-record/types/AvailableFieldsForAggregateOperation';
@@ -82,7 +82,7 @@ export const RecordBoardColumnHeaderAggregateDropdownOptionsContent = ({
key={`aggregate-dropdown-menu-content-${availableAggregationOperation}`}
onContentChange={() => {
if (
- availableAggregationOperation !== AGGREGATE_OPERATIONS.count
+ availableAggregationOperation !== AggregateOperations.COUNT
) {
setAggregateOperation(
availableAggregationOperation as ExtendedAggregateOperations,
@@ -97,7 +97,7 @@ export const RecordBoardColumnHeaderAggregateDropdownOptionsContent = ({
kanbanAggregateOperationFieldMetadataId:
availableAggregationFieldsIdsForOperation[0],
kanbanAggregateOperation:
- availableAggregationOperation as AGGREGATE_OPERATIONS,
+ availableAggregationOperation as AggregateOperations,
});
closeDropdown();
}
@@ -106,15 +106,14 @@ export const RecordBoardColumnHeaderAggregateDropdownOptionsContent = ({
availableAggregationOperation as ExtendedAggregateOperations,
)}
hasSubMenu={
- availableAggregationOperation === AGGREGATE_OPERATIONS.count
+ availableAggregationOperation === AggregateOperations.COUNT
? false
: true
}
RightIcon={
- availableAggregationOperation ===
- AGGREGATE_OPERATIONS.count &&
+ availableAggregationOperation === AggregateOperations.COUNT &&
recordIndexKanbanAggregateOperation?.operation ===
- AGGREGATE_OPERATIONS.count
+ AggregateOperations.COUNT
? IconCheck
: undefined
}
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/buildRecordGqlFieldsAggregateForView.test.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/buildRecordGqlFieldsAggregateForView.test.ts
index 82f5328b9f6..470cdfb3947 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/buildRecordGqlFieldsAggregateForView.test.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/buildRecordGqlFieldsAggregateForView.test.ts
@@ -2,7 +2,7 @@ import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { buildRecordGqlFieldsAggregateForView } from '@/object-record/record-board/record-board-column/utils/buildRecordGqlFieldsAggregateForView';
import { KanbanAggregateOperation } from '@/object-record/record-index/states/recordIndexKanbanAggregateOperationState';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { FieldMetadataType } from '~/generated-metadata/graphql';
const MOCK_FIELD_ID = '7d2d7b5e-7b3e-4b4a-8b0a-7b3e4b4a8b0a';
@@ -47,7 +47,7 @@ describe('buildRecordGqlFieldsAggregateForView', () => {
it('should build fields for numeric aggregate', () => {
const kanbanAggregateOperation: KanbanAggregateOperation = {
fieldMetadataId: MOCK_FIELD_ID,
- operation: AGGREGATE_OPERATIONS.sum,
+ operation: AggregateOperations.SUM,
};
const result = buildRecordGqlFieldsAggregateForView({
@@ -56,14 +56,14 @@ describe('buildRecordGqlFieldsAggregateForView', () => {
});
expect(result).toEqual({
- amount: [AGGREGATE_OPERATIONS.sum],
+ amount: [AggregateOperations.SUM],
});
});
it('should default to count when no field is found', () => {
const operation: KanbanAggregateOperation = {
fieldMetadataId: 'non-existent-id',
- operation: AGGREGATE_OPERATIONS.count,
+ operation: AggregateOperations.COUNT,
};
const result = buildRecordGqlFieldsAggregateForView({
@@ -72,14 +72,14 @@ describe('buildRecordGqlFieldsAggregateForView', () => {
});
expect(result).toEqual({
- id: [AGGREGATE_OPERATIONS.count],
+ id: [AggregateOperations.COUNT],
});
});
it('should throw error for non-count operation with invalid field', () => {
const operation: KanbanAggregateOperation = {
fieldMetadataId: 'non-existent-id',
- operation: AGGREGATE_OPERATIONS.sum,
+ operation: AggregateOperations.SUM,
};
expect(() =>
@@ -88,7 +88,7 @@ describe('buildRecordGqlFieldsAggregateForView', () => {
recordIndexKanbanAggregateOperation: operation,
}),
).toThrow(
- `No field found to compute aggregate operation ${AGGREGATE_OPERATIONS.sum} on object ${mockObjectMetadata.nameSingular}`,
+ `No field found to compute aggregate operation ${AggregateOperations.SUM} on object ${mockObjectMetadata.nameSingular}`,
);
});
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/computeAggregateValueAndLabel.test.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/computeAggregateValueAndLabel.test.ts
index dd387190604..5eabc07878e 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/computeAggregateValueAndLabel.test.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/computeAggregateValueAndLabel.test.ts
@@ -4,8 +4,8 @@ import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { AggregateRecordsData } from '@/object-record/hooks/useAggregateRecords';
import { computeAggregateValueAndLabel } from '@/object-record/record-board/record-board-column/utils/computeAggregateValueAndLabel';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { enUS } from 'date-fns/locale';
import { FieldMetadataType } from '~/generated/graphql';
@@ -35,7 +35,7 @@ describe('computeAggregateValueAndLabel', () => {
data: {} as AggregateRecordsData,
objectMetadataItem: mockObjectMetadata,
fieldMetadataId: MOCK_FIELD_ID,
- aggregateOperation: AGGREGATE_OPERATIONS.sum,
+ aggregateOperation: AggregateOperations.SUM,
localeCatalog: enUS,
...defaultParams,
});
@@ -46,7 +46,7 @@ describe('computeAggregateValueAndLabel', () => {
it('should handle currency field with division by 1M', () => {
const mockData = {
amount: {
- [AGGREGATE_OPERATIONS.sum]: 2000000,
+ [AggregateOperations.SUM]: 2000000,
},
} as AggregateRecordsData;
@@ -54,7 +54,7 @@ describe('computeAggregateValueAndLabel', () => {
data: mockData,
objectMetadataItem: mockObjectMetadata,
fieldMetadataId: MOCK_FIELD_ID,
- aggregateOperation: AGGREGATE_OPERATIONS.sum,
+ aggregateOperation: AggregateOperations.SUM,
localeCatalog: enUS,
...defaultParams,
});
@@ -84,7 +84,7 @@ describe('computeAggregateValueAndLabel', () => {
const mockData = {
percentage: {
- [AGGREGATE_OPERATIONS.avg]: 0.3,
+ [AggregateOperations.AVG]: 0.3,
},
} as AggregateRecordsData;
@@ -92,7 +92,7 @@ describe('computeAggregateValueAndLabel', () => {
data: mockData,
objectMetadataItem: mockObjectMetadataWithPercentageField,
fieldMetadataId: MOCK_FIELD_ID,
- aggregateOperation: AGGREGATE_OPERATIONS.avg,
+ aggregateOperation: AggregateOperations.AVG,
localeCatalog: enUS,
...defaultParams,
});
@@ -122,7 +122,7 @@ describe('computeAggregateValueAndLabel', () => {
const mockData = {
decimals: {
- [AGGREGATE_OPERATIONS.sum]: 0.009,
+ [AggregateOperations.SUM]: 0.009,
},
} as AggregateRecordsData;
@@ -130,7 +130,7 @@ describe('computeAggregateValueAndLabel', () => {
data: mockData,
objectMetadataItem: mockObjectMetadataWithDecimalsField,
fieldMetadataId: MOCK_FIELD_ID,
- aggregateOperation: AGGREGATE_OPERATIONS.sum,
+ aggregateOperation: AggregateOperations.SUM,
localeCatalog: enUS,
...defaultParams,
});
@@ -157,7 +157,7 @@ describe('computeAggregateValueAndLabel', () => {
const mockFormattedData = {
createdAt: {
- [DATE_AGGREGATE_OPERATIONS.earliest]: '2023-01-01T12:00:00Z',
+ [DateAggregateOperations.EARLIEST]: '2023-01-01T12:00:00Z',
},
} as AggregateRecordsData;
@@ -165,7 +165,7 @@ describe('computeAggregateValueAndLabel', () => {
data: mockFormattedData,
objectMetadataItem: mockObjectMetadataWithDatetimeField,
fieldMetadataId: MOCK_FIELD_ID,
- aggregateOperation: DATE_AGGREGATE_OPERATIONS.earliest,
+ aggregateOperation: DateAggregateOperations.EARLIEST,
localeCatalog: enUS,
...defaultParams,
});
@@ -192,7 +192,7 @@ describe('computeAggregateValueAndLabel', () => {
const mockFormattedData = {
updatedAt: {
- [DATE_AGGREGATE_OPERATIONS.latest]: '2023-12-31T23:59:59Z',
+ [DateAggregateOperations.LATEST]: '2023-12-31T23:59:59Z',
},
} as AggregateRecordsData;
@@ -200,7 +200,7 @@ describe('computeAggregateValueAndLabel', () => {
data: mockFormattedData,
objectMetadataItem: mockObjectMetadataWithDatetimeField,
fieldMetadataId: MOCK_FIELD_ID,
- aggregateOperation: DATE_AGGREGATE_OPERATIONS.latest,
+ aggregateOperation: DateAggregateOperations.LATEST,
localeCatalog: enUS,
...defaultParams,
});
@@ -215,7 +215,7 @@ describe('computeAggregateValueAndLabel', () => {
it('should default to count when field not found', () => {
const mockData = {
id: {
- [AGGREGATE_OPERATIONS.count]: 42,
+ [AggregateOperations.COUNT]: 42,
},
} as AggregateRecordsData;
@@ -236,7 +236,7 @@ describe('computeAggregateValueAndLabel', () => {
it('should handle undefined aggregate value', () => {
const mockData = {
amount: {
- [AGGREGATE_OPERATIONS.sum]: undefined,
+ [AggregateOperations.SUM]: undefined,
},
} as AggregateRecordsData;
@@ -244,7 +244,7 @@ describe('computeAggregateValueAndLabel', () => {
data: mockData,
objectMetadataItem: mockObjectMetadata,
fieldMetadataId: MOCK_FIELD_ID,
- aggregateOperation: AGGREGATE_OPERATIONS.sum,
+ aggregateOperation: AggregateOperations.SUM,
localeCatalog: enUS,
...defaultParams,
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/getAggregateOperationLabel.test.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/getAggregateOperationLabel.test.ts
index a5ab5c92b00..98444529e94 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/getAggregateOperationLabel.test.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/__tests__/getAggregateOperationLabel.test.ts
@@ -1,45 +1,43 @@
import { getAggregateOperationLabel } from '@/object-record/record-board/record-board-column/utils/getAggregateOperationLabel';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { expect } from '@storybook/test';
describe('getAggregateOperationLabel', () => {
it('should return correct labels for each operation', () => {
- expect(getAggregateOperationLabel(AGGREGATE_OPERATIONS.min)).toBe('Min');
- expect(getAggregateOperationLabel(AGGREGATE_OPERATIONS.max)).toBe('Max');
- expect(getAggregateOperationLabel(AGGREGATE_OPERATIONS.avg)).toBe(
- 'Average',
- );
- expect(getAggregateOperationLabel(DATE_AGGREGATE_OPERATIONS.earliest)).toBe(
+ expect(getAggregateOperationLabel(AggregateOperations.MIN)).toBe('Min');
+ expect(getAggregateOperationLabel(AggregateOperations.MAX)).toBe('Max');
+ expect(getAggregateOperationLabel(AggregateOperations.AVG)).toBe('Average');
+ expect(getAggregateOperationLabel(DateAggregateOperations.EARLIEST)).toBe(
'Earliest date',
);
- expect(getAggregateOperationLabel(DATE_AGGREGATE_OPERATIONS.latest)).toBe(
+ expect(getAggregateOperationLabel(DateAggregateOperations.LATEST)).toBe(
'Latest date',
);
- expect(getAggregateOperationLabel(AGGREGATE_OPERATIONS.sum)).toBe('Sum');
- expect(getAggregateOperationLabel(AGGREGATE_OPERATIONS.count)).toBe(
+ expect(getAggregateOperationLabel(AggregateOperations.SUM)).toBe('Sum');
+ expect(getAggregateOperationLabel(AggregateOperations.COUNT)).toBe(
'Count all',
);
- expect(getAggregateOperationLabel(AGGREGATE_OPERATIONS.countEmpty)).toBe(
+ expect(getAggregateOperationLabel(AggregateOperations.COUNT_EMPTY)).toBe(
'Count empty',
);
- expect(getAggregateOperationLabel(AGGREGATE_OPERATIONS.countNotEmpty)).toBe(
- 'Count not empty',
- );
expect(
- getAggregateOperationLabel(AGGREGATE_OPERATIONS.countUniqueValues),
+ getAggregateOperationLabel(AggregateOperations.COUNT_NOT_EMPTY),
+ ).toBe('Count not empty');
+ expect(
+ getAggregateOperationLabel(AggregateOperations.COUNT_UNIQUE_VALUES),
).toBe('Count unique values');
expect(
- getAggregateOperationLabel(AGGREGATE_OPERATIONS.percentageEmpty),
+ getAggregateOperationLabel(AggregateOperations.PERCENTAGE_EMPTY),
).toBe('Percent empty');
expect(
- getAggregateOperationLabel(AGGREGATE_OPERATIONS.percentageNotEmpty),
+ getAggregateOperationLabel(AggregateOperations.PERCENTAGE_NOT_EMPTY),
).toBe('Percent not empty');
});
it('should throw error for unknown operation', () => {
expect(() =>
- getAggregateOperationLabel('INVALID' as AGGREGATE_OPERATIONS),
+ getAggregateOperationLabel('INVALID' as AggregateOperations),
).toThrow('Unknown aggregate operation: INVALID');
});
});
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/buildRecordGqlFieldsAggregateForView.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/buildRecordGqlFieldsAggregateForView.ts
index f4f7f64a6a8..f5e9a9b3564 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/buildRecordGqlFieldsAggregateForView.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/buildRecordGqlFieldsAggregateForView.ts
@@ -1,7 +1,7 @@
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { RecordGqlFieldsAggregate } from '@/object-record/graphql/types/RecordGqlFieldsAggregate';
import { KanbanAggregateOperation } from '@/object-record/record-index/states/recordIndexKanbanAggregateOperationState';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { FIELD_FOR_TOTAL_COUNT_AGGREGATE_OPERATION } from 'twenty-shared/constants';
import { isDefined } from 'twenty-shared/utils';
@@ -23,7 +23,7 @@ export const buildRecordGqlFieldsAggregateForView = ({
if (
isDefined(recordIndexKanbanAggregateOperation?.operation) &&
recordIndexKanbanAggregateOperation.operation !==
- AGGREGATE_OPERATIONS.count
+ AggregateOperations.COUNT
) {
throw new Error(
`No field found to compute aggregate operation ${recordIndexKanbanAggregateOperation.operation} on object ${objectMetadataItem.nameSingular}`,
@@ -31,7 +31,7 @@ export const buildRecordGqlFieldsAggregateForView = ({
} else {
recordGqlFieldsAggregate = {
[FIELD_FOR_TOTAL_COUNT_AGGREGATE_OPERATION]: [
- AGGREGATE_OPERATIONS.count,
+ AggregateOperations.COUNT,
],
};
}
@@ -39,7 +39,7 @@ export const buildRecordGqlFieldsAggregateForView = ({
recordGqlFieldsAggregate = {
[kanbanAggregateOperationFieldName]: [
recordIndexKanbanAggregateOperation?.operation ??
- AGGREGATE_OPERATIONS.count,
+ AggregateOperations.COUNT,
],
};
}
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/computeAggregateValueAndLabel.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/computeAggregateValueAndLabel.ts
index f8aeccc88f3..eea8436e377 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/computeAggregateValueAndLabel.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/computeAggregateValueAndLabel.ts
@@ -4,7 +4,7 @@ import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { AggregateRecordsData } from '@/object-record/hooks/useAggregateRecords';
import { getAggregateOperationLabel } from '@/object-record/record-board/record-board-column/utils/getAggregateOperationLabel';
import { getAggregateOperationShortLabel } from '@/object-record/record-board/record-board-column/utils/getAggregateOperationShortLabel';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { COUNT_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/countAggregateOperationOptions';
import { PERCENT_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/percentAggregateOperationOptions';
import { ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations';
@@ -48,12 +48,10 @@ export const computeAggregateValueAndLabel = ({
return {
value:
data?.[FIELD_FOR_TOTAL_COUNT_AGGREGATE_OPERATION]?.[
- AGGREGATE_OPERATIONS.count
+ AggregateOperations.COUNT
],
- label: getAggregateOperationLabel(AGGREGATE_OPERATIONS.count),
- labelWithFieldName: getAggregateOperationLabel(
- AGGREGATE_OPERATIONS.count,
- ),
+ label: getAggregateOperationLabel(AggregateOperations.COUNT),
+ labelWithFieldName: getAggregateOperationLabel(AggregateOperations.COUNT),
};
}
@@ -69,7 +67,7 @@ export const computeAggregateValueAndLabel = ({
if (
COUNT_AGGREGATE_OPERATION_OPTIONS.includes(
- aggregateOperation as AGGREGATE_OPERATIONS,
+ aggregateOperation as AggregateOperations,
)
) {
value = aggregateValue;
@@ -77,7 +75,7 @@ export const computeAggregateValueAndLabel = ({
value = '-';
} else if (
PERCENT_AGGREGATE_OPERATION_OPTIONS.includes(
- aggregateOperation as AGGREGATE_OPERATIONS,
+ aggregateOperation as AggregateOperations,
)
) {
value = `${formatNumber(Number(aggregateValue) * 100)}%`;
@@ -128,8 +126,8 @@ export const computeAggregateValueAndLabel = ({
const aggregateLabel = t(getAggregateOperationShortLabel(aggregateOperation));
const fieldLabel = field.label;
const labelWithFieldName =
- aggregateOperation === AGGREGATE_OPERATIONS.count
- ? `${getAggregateOperationLabel(AGGREGATE_OPERATIONS.count)}`
+ aggregateOperation === AggregateOperations.COUNT
+ ? `${getAggregateOperationLabel(AggregateOperations.COUNT)}`
: t`${aggregateLabel} of ${fieldLabel}`;
return {
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/getAggregateOperationLabel.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/getAggregateOperationLabel.ts
index d3b5106b011..d0916aa600d 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/getAggregateOperationLabel.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/getAggregateOperationLabel.ts
@@ -1,5 +1,5 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations';
import { t } from '@lingui/core/macro';
@@ -7,33 +7,33 @@ export const getAggregateOperationLabel = (
operation: ExtendedAggregateOperations,
) => {
switch (operation) {
- case AGGREGATE_OPERATIONS.min:
+ case AggregateOperations.MIN:
return t`Min`;
- case AGGREGATE_OPERATIONS.max:
+ case AggregateOperations.MAX:
return t`Max`;
- case AGGREGATE_OPERATIONS.avg:
+ case AggregateOperations.AVG:
return t`Average`;
- case AGGREGATE_OPERATIONS.sum:
+ case AggregateOperations.SUM:
return t`Sum`;
- case AGGREGATE_OPERATIONS.count:
+ case AggregateOperations.COUNT:
return t`Count all`;
- case AGGREGATE_OPERATIONS.countEmpty:
+ case AggregateOperations.COUNT_EMPTY:
return t`Count empty`;
- case AGGREGATE_OPERATIONS.countNotEmpty:
+ case AggregateOperations.COUNT_NOT_EMPTY:
return t`Count not empty`;
- case AGGREGATE_OPERATIONS.countUniqueValues:
+ case AggregateOperations.COUNT_UNIQUE_VALUES:
return t`Count unique values`;
- case AGGREGATE_OPERATIONS.percentageEmpty:
+ case AggregateOperations.PERCENTAGE_EMPTY:
return t`Percent empty`;
- case AGGREGATE_OPERATIONS.percentageNotEmpty:
+ case AggregateOperations.PERCENTAGE_NOT_EMPTY:
return t`Percent not empty`;
- case DATE_AGGREGATE_OPERATIONS.earliest:
+ case DateAggregateOperations.EARLIEST:
return t`Earliest date`;
- case DATE_AGGREGATE_OPERATIONS.latest:
+ case DateAggregateOperations.LATEST:
return t`Latest date`;
- case AGGREGATE_OPERATIONS.countTrue:
+ case AggregateOperations.COUNT_TRUE:
return t`Count true`;
- case AGGREGATE_OPERATIONS.countFalse:
+ case AggregateOperations.COUNT_FALSE:
return t`Count false`;
default:
throw new Error(`Unknown aggregate operation: ${operation}`);
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/getAggregateOperationShortLabel.ts b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/getAggregateOperationShortLabel.ts
index a53476326d8..832bfb6d8e9 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/getAggregateOperationShortLabel.ts
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/utils/getAggregateOperationShortLabel.ts
@@ -1,5 +1,5 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations';
import { msg } from '@lingui/core/macro';
@@ -7,31 +7,31 @@ export const getAggregateOperationShortLabel = (
operation: ExtendedAggregateOperations,
) => {
switch (operation) {
- case AGGREGATE_OPERATIONS.min:
+ case AggregateOperations.MIN:
return msg`Min`;
- case AGGREGATE_OPERATIONS.max:
+ case AggregateOperations.MAX:
return msg`Max`;
- case AGGREGATE_OPERATIONS.avg:
+ case AggregateOperations.AVG:
return msg`Average`;
- case AGGREGATE_OPERATIONS.sum:
+ case AggregateOperations.SUM:
return msg`Sum`;
- case AGGREGATE_OPERATIONS.count:
+ case AggregateOperations.COUNT:
return msg`All`;
- case AGGREGATE_OPERATIONS.countEmpty:
- case AGGREGATE_OPERATIONS.percentageEmpty:
+ case AggregateOperations.COUNT_EMPTY:
+ case AggregateOperations.PERCENTAGE_EMPTY:
return msg`Empty`;
- case AGGREGATE_OPERATIONS.countNotEmpty:
- case AGGREGATE_OPERATIONS.percentageNotEmpty:
+ case AggregateOperations.COUNT_NOT_EMPTY:
+ case AggregateOperations.PERCENTAGE_NOT_EMPTY:
return msg`Not empty`;
- case AGGREGATE_OPERATIONS.countUniqueValues:
+ case AggregateOperations.COUNT_UNIQUE_VALUES:
return msg`Unique`;
- case DATE_AGGREGATE_OPERATIONS.earliest:
+ case DateAggregateOperations.EARLIEST:
return msg`Earliest`;
- case DATE_AGGREGATE_OPERATIONS.latest:
+ case DateAggregateOperations.LATEST:
return msg`Latest`;
- case AGGREGATE_OPERATIONS.countTrue:
+ case AggregateOperations.COUNT_TRUE:
return msg`True`;
- case AGGREGATE_OPERATIONS.countFalse:
+ case AggregateOperations.COUNT_FALSE:
return msg`False`;
default:
throw new Error(`Unknown aggregate operation: ${operation}`);
diff --git a/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerTabs.ts b/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerTabs.ts
index 02f8110b0cf..4a696a01b48 100644
--- a/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerTabs.ts
+++ b/packages/twenty-front/src/modules/object-record/record-show/hooks/useRecordShowContainerTabs.ts
@@ -10,8 +10,6 @@ import { RecordLayoutTab } from '@/ui/layout/tab/types/RecordLayoutTab';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { useMemo } from 'react';
import { useRecoilValue } from 'recoil';
-import { FieldMetadataType } from '~/generated-metadata/graphql';
-import { FeatureFlagKey } from '~/generated/graphql';
import {
IconCalendarEvent,
IconHome,
@@ -19,6 +17,8 @@ import {
IconNotes,
IconSettings,
} from 'twenty-ui/display';
+import { FieldMetadataType } from '~/generated-metadata/graphql';
+import { FeatureFlagKey } from '~/generated/graphql';
export const useRecordShowContainerTabs = (
loading: boolean,
@@ -152,7 +152,7 @@ export const useRecordShowContainerTabs = (
ifMobile: false,
ifDesktop: false,
ifInRightDrawer: false,
- ifFeaturesDisabled: [FeatureFlagKey.IsWorkflowEnabled],
+ ifFeaturesDisabled: [FeatureFlagKey.IS_WORKFLOW_ENABLED],
ifRequiredObjectsInactive: [],
ifRelationsMissing: [],
},
@@ -175,7 +175,7 @@ export const useRecordShowContainerTabs = (
ifMobile: false,
ifDesktop: false,
ifInRightDrawer: false,
- ifFeaturesDisabled: [FeatureFlagKey.IsWorkflowEnabled],
+ ifFeaturesDisabled: [FeatureFlagKey.IS_WORKFLOW_ENABLED],
ifRequiredObjectsInactive: [],
ifRelationsMissing: [],
},
@@ -197,7 +197,7 @@ export const useRecordShowContainerTabs = (
ifMobile: false,
ifDesktop: false,
ifInRightDrawer: false,
- ifFeaturesDisabled: [FeatureFlagKey.IsWorkflowEnabled],
+ ifFeaturesDisabled: [FeatureFlagKey.IS_WORKFLOW_ENABLED],
ifRequiredObjectsInactive: [],
ifRelationsMissing: [],
},
diff --git a/packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx b/packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx
index 8b01952a361..3870061305f 100644
--- a/packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx
@@ -13,7 +13,7 @@ import { RecordDetailRelationSectionDropdown } from '@/object-record/record-show
import { RecordDetailSection } from '@/object-record/record-show/record-detail-section/components/RecordDetailSection';
import { RecordDetailSectionHeader } from '@/object-record/record-show/record-detail-section/components/RecordDetailSectionHeader';
import { recordStoreFamilySelector } from '@/object-record/record-store/states/selectors/recordStoreFamilySelector';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
import { prefetchIndexViewIdFromObjectMetadataItemFamilySelector } from '@/prefetch/states/selector/prefetchIndexViewIdFromObjectMetadataItemFamilySelector';
import { AppPath } from '@/types/AppPath';
@@ -109,7 +109,7 @@ export const RecordDetailRelationSection = ({
filter: filtersForAggregate,
skip: !isToManyObjects,
recordGqlFieldsAggregate: {
- id: [AGGREGATE_OPERATIONS.count],
+ id: [AggregateOperations.COUNT],
},
});
diff --git a/packages/twenty-front/src/modules/object-record/record-table/constants/AggregateOperations.ts b/packages/twenty-front/src/modules/object-record/record-table/constants/AggregateOperations.ts
index e0f6ce08f25..c61582fd695 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/constants/AggregateOperations.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/constants/AggregateOperations.ts
@@ -1,14 +1,14 @@
-export enum AGGREGATE_OPERATIONS {
- min = 'MIN',
- max = 'MAX',
- avg = 'AVG',
- sum = 'SUM',
- count = 'COUNT',
- countEmpty = 'COUNT_EMPTY',
- countNotEmpty = 'COUNT_NOT_EMPTY',
- countUniqueValues = 'COUNT_UNIQUE_VALUES',
- percentageEmpty = 'PERCENTAGE_EMPTY',
- percentageNotEmpty = 'PERCENTAGE_NOT_EMPTY',
- countTrue = 'COUNT_TRUE',
- countFalse = 'COUNT_FALSE',
+export enum AggregateOperations {
+ MIN = 'MIN',
+ MAX = 'MAX',
+ AVG = 'AVG',
+ SUM = 'SUM',
+ COUNT = 'COUNT',
+ COUNT_EMPTY = 'COUNT_EMPTY',
+ COUNT_NOT_EMPTY = 'COUNT_NOT_EMPTY',
+ COUNT_UNIQUE_VALUES = 'COUNT_UNIQUE_VALUES',
+ PERCENTAGE_EMPTY = 'PERCENTAGE_EMPTY',
+ PERCENTAGE_NOT_EMPTY = 'PERCENTAGE_NOT_EMPTY',
+ COUNT_TRUE = 'COUNT_TRUE',
+ COUNT_FALSE = 'COUNT_FALSE',
}
diff --git a/packages/twenty-front/src/modules/object-record/record-table/constants/DateAggregateOperations.ts b/packages/twenty-front/src/modules/object-record/record-table/constants/DateAggregateOperations.ts
index 55d92a059c7..a5d63354112 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/constants/DateAggregateOperations.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/constants/DateAggregateOperations.ts
@@ -1,4 +1,4 @@
-export enum DATE_AGGREGATE_OPERATIONS {
- earliest = 'EARLIEST',
- latest = 'LATEST',
+export enum DateAggregateOperations {
+ EARLIEST = 'EARLIEST',
+ LATEST = 'LATEST',
}
diff --git a/packages/twenty-front/src/modules/object-record/record-table/constants/FieldTypesAvailableForNonStandardAggregateOperation.ts b/packages/twenty-front/src/modules/object-record/record-table/constants/FieldTypesAvailableForNonStandardAggregateOperation.ts
index 4adf44dd63d..99b60eb8b1d 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/constants/FieldTypesAvailableForNonStandardAggregateOperation.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/constants/FieldTypesAvailableForNonStandardAggregateOperation.ts
@@ -1,31 +1,31 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { FieldMetadataType } from '~/generated-metadata/graphql';
export const FIELD_TYPES_AVAILABLE_FOR_NON_STANDARD_AGGREGATE_OPERATION = {
- [AGGREGATE_OPERATIONS.min]: [
+ [AggregateOperations.MIN]: [
FieldMetadataType.NUMBER,
FieldMetadataType.CURRENCY,
],
- [AGGREGATE_OPERATIONS.max]: [
+ [AggregateOperations.MAX]: [
FieldMetadataType.NUMBER,
FieldMetadataType.CURRENCY,
],
- [AGGREGATE_OPERATIONS.avg]: [
+ [AggregateOperations.AVG]: [
FieldMetadataType.NUMBER,
FieldMetadataType.CURRENCY,
],
- [AGGREGATE_OPERATIONS.sum]: [
+ [AggregateOperations.SUM]: [
FieldMetadataType.NUMBER,
FieldMetadataType.CURRENCY,
],
- [AGGREGATE_OPERATIONS.countFalse]: [FieldMetadataType.BOOLEAN],
- [AGGREGATE_OPERATIONS.countTrue]: [FieldMetadataType.BOOLEAN],
- [DATE_AGGREGATE_OPERATIONS.earliest]: [
+ [AggregateOperations.COUNT_FALSE]: [FieldMetadataType.BOOLEAN],
+ [AggregateOperations.COUNT_TRUE]: [FieldMetadataType.BOOLEAN],
+ [DateAggregateOperations.EARLIEST]: [
FieldMetadataType.DATE_TIME,
FieldMetadataType.DATE,
],
- [DATE_AGGREGATE_OPERATIONS.latest]: [
+ [DateAggregateOperations.LATEST]: [
FieldMetadataType.DATE_TIME,
FieldMetadataType.DATE,
],
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterDropdownContent.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterDropdownContent.tsx
index bc7cfb1ad02..f493465dd74 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterDropdownContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterDropdownContent.tsx
@@ -1,6 +1,6 @@
import { useDropdown } from '@/dropdown/hooks/useDropdown';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { RecordTableColumnAggregateFooterDropdownSubmenuContent } from '@/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateDropdownSubmenuContent';
import { RecordTableColumnAggregateFooterDropdownContext } from '@/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterDropdownContext';
import { RecordTableColumnAggregateFooterMenuContent } from '@/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterMenuContent';
@@ -28,7 +28,7 @@ export const RecordTableColumnAggregateFooterDropdownContent = () => {
const aggregateOperations = availableAggregateOperations.filter(
(aggregateOperation) =>
!STANDARD_AGGREGATE_OPERATION_OPTIONS.includes(
- aggregateOperation as AGGREGATE_OPERATIONS,
+ aggregateOperation as AggregateOperations,
),
);
@@ -43,7 +43,7 @@ export const RecordTableColumnAggregateFooterDropdownContent = () => {
const aggregateOperations = availableAggregateOperations.filter(
(aggregateOperation) =>
COUNT_AGGREGATE_OPERATION_OPTIONS.includes(
- aggregateOperation as AGGREGATE_OPERATIONS,
+ aggregateOperation as AggregateOperations,
),
);
return (
@@ -57,7 +57,7 @@ export const RecordTableColumnAggregateFooterDropdownContent = () => {
const aggregateOperations = availableAggregateOperations.filter(
(aggregateOperation) =>
PERCENT_AGGREGATE_OPERATION_OPTIONS.includes(
- aggregateOperation as AGGREGATE_OPERATIONS,
+ aggregateOperation as AggregateOperations,
),
);
return (
@@ -71,7 +71,7 @@ export const RecordTableColumnAggregateFooterDropdownContent = () => {
const aggregateOperations = availableAggregateOperations.filter(
(aggregateOperation) =>
DATE_AGGREGATE_OPERATION_OPTIONS.includes(
- aggregateOperation as DATE_AGGREGATE_OPERATIONS,
+ aggregateOperation as DateAggregateOperations,
),
);
return (
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterMenuContent.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterMenuContent.tsx
index 4349484d551..0490abfa81e 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterMenuContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterMenuContent.tsx
@@ -1,4 +1,4 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext';
import { RecordTableColumnAggregateFooterDropdownContext } from '@/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterDropdownContext';
import { NON_STANDARD_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/nonStandardAggregateOperationsOptions';
@@ -51,7 +51,7 @@ export const RecordTableColumnAggregateFooterMenuContent = () => {
const nonStandardAvailableAggregateOperation =
availableAggregateOperation.filter((aggregateOperation) =>
NON_STANDARD_AGGREGATE_OPERATION_OPTIONS.includes(
- aggregateOperation as AGGREGATE_OPERATIONS,
+ aggregateOperation as AggregateOperations,
),
);
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/countAggregateOperationOptions.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/countAggregateOperationOptions.tsx
index 0b474c880d6..c209f7aef2b 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/countAggregateOperationOptions.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/countAggregateOperationOptions.tsx
@@ -1,10 +1,10 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
export const COUNT_AGGREGATE_OPERATION_OPTIONS = [
- AGGREGATE_OPERATIONS.count,
- AGGREGATE_OPERATIONS.countEmpty,
- AGGREGATE_OPERATIONS.countNotEmpty,
- AGGREGATE_OPERATIONS.countUniqueValues,
- AGGREGATE_OPERATIONS.countTrue,
- AGGREGATE_OPERATIONS.countFalse,
+ AggregateOperations.COUNT,
+ AggregateOperations.COUNT_EMPTY,
+ AggregateOperations.COUNT_NOT_EMPTY,
+ AggregateOperations.COUNT_UNIQUE_VALUES,
+ AggregateOperations.COUNT_TRUE,
+ AggregateOperations.COUNT_FALSE,
];
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/dateAggregateOperationOptions.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/dateAggregateOperationOptions.tsx
index 25de7a83507..8e2cf3bc654 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/dateAggregateOperationOptions.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/dateAggregateOperationOptions.tsx
@@ -1,6 +1,6 @@
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
export const DATE_AGGREGATE_OPERATION_OPTIONS = [
- DATE_AGGREGATE_OPERATIONS.earliest,
- DATE_AGGREGATE_OPERATIONS.latest,
+ DateAggregateOperations.EARLIEST,
+ DateAggregateOperations.LATEST,
];
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/nonStandardAggregateOperationsOptions.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/nonStandardAggregateOperationsOptions.tsx
index 4d843e18750..4da7bbf3597 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/nonStandardAggregateOperationsOptions.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/nonStandardAggregateOperationsOptions.tsx
@@ -1,8 +1,8 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
export const NON_STANDARD_AGGREGATE_OPERATION_OPTIONS = [
- AGGREGATE_OPERATIONS.min,
- AGGREGATE_OPERATIONS.max,
- AGGREGATE_OPERATIONS.avg,
- AGGREGATE_OPERATIONS.sum,
+ AggregateOperations.MIN,
+ AggregateOperations.MAX,
+ AggregateOperations.AVG,
+ AggregateOperations.SUM,
];
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/percentAggregateOperationOptions.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/percentAggregateOperationOptions.tsx
index 44066de8223..140100ba5d0 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/percentAggregateOperationOptions.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/constants/percentAggregateOperationOptions.tsx
@@ -1,6 +1,6 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
export const PERCENT_AGGREGATE_OPERATION_OPTIONS = [
- AGGREGATE_OPERATIONS.percentageEmpty,
- AGGREGATE_OPERATIONS.percentageNotEmpty,
+ AggregateOperations.PERCENTAGE_EMPTY,
+ AggregateOperations.PERCENTAGE_NOT_EMPTY,
];
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useAggregateRecordsForRecordTableColumnFooter.tsx b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useAggregateRecordsForRecordTableColumnFooter.tsx
index 91ae3e34a46..1e81ec74d11 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useAggregateRecordsForRecordTableColumnFooter.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/hooks/useAggregateRecordsForRecordTableColumnFooter.tsx
@@ -5,7 +5,7 @@ import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/
import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState';
import { computeRecordGqlOperationFilter } from '@/object-record/record-filter/utils/computeRecordGqlOperationFilter';
import { useRecordGroupFilter } from '@/object-record/record-group/hooks/useRecordGroupFilter';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { useRecordTableContextOrThrow } from '@/object-record/record-table/contexts/RecordTableContext';
import { RecordTableColumnAggregateFooterCellContext } from '@/object-record/record-table/record-table-footer/components/RecordTableColumnAggregateFooterCellContext';
import { viewFieldAggregateOperationState } from '@/object-record/record-table/record-table-footer/states/viewFieldAggregateOperationState';
@@ -62,9 +62,9 @@ export const useAggregateRecordsForRecordTableColumnFooter = (
isFieldMetadataDateKind(fieldMetadataItem.type) &&
isDefined(aggregateOperationForViewFieldWithProbableImpossibleValues) &&
(aggregateOperationForViewFieldWithProbableImpossibleValues ===
- AGGREGATE_OPERATIONS.min ||
+ AggregateOperations.MIN ||
aggregateOperationForViewFieldWithProbableImpossibleValues ===
- AGGREGATE_OPERATIONS.max);
+ AggregateOperations.MAX);
const aggregateOperationForViewField:
| ExtendedAggregateOperations
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/utils/buildRecordGqlFieldsAggregateForRecordTable.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/utils/buildRecordGqlFieldsAggregateForRecordTable.ts
index e9abb0077d1..0346c08c117 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/utils/buildRecordGqlFieldsAggregateForRecordTable.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/utils/buildRecordGqlFieldsAggregateForRecordTable.ts
@@ -1,14 +1,14 @@
import { RecordGqlFieldsAggregate } from '@/object-record/graphql/types/RecordGqlFieldsAggregate';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
export const buildRecordGqlFieldsAggregateForRecordTable = ({
aggregateOperation,
fieldName,
}: {
fieldName: string;
- aggregateOperation?: AGGREGATE_OPERATIONS | null;
+ aggregateOperation?: AggregateOperations | null;
}): RecordGqlFieldsAggregate => {
return {
- [fieldName]: [aggregateOperation ?? AGGREGATE_OPERATIONS.count],
+ [fieldName]: [aggregateOperation ?? AggregateOperations.COUNT],
};
};
diff --git a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/utils/getAvailableAggregateOperationsForFieldMetadataType.ts b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/utils/getAvailableAggregateOperationsForFieldMetadataType.ts
index 27efe9efa1b..d56600ae486 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/utils/getAvailableAggregateOperationsForFieldMetadataType.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/record-table-footer/utils/getAvailableAggregateOperationsForFieldMetadataType.ts
@@ -1,10 +1,10 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { FIELD_TYPES_AVAILABLE_FOR_NON_STANDARD_AGGREGATE_OPERATION } from '@/object-record/record-table/constants/FieldTypesAvailableForNonStandardAggregateOperation';
import { ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations';
import { AggregateOperationsOmittingStandardOperations } from '@/object-record/types/AggregateOperationsOmittingStandardOperations';
import { isFieldTypeValidForAggregateOperation } from '@/object-record/utils/isFieldTypeValidForAggregateOperation';
-import { FieldMetadataType } from '~/generated/graphql';
import { isDefined } from 'twenty-shared/utils';
+import { FieldMetadataType } from '~/generated/graphql';
export const getAvailableAggregateOperationsForFieldMetadataType = ({
fieldMetadataType,
@@ -12,16 +12,16 @@ export const getAvailableAggregateOperationsForFieldMetadataType = ({
fieldMetadataType?: FieldMetadataType;
}) => {
if (fieldMetadataType === FieldMetadataType.RELATION) {
- return [AGGREGATE_OPERATIONS.count];
+ return [AggregateOperations.COUNT];
}
const availableAggregateOperations = new Set<ExtendedAggregateOperations>([
- AGGREGATE_OPERATIONS.count,
- AGGREGATE_OPERATIONS.countEmpty,
- AGGREGATE_OPERATIONS.countNotEmpty,
- AGGREGATE_OPERATIONS.countUniqueValues,
- AGGREGATE_OPERATIONS.percentageEmpty,
- AGGREGATE_OPERATIONS.percentageNotEmpty,
+ AggregateOperations.COUNT,
+ AggregateOperations.COUNT_EMPTY,
+ AggregateOperations.COUNT_NOT_EMPTY,
+ AggregateOperations.COUNT_UNIQUE_VALUES,
+ AggregateOperations.PERCENTAGE_EMPTY,
+ AggregateOperations.PERCENTAGE_NOT_EMPTY,
]);
if (!isDefined(fieldMetadataType)) {
diff --git a/packages/twenty-front/src/modules/object-record/record-table/types/ExtendedAggregateOperations.ts b/packages/twenty-front/src/modules/object-record/record-table/types/ExtendedAggregateOperations.ts
index 6f0373182c8..e57aebc8e38 100644
--- a/packages/twenty-front/src/modules/object-record/record-table/types/ExtendedAggregateOperations.ts
+++ b/packages/twenty-front/src/modules/object-record/record-table/types/ExtendedAggregateOperations.ts
@@ -1,6 +1,6 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
export type ExtendedAggregateOperations =
- | AGGREGATE_OPERATIONS
- | DATE_AGGREGATE_OPERATIONS;
+ | AggregateOperations
+ | DateAggregateOperations;
diff --git a/packages/twenty-front/src/modules/object-record/types/AggregateOperationsOmittingStandardOperations.ts b/packages/twenty-front/src/modules/object-record/types/AggregateOperationsOmittingStandardOperations.ts
index 3ce73bef4f6..291e82267b8 100644
--- a/packages/twenty-front/src/modules/object-record/types/AggregateOperationsOmittingStandardOperations.ts
+++ b/packages/twenty-front/src/modules/object-record/types/AggregateOperationsOmittingStandardOperations.ts
@@ -1,11 +1,11 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
export type AggregateOperationsOmittingStandardOperations = Exclude<
- AGGREGATE_OPERATIONS,
- | AGGREGATE_OPERATIONS.count
- | AGGREGATE_OPERATIONS.countEmpty
- | AGGREGATE_OPERATIONS.countNotEmpty
- | AGGREGATE_OPERATIONS.countUniqueValues
- | AGGREGATE_OPERATIONS.percentageEmpty
- | AGGREGATE_OPERATIONS.percentageNotEmpty
+ AggregateOperations,
+ | AggregateOperations.COUNT
+ | AggregateOperations.COUNT_EMPTY
+ | AggregateOperations.COUNT_NOT_EMPTY
+ | AggregateOperations.COUNT_UNIQUE_VALUES
+ | AggregateOperations.PERCENTAGE_EMPTY
+ | AggregateOperations.PERCENTAGE_NOT_EMPTY
>;
diff --git a/packages/twenty-front/src/modules/object-record/utils/__tests__/getAvailableFieldsIdsForAggregationFromObjectFields.test.ts b/packages/twenty-front/src/modules/object-record/utils/__tests__/getAvailableFieldsIdsForAggregationFromObjectFields.test.ts
index 227e41d6983..18b87d6e951 100644
--- a/packages/twenty-front/src/modules/object-record/utils/__tests__/getAvailableFieldsIdsForAggregationFromObjectFields.test.ts
+++ b/packages/twenty-front/src/modules/object-record/utils/__tests__/getAvailableFieldsIdsForAggregationFromObjectFields.test.ts
@@ -1,5 +1,5 @@
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { COUNT_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/countAggregateOperationOptions';
import { NON_STANDARD_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/nonStandardAggregateOperationsOptions';
import { PERCENT_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/percentAggregateOperationOptions';
@@ -23,43 +23,43 @@ jest.mock(
() => ({
getAvailableAggregationsFromObjectFields: jest.fn().mockReturnValue({
active: {
- [AGGREGATE_OPERATIONS.countTrue]: 'countTrueActive',
- [AGGREGATE_OPERATIONS.countFalse]: 'CountFalseActive',
+ [AggregateOperations.COUNT_TRUE]: 'countTrueActive',
+ [AggregateOperations.COUNT_FALSE]: 'CountFalseActive',
},
amount: {
- [AGGREGATE_OPERATIONS.sum]: 'sumAmount',
- [AGGREGATE_OPERATIONS.avg]: 'avgAmount',
- [AGGREGATE_OPERATIONS.min]: 'minAmount',
- [AGGREGATE_OPERATIONS.max]: 'maxAmount',
- [AGGREGATE_OPERATIONS.count]: 'totalCount',
- [AGGREGATE_OPERATIONS.countUniqueValues]: 'countUniqueValuesAmount',
- [AGGREGATE_OPERATIONS.countEmpty]: 'countEmptyAmount',
- [AGGREGATE_OPERATIONS.countNotEmpty]: 'countNotEmptyAmount',
- [AGGREGATE_OPERATIONS.percentageEmpty]: 'percentageEmptyAmount',
- [AGGREGATE_OPERATIONS.percentageNotEmpty]: 'percentageNotEmptyAmount',
+ [AggregateOperations.SUM]: 'sumAmount',
+ [AggregateOperations.AVG]: 'avgAmount',
+ [AggregateOperations.MIN]: 'minAmount',
+ [AggregateOperations.MAX]: 'maxAmount',
+ [AggregateOperations.COUNT]: 'totalCount',
+ [AggregateOperations.COUNT_UNIQUE_VALUES]: 'countUniqueValuesAmount',
+ [AggregateOperations.COUNT_EMPTY]: 'countEmptyAmount',
+ [AggregateOperations.COUNT_NOT_EMPTY]: 'countNotEmptyAmount',
+ [AggregateOperations.PERCENTAGE_EMPTY]: 'percentageEmptyAmount',
+ [AggregateOperations.PERCENTAGE_NOT_EMPTY]: 'percentageNotEmptyAmount',
},
price: {
- [AGGREGATE_OPERATIONS.sum]: 'sumPriceAmountMicros',
- [AGGREGATE_OPERATIONS.avg]: 'avgPriceAmountMicros',
- [AGGREGATE_OPERATIONS.min]: 'minPriceAmountMicros',
- [AGGREGATE_OPERATIONS.max]: 'maxPriceAmountMicros',
- [AGGREGATE_OPERATIONS.count]: 'totalCount',
- [AGGREGATE_OPERATIONS.countUniqueValues]:
+ [AggregateOperations.SUM]: 'sumPriceAmountMicros',
+ [AggregateOperations.AVG]: 'avgPriceAmountMicros',
+ [AggregateOperations.MIN]: 'minPriceAmountMicros',
+ [AggregateOperations.MAX]: 'maxPriceAmountMicros',
+ [AggregateOperations.COUNT]: 'totalCount',
+ [AggregateOperations.COUNT_UNIQUE_VALUES]:
'countUniqueValuesPriceAmountMicros',
- [AGGREGATE_OPERATIONS.countEmpty]: 'countEmptyPriceAmountMicros',
- [AGGREGATE_OPERATIONS.countNotEmpty]: 'countNotEmptyPriceAmountMicros',
- [AGGREGATE_OPERATIONS.percentageEmpty]:
+ [AggregateOperations.COUNT_EMPTY]: 'countEmptyPriceAmountMicros',
+ [AggregateOperations.COUNT_NOT_EMPTY]: 'countNotEmptyPriceAmountMicros',
+ [AggregateOperations.PERCENTAGE_EMPTY]:
'percentageEmptyPriceAmountMicros',
- [AGGREGATE_OPERATIONS.percentageNotEmpty]:
+ [AggregateOperations.PERCENTAGE_NOT_EMPTY]:
'percentageNotEmptyPriceAmountMicros',
},
name: {
- [AGGREGATE_OPERATIONS.count]: 'totalCount',
- [AGGREGATE_OPERATIONS.countUniqueValues]: 'countUniqueValuesName',
- [AGGREGATE_OPERATIONS.countEmpty]: 'countEmptyName',
- [AGGREGATE_OPERATIONS.countNotEmpty]: 'countNotEmptyName',
- [AGGREGATE_OPERATIONS.percentageEmpty]: 'percentageEmptyName',
- [AGGREGATE_OPERATIONS.percentageNotEmpty]: 'percentageNotEmptyName',
+ [AggregateOperations.COUNT]: 'totalCount',
+ [AggregateOperations.COUNT_UNIQUE_VALUES]: 'countUniqueValuesName',
+ [AggregateOperations.COUNT_EMPTY]: 'countEmptyName',
+ [AggregateOperations.COUNT_NOT_EMPTY]: 'countNotEmptyName',
+ [AggregateOperations.PERCENTAGE_EMPTY]: 'percentageEmptyName',
+ [AggregateOperations.PERCENTAGE_NOT_EMPTY]: 'percentageNotEmptyName',
},
}),
}),
diff --git a/packages/twenty-front/src/modules/object-record/utils/__tests__/initializeAvailableFieldsForAggregateOperationMap.test.ts b/packages/twenty-front/src/modules/object-record/utils/__tests__/initializeAvailableFieldsForAggregateOperationMap.test.ts
index 1f1bd9446a0..6fc10d74edd 100644
--- a/packages/twenty-front/src/modules/object-record/utils/__tests__/initializeAvailableFieldsForAggregateOperationMap.test.ts
+++ b/packages/twenty-front/src/modules/object-record/utils/__tests__/initializeAvailableFieldsForAggregateOperationMap.test.ts
@@ -1,4 +1,4 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { FIELD_TYPES_AVAILABLE_FOR_NON_STANDARD_AGGREGATE_OPERATION } from '@/object-record/record-table/constants/FieldTypesAvailableForNonStandardAggregateOperation';
import { COUNT_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/countAggregateOperationOptions';
import { PERCENT_AGGREGATE_OPERATION_OPTIONS } from '@/object-record/record-table/record-table-footer/constants/percentAggregateOperationOptions';
@@ -10,7 +10,7 @@ describe('initializeAvailableFieldsForAggregateOperationMap', () => {
const result = initializeAvailableFieldsForAggregateOperationMap(
Object.keys(
FIELD_TYPES_AVAILABLE_FOR_NON_STANDARD_AGGREGATE_OPERATION,
- ) as AGGREGATE_OPERATIONS[],
+ ) as AggregateOperations[],
);
expect(Object.keys(result)).toEqual(
@@ -25,11 +25,11 @@ describe('initializeAvailableFieldsForAggregateOperationMap', () => {
const result = initializeAvailableFieldsForAggregateOperationMap(
Object.keys(
FIELD_TYPES_AVAILABLE_FOR_NON_STANDARD_AGGREGATE_OPERATION,
- ) as AGGREGATE_OPERATIONS[],
+ ) as AggregateOperations[],
);
expect(
result[
- AGGREGATE_OPERATIONS.count as AggregateOperationsOmittingStandardOperations
+ AggregateOperations.COUNT as AggregateOperationsOmittingStandardOperations
],
).toBeUndefined();
});
@@ -38,21 +38,21 @@ describe('initializeAvailableFieldsForAggregateOperationMap', () => {
const result = initializeAvailableFieldsForAggregateOperationMap(
COUNT_AGGREGATE_OPERATION_OPTIONS,
);
- expect(result[AGGREGATE_OPERATIONS.count]).toEqual([]);
- expect(result[AGGREGATE_OPERATIONS.countEmpty]).toEqual([]);
- expect(result[AGGREGATE_OPERATIONS.countNotEmpty]).toEqual([]);
- expect(result[AGGREGATE_OPERATIONS.countUniqueValues]).toEqual([]);
- expect(result[AGGREGATE_OPERATIONS.min]).toBeUndefined();
- expect(result[AGGREGATE_OPERATIONS.percentageEmpty]).toBeUndefined();
+ expect(result[AggregateOperations.COUNT]).toEqual([]);
+ expect(result[AggregateOperations.COUNT_EMPTY]).toEqual([]);
+ expect(result[AggregateOperations.COUNT_NOT_EMPTY]).toEqual([]);
+ expect(result[AggregateOperations.COUNT_UNIQUE_VALUES]).toEqual([]);
+ expect(result[AggregateOperations.MIN]).toBeUndefined();
+ expect(result[AggregateOperations.PERCENTAGE_EMPTY]).toBeUndefined();
});
it('should include percent operation when called with count aggregate operations', () => {
const result = initializeAvailableFieldsForAggregateOperationMap(
PERCENT_AGGREGATE_OPERATION_OPTIONS,
);
- expect(result[AGGREGATE_OPERATIONS.percentageEmpty]).toEqual([]);
- expect(result[AGGREGATE_OPERATIONS.percentageNotEmpty]).toEqual([]);
- expect(result[AGGREGATE_OPERATIONS.count]).toBeUndefined();
- expect(result[AGGREGATE_OPERATIONS.min]).toBeUndefined();
+ expect(result[AggregateOperations.PERCENTAGE_EMPTY]).toEqual([]);
+ expect(result[AggregateOperations.PERCENTAGE_NOT_EMPTY]).toEqual([]);
+ expect(result[AggregateOperations.COUNT]).toBeUndefined();
+ expect(result[AggregateOperations.MIN]).toBeUndefined();
});
});
diff --git a/packages/twenty-front/src/modules/object-record/utils/__tests__/isFieldTypeValidForAggregateOperation.test.ts b/packages/twenty-front/src/modules/object-record/utils/__tests__/isFieldTypeValidForAggregateOperation.test.ts
index 231102a9168..d9fb5dd6c62 100644
--- a/packages/twenty-front/src/modules/object-record/utils/__tests__/isFieldTypeValidForAggregateOperation.test.ts
+++ b/packages/twenty-front/src/modules/object-record/utils/__tests__/isFieldTypeValidForAggregateOperation.test.ts
@@ -1,4 +1,4 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { AggregateOperationsOmittingStandardOperations } from '@/object-record/types/AggregateOperationsOmittingStandardOperations';
import { isFieldTypeValidForAggregateOperation } from '@/object-record/utils/isFieldTypeValidForAggregateOperation';
import { FieldMetadataType } from '~/generated/graphql';
@@ -8,14 +8,14 @@ describe('isFieldTypeValidForAggregateOperation', () => {
expect(
isFieldTypeValidForAggregateOperation(
FieldMetadataType.NUMBER,
- AGGREGATE_OPERATIONS.sum,
+ AggregateOperations.SUM,
),
).toBe(true);
expect(
isFieldTypeValidForAggregateOperation(
FieldMetadataType.CURRENCY,
- AGGREGATE_OPERATIONS.min,
+ AggregateOperations.MIN,
),
).toBe(true);
});
@@ -24,14 +24,14 @@ describe('isFieldTypeValidForAggregateOperation', () => {
expect(
isFieldTypeValidForAggregateOperation(
FieldMetadataType.TEXT,
- AGGREGATE_OPERATIONS.avg,
+ AggregateOperations.AVG,
),
).toBe(false);
expect(
isFieldTypeValidForAggregateOperation(
FieldMetadataType.BOOLEAN,
- AGGREGATE_OPERATIONS.max,
+ AggregateOperations.MAX,
),
).toBe(false);
});
@@ -39,10 +39,10 @@ describe('isFieldTypeValidForAggregateOperation', () => {
it('should handle all aggregate operations', () => {
const numericField = FieldMetadataType.NUMBER;
const operations = [
- AGGREGATE_OPERATIONS.min,
- AGGREGATE_OPERATIONS.max,
- AGGREGATE_OPERATIONS.avg,
- AGGREGATE_OPERATIONS.sum,
+ AggregateOperations.MIN,
+ AggregateOperations.MAX,
+ AggregateOperations.AVG,
+ AggregateOperations.SUM,
];
operations.forEach((operation) => {
diff --git a/packages/twenty-front/src/modules/object-record/utils/convertAggregateOperationToExtendedAggregateOperation.ts b/packages/twenty-front/src/modules/object-record/utils/convertAggregateOperationToExtendedAggregateOperation.ts
index a5161b26a25..396b9f61968 100644
--- a/packages/twenty-front/src/modules/object-record/utils/convertAggregateOperationToExtendedAggregateOperation.ts
+++ b/packages/twenty-front/src/modules/object-record/utils/convertAggregateOperationToExtendedAggregateOperation.ts
@@ -1,19 +1,19 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations';
-import { FieldMetadataType } from '~/generated-metadata/graphql';
import { isFieldMetadataDateKind } from 'twenty-shared/utils';
+import { FieldMetadataType } from '~/generated-metadata/graphql';
export const convertAggregateOperationToExtendedAggregateOperation = (
- aggregateOperation: AGGREGATE_OPERATIONS,
+ aggregateOperation: AggregateOperations,
fieldType?: FieldMetadataType,
): ExtendedAggregateOperations => {
if (isFieldMetadataDateKind(fieldType) === true) {
- if (aggregateOperation === AGGREGATE_OPERATIONS.min) {
- return DATE_AGGREGATE_OPERATIONS.earliest;
+ if (aggregateOperation === AggregateOperations.MIN) {
+ return DateAggregateOperations.EARLIEST;
}
- if (aggregateOperation === AGGREGATE_OPERATIONS.max) {
- return DATE_AGGREGATE_OPERATIONS.latest;
+ if (aggregateOperation === AggregateOperations.MAX) {
+ return DateAggregateOperations.LATEST;
}
}
return aggregateOperation;
diff --git a/packages/twenty-front/src/modules/object-record/utils/convertExtendedAggregateOperationToAggregateOperation.ts b/packages/twenty-front/src/modules/object-record/utils/convertExtendedAggregateOperationToAggregateOperation.ts
index f492c5ebc9b..111a6f07c6c 100644
--- a/packages/twenty-front/src/modules/object-record/utils/convertExtendedAggregateOperationToAggregateOperation.ts
+++ b/packages/twenty-front/src/modules/object-record/utils/convertExtendedAggregateOperationToAggregateOperation.ts
@@ -1,16 +1,16 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations';
export const convertExtendedAggregateOperationToAggregateOperation = (
extendedAggregateOperation: ExtendedAggregateOperations | null,
) => {
- if (extendedAggregateOperation === DATE_AGGREGATE_OPERATIONS.earliest) {
- return AGGREGATE_OPERATIONS.min;
+ if (extendedAggregateOperation === DateAggregateOperations.EARLIEST) {
+ return AggregateOperations.MIN;
}
- if (extendedAggregateOperation === DATE_AGGREGATE_OPERATIONS.latest) {
- return AGGREGATE_OPERATIONS.max;
+ if (extendedAggregateOperation === DateAggregateOperations.LATEST) {
+ return AggregateOperations.MAX;
}
return extendedAggregateOperation;
};
diff --git a/packages/twenty-front/src/modules/object-record/utils/getAvailableAggregationsFromObjectFields.ts b/packages/twenty-front/src/modules/object-record/utils/getAvailableAggregationsFromObjectFields.ts
index edad298356b..8dd924c91c9 100644
--- a/packages/twenty-front/src/modules/object-record/utils/getAvailableAggregationsFromObjectFields.ts
+++ b/packages/twenty-front/src/modules/object-record/utils/getAvailableAggregationsFromObjectFields.ts
@@ -1,10 +1,10 @@
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { ExtendedAggregateOperations } from '@/object-record/record-table/types/ExtendedAggregateOperations';
-import { FieldMetadataType } from '~/generated-metadata/graphql';
-import { capitalize, isFieldMetadataDateKind } from 'twenty-shared/utils';
import { FIELD_FOR_TOTAL_COUNT_AGGREGATE_OPERATION } from 'twenty-shared/constants';
+import { capitalize, isFieldMetadataDateKind } from 'twenty-shared/utils';
+import { FieldMetadataType } from '~/generated-metadata/graphql';
type NameForAggregation = {
[T in ExtendedAggregateOperations]?: string;
@@ -25,53 +25,53 @@ export const getAvailableAggregationsFromObjectFields = (
if (field.type === FieldMetadataType.RELATION) {
acc[field.name] = {
- [AGGREGATE_OPERATIONS.count]: 'totalCount',
+ [AggregateOperations.COUNT]: 'totalCount',
};
return acc;
}
acc[field.name] = {
- [AGGREGATE_OPERATIONS.countUniqueValues]: `countUniqueValues${capitalize(field.name)}`,
- [AGGREGATE_OPERATIONS.countEmpty]: `countEmpty${capitalize(field.name)}`,
- [AGGREGATE_OPERATIONS.countNotEmpty]: `countNotEmpty${capitalize(field.name)}`,
- [AGGREGATE_OPERATIONS.percentageEmpty]: `percentageEmpty${capitalize(field.name)}`,
- [AGGREGATE_OPERATIONS.percentageNotEmpty]: `percentageNotEmpty${capitalize(field.name)}`,
- [AGGREGATE_OPERATIONS.count]: 'totalCount',
+ [AggregateOperations.COUNT_UNIQUE_VALUES]: `countUniqueValues${capitalize(field.name)}`,
+ [AggregateOperations.COUNT_EMPTY]: `countEmpty${capitalize(field.name)}`,
+ [AggregateOperations.COUNT_NOT_EMPTY]: `countNotEmpty${capitalize(field.name)}`,
+ [AggregateOperations.PERCENTAGE_EMPTY]: `percentageEmpty${capitalize(field.name)}`,
+ [AggregateOperations.PERCENTAGE_NOT_EMPTY]: `percentageNotEmpty${capitalize(field.name)}`,
+ [AggregateOperations.COUNT]: 'totalCount',
};
if (field.type === FieldMetadataType.NUMBER) {
acc[field.name] = {
...acc[field.name],
- [AGGREGATE_OPERATIONS.min]: `min${capitalize(field.name)}`,
- [AGGREGATE_OPERATIONS.max]: `max${capitalize(field.name)}`,
- [AGGREGATE_OPERATIONS.avg]: `avg${capitalize(field.name)}`,
- [AGGREGATE_OPERATIONS.sum]: `sum${capitalize(field.name)}`,
+ [AggregateOperations.MIN]: `min${capitalize(field.name)}`,
+ [AggregateOperations.MAX]: `max${capitalize(field.name)}`,
+ [AggregateOperations.AVG]: `avg${capitalize(field.name)}`,
+ [AggregateOperations.SUM]: `sum${capitalize(field.name)}`,
};
}
if (field.type === FieldMetadataType.CURRENCY) {
acc[field.name] = {
...acc[field.name],
- [AGGREGATE_OPERATIONS.min]: `min${capitalize(field.name)}AmountMicros`,
- [AGGREGATE_OPERATIONS.max]: `max${capitalize(field.name)}AmountMicros`,
- [AGGREGATE_OPERATIONS.avg]: `avg${capitalize(field.name)}AmountMicros`,
- [AGGREGATE_OPERATIONS.sum]: `sum${capitalize(field.name)}AmountMicros`,
+ [AggregateOperations.MIN]: `min${capitalize(field.name)}AmountMicros`,
+ [AggregateOperations.MAX]: `max${capitalize(field.name)}AmountMicros`,
+ [AggregateOperations.AVG]: `avg${capitalize(field.name)}AmountMicros`,
+ [AggregateOperations.SUM]: `sum${capitalize(field.name)}AmountMicros`,
};
}
if (field.type === FieldMetadataType.BOOLEAN) {
acc[field.name] = {
...acc[field.name],
- [AGGREGATE_OPERATIONS.countTrue]: `countTrue${capitalize(field.name)}`,
- [AGGREGATE_OPERATIONS.countFalse]: `countFalse${capitalize(field.name)}`,
+ [AggregateOperations.COUNT_TRUE]: `countTrue${capitalize(field.name)}`,
+ [AggregateOperations.COUNT_FALSE]: `countFalse${capitalize(field.name)}`,
};
}
if (isFieldMetadataDateKind(field.type) === true) {
acc[field.name] = {
...acc[field.name],
- [DATE_AGGREGATE_OPERATIONS.earliest]: `min${capitalize(field.name)}`,
- [DATE_AGGREGATE_OPERATIONS.latest]: `max${capitalize(field.name)}`,
+ [DateAggregateOperations.EARLIEST]: `min${capitalize(field.name)}`,
+ [DateAggregateOperations.LATEST]: `max${capitalize(field.name)}`,
};
}
@@ -83,7 +83,7 @@ export const getAvailableAggregationsFromObjectFields = (
},
{
[FIELD_FOR_TOTAL_COUNT_AGGREGATE_OPERATION]: {
- [AGGREGATE_OPERATIONS.count]: 'totalCount',
+ [AggregateOperations.COUNT]: 'totalCount',
},
},
);
diff --git a/packages/twenty-front/src/modules/settings/integrations/hooks/useIsSettingsIntegrationEnabled.ts b/packages/twenty-front/src/modules/settings/integrations/hooks/useIsSettingsIntegrationEnabled.ts
index c45ad36d642..7cb171aeacb 100644
--- a/packages/twenty-front/src/modules/settings/integrations/hooks/useIsSettingsIntegrationEnabled.ts
+++ b/packages/twenty-front/src/modules/settings/integrations/hooks/useIsSettingsIntegrationEnabled.ts
@@ -4,11 +4,11 @@ import { FeatureFlagKey } from '~/generated/graphql';
const getFeatureKey = (databaseKey: string): FeatureFlagKey | null => {
switch (databaseKey) {
case 'airtable':
- return FeatureFlagKey.IsAirtableIntegrationEnabled;
+ return FeatureFlagKey.IS_AIRTABLE_INTEGRATION_ENABLED;
case 'postgresql':
- return FeatureFlagKey.IsPostgreSQLIntegrationEnabled;
+ return FeatureFlagKey.IS_POSTGRESQL_INTEGRATION_ENABLED;
case 'stripe':
- return FeatureFlagKey.IsStripeIntegrationEnabled;
+ return FeatureFlagKey.IS_STRIPE_INTEGRATION_ENABLED;
default:
return null;
}
diff --git a/packages/twenty-front/src/modules/settings/integrations/hooks/useSettingsIntegrationCategories.ts b/packages/twenty-front/src/modules/settings/integrations/hooks/useSettingsIntegrationCategories.ts
index e98beba7a74..4d24420d6f1 100644
--- a/packages/twenty-front/src/modules/settings/integrations/hooks/useSettingsIntegrationCategories.ts
+++ b/packages/twenty-front/src/modules/settings/integrations/hooks/useSettingsIntegrationCategories.ts
@@ -10,21 +10,21 @@ import { FeatureFlagKey } from '~/generated/graphql';
export const useSettingsIntegrationCategories =
(): SettingsIntegrationCategory[] => {
const isAirtableIntegrationEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsAirtableIntegrationEnabled,
+ FeatureFlagKey.IS_AIRTABLE_INTEGRATION_ENABLED,
);
const isAirtableIntegrationActive = !!MOCK_REMOTE_DATABASES.find(
({ name }) => name === 'airtable',
)?.isActive;
const isPostgresqlIntegrationEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsPostgreSQLIntegrationEnabled,
+ FeatureFlagKey.IS_POSTGRESQL_INTEGRATION_ENABLED,
);
const isPostgresqlIntegrationActive = !!MOCK_REMOTE_DATABASES.find(
({ name }) => name === 'postgresql',
)?.isActive;
const isStripeIntegrationEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsStripeIntegrationEnabled,
+ FeatureFlagKey.IS_STRIPE_INTEGRATION_ENABLED,
);
const isStripeIntegrationActive = !!MOCK_REMOTE_DATABASES.find(
({ name }) => name === 'stripe',
diff --git a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx
index 797f04f0449..62223ce1941 100644
--- a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx
@@ -36,7 +36,7 @@ const StyledNoRoles = styled(TableCell)`
export const SettingsRolesList = () => {
const navigateSettings = useNavigateSettings();
const isPermissionsV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsPermissionsV2Enabled,
+ FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED,
);
const settingsAllRoles = useRecoilValue(settingsAllRolesSelector);
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/components/SettingsRolePermissions.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/components/SettingsRolePermissions.tsx
index 2b917bf95a9..962ae37ee44 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/components/SettingsRolePermissions.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/components/SettingsRolePermissions.tsx
@@ -23,7 +23,7 @@ export const SettingsRolePermissions = ({
isCreateMode,
}: SettingsRolePermissionsProps) => {
const isPermissionsV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsPermissionsV2Enabled,
+ FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED,
);
return (
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/settings-permissions/components/SettingsRolePermissionsSettingsSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/settings-permissions/components/SettingsRolePermissionsSettingsSection.tsx
index a75f0a70b76..b5b9bea8dcc 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/settings-permissions/components/SettingsRolePermissionsSettingsSection.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/settings-permissions/components/SettingsRolePermissionsSettingsSection.tsx
@@ -45,7 +45,7 @@ export const SettingsRolePermissionsSettingsSection = ({
isEditable,
}: SettingsRolePermissionsSettingsSectionProps) => {
const isPermissionsV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsPermissionsV2Enabled,
+ FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED,
);
const [settingsDraftRole, setSettingsDraftRole] = useRecoilState(
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/settings-permissions/components/SettingsRolePermissionsSettingsTableRow.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/settings-permissions/components/SettingsRolePermissionsSettingsTableRow.tsx
index e0870914179..96d50a55996 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/settings-permissions/components/SettingsRolePermissionsSettingsTableRow.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/settings-permissions/components/SettingsRolePermissionsSettingsTableRow.tsx
@@ -54,7 +54,7 @@ export const SettingsRolePermissionsSettingsTableRow = ({
settingsDraftRoleFamilyState(roleId),
);
const isPermissionsV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsPermissionsV2Enabled,
+ FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED,
);
const canUpdateAllSettings = settingsDraftRole.canUpdateAllSettings;
diff --git a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx
index ce7b79f4267..62d7a8569a5 100644
--- a/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role/components/SettingsRole.tsx
@@ -60,7 +60,7 @@ export const SettingsRole = ({ roleId, isCreateMode }: SettingsRoleProps) => {
);
const isPermissionsV2Enabled = useIsFeatureEnabled(
- FeatureFlagKey.IsPermissionsV2Enabled,
+ FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED,
);
const navigateSettings = useNavigateSettings();
diff --git a/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx b/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx
index a29c2e6ff08..bd9d31c0a0b 100644
--- a/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx
+++ b/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx
@@ -10,7 +10,6 @@ import { RecordFilterGroupsComponentInstanceContext } from '@/object-record/reco
import { RecordFiltersComponentInstanceContext } from '@/object-record/record-filter/states/context/RecordFiltersComponentInstanceContext';
import { RecordIndexContextProvider } from '@/object-record/record-index/contexts/RecordIndexContext';
import { RecordSortsComponentInstanceContext } from '@/object-record/record-sort/states/context/RecordSortsComponentInstanceContext';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
import { RecordTableComponentInstanceContext } from '@/object-record/record-table/states/context/RecordTableComponentInstanceContext';
import { tableColumnsComponentState } from '@/object-record/record-table/states/tableColumnsComponentState';
import { prefetchViewsState } from '@/prefetch/states/prefetchViewsState';
@@ -21,6 +20,7 @@ import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
import { ViewType } from '@/views/types/ViewType';
import { MAIN_CONTEXT_STORE_INSTANCE_ID } from '@/context-store/constants/MainContextStoreInstanceId';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { VIEW_BAR_FILTER_DROPDOWN_ID } from '@/views/constants/ViewBarFilterDropdownId';
import { View } from '@/views/types/View';
import { within } from '@storybook/test';
@@ -67,7 +67,7 @@ const meta: Meta<typeof ViewBarFilterDropdown> = {
viewGroups: [],
viewSorts: [],
kanbanFieldMetadataId: '',
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
icon: '',
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
diff --git a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.test.tsx b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.test.tsx
index ef24ae90e9d..153402e149b 100644
--- a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.test.tsx
+++ b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups.test.tsx
@@ -3,7 +3,7 @@ import { renderHook } from '@testing-library/react';
import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState';
import { currentRecordFilterGroupsComponentState } from '@/object-record/record-filter-group/states/currentRecordFilterGroupsComponentState';
import { RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { prefetchViewsState } from '@/prefetch/states/prefetchViewsState';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups } from '@/views/hooks/useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups';
@@ -14,9 +14,9 @@ import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
import { ViewType } from '@/views/types/ViewType';
import { mapViewFilterGroupLogicalOperatorToRecordFilterGroupLogicalOperator } from '@/views/utils/mapViewFilterGroupLogicalOperatorToRecordFilterGroupLogicalOperator';
import { act } from 'react';
+import { isDefined } from 'twenty-shared/utils';
import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper';
import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
-import { isDefined } from 'twenty-shared/utils';
const mockObjectMetadataItemNameSingular = 'company';
@@ -54,7 +54,7 @@ describe('useApplyCurrentViewFilterGroupsToCurrentRecordFilterGroups', () => {
viewGroups: [],
viewSorts: [],
kanbanFieldMetadataId: '',
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
icon: '',
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
diff --git a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFiltersToCurrentRecordFilters.test.tsx b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFiltersToCurrentRecordFilters.test.tsx
index 848836d5c39..6f9aaa00d59 100644
--- a/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFiltersToCurrentRecordFilters.test.tsx
+++ b/packages/twenty-front/src/modules/views/hooks/__tests__/useApplyCurrentViewFiltersToCurrentRecordFilters.test.tsx
@@ -4,7 +4,7 @@ import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/
import { getFilterTypeFromFieldType } from '@/object-metadata/utils/formatFieldMetadataItemsAsFilterDefinitions';
import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState';
import { RecordFilter } from '@/object-record/record-filter/types/RecordFilter';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { prefetchViewsState } from '@/prefetch/states/prefetchViewsState';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { View } from '@/views/types/View';
@@ -13,10 +13,10 @@ import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
import { ViewType } from '@/views/types/ViewType';
import { act } from 'react';
+import { isDefined } from 'twenty-shared/utils';
import { getJestMetadataAndApolloMocksAndActionMenuWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksAndActionMenuWrapper';
import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
import { useApplyCurrentViewFiltersToCurrentRecordFilters } from '../useApplyCurrentViewFiltersToCurrentRecordFilters';
-import { isDefined } from 'twenty-shared/utils';
const mockObjectMetadataItemNameSingular = 'company';
@@ -57,7 +57,7 @@ describe('useApplyCurrentViewFiltersToCurrentRecordFilters', () => {
viewGroups: [],
viewSorts: [],
kanbanFieldMetadataId: '',
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
icon: '',
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
diff --git a/packages/twenty-front/src/modules/views/hooks/__tests__/useUpdateViewAggregate.test.tsx b/packages/twenty-front/src/modules/views/hooks/__tests__/useUpdateViewAggregate.test.tsx
index 6c39643c0e1..de82e1fb897 100644
--- a/packages/twenty-front/src/modules/views/hooks/__tests__/useUpdateViewAggregate.test.tsx
+++ b/packages/twenty-front/src/modules/views/hooks/__tests__/useUpdateViewAggregate.test.tsx
@@ -1,5 +1,5 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
-import { DATE_AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/DateAggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
+import { DateAggregateOperations } from '@/object-record/record-table/constants/DateAggregateOperations';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useUpdateView } from '@/views/hooks/useUpdateView';
import { renderHook } from '@testing-library/react';
@@ -34,21 +34,21 @@ describe('useUpdateViewAggregate', () => {
result.current.updateViewAggregate({
kanbanAggregateOperationFieldMetadataId: 'test-field-id',
- kanbanAggregateOperation: DATE_AGGREGATE_OPERATIONS.earliest,
+ kanbanAggregateOperation: DateAggregateOperations.EARLIEST,
});
// updateView is called with 'EARLIEST' converted to 'MIN'
expect(mockUpdateView).toHaveBeenCalledWith({
id: mockCurrentViewId,
kanbanAggregateOperationFieldMetadataId: 'test-field-id',
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.min,
+ kanbanAggregateOperation: AggregateOperations.MIN,
});
// setAggregateOperation is called with 'EARLIEST'
expect(
mockSetRecordIndexKanbanAggregateOperationState,
).toHaveBeenCalledWith({
- operation: DATE_AGGREGATE_OPERATIONS.earliest,
+ operation: DateAggregateOperations.EARLIEST,
fieldMetadataId: 'test-field-id',
});
});
diff --git a/packages/twenty-front/src/modules/views/hooks/internal/useGetRecordIndexTotalCount.ts b/packages/twenty-front/src/modules/views/hooks/internal/useGetRecordIndexTotalCount.ts
index 6138fe031ec..626e8dc0296 100644
--- a/packages/twenty-front/src/modules/views/hooks/internal/useGetRecordIndexTotalCount.ts
+++ b/packages/twenty-front/src/modules/views/hooks/internal/useGetRecordIndexTotalCount.ts
@@ -4,7 +4,7 @@ import { currentRecordFilterGroupsComponentState } from '@/object-record/record-
import { useFilterValueDependencies } from '@/object-record/record-filter/hooks/useFilterValueDependencies';
import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState';
import { computeRecordGqlOperationFilter } from '@/object-record/record-filter/utils/computeRecordGqlOperationFilter';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useGetViewGroupsFilters } from '@/views/hooks/useGetViewGroupsFilters';
@@ -36,7 +36,7 @@ export const useGetRecordIndexTotalCount = () => {
objectNameSingular: objectMetadataItem.nameSingular,
filter,
recordGqlFieldsAggregate: {
- id: [AGGREGATE_OPERATIONS.count],
+ id: [AggregateOperations.COUNT],
},
});
diff --git a/packages/twenty-front/src/modules/views/types/GraphQLView.ts b/packages/twenty-front/src/modules/views/types/GraphQLView.ts
index c64f9ab4581..9fa643df274 100644
--- a/packages/twenty-front/src/modules/views/types/GraphQLView.ts
+++ b/packages/twenty-front/src/modules/views/types/GraphQLView.ts
@@ -1,4 +1,4 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { ViewField } from '@/views/types/ViewField';
import { ViewFilter } from '@/views/types/ViewFilter';
import { ViewFilterGroup } from '@/views/types/ViewFilterGroup';
@@ -17,7 +17,7 @@ export type GraphQLView = {
* @deprecated Use `viewGroups.fieldMetadataId` instead.
*/
kanbanFieldMetadataId: string;
- kanbanAggregateOperation?: AGGREGATE_OPERATIONS | null;
+ kanbanAggregateOperation?: AggregateOperations | null;
kanbanAggregateOperationFieldMetadataId?: string | null;
objectMetadataId: string;
isCompact: boolean;
diff --git a/packages/twenty-front/src/modules/views/types/View.ts b/packages/twenty-front/src/modules/views/types/View.ts
index 3453dedd28f..3d0c4ed3b3f 100644
--- a/packages/twenty-front/src/modules/views/types/View.ts
+++ b/packages/twenty-front/src/modules/views/types/View.ts
@@ -1,4 +1,4 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { ViewField } from '@/views/types/ViewField';
import { ViewFilter } from '@/views/types/ViewFilter';
import { ViewFilterGroup } from '@/views/types/ViewFilterGroup';
@@ -24,7 +24,7 @@ export type View = {
* @deprecated Use `viewGroups.fieldMetadataId` instead.
*/
kanbanFieldMetadataId: string;
- kanbanAggregateOperation: AGGREGATE_OPERATIONS | null;
+ kanbanAggregateOperation: AggregateOperations | null;
kanbanAggregateOperationFieldMetadataId: string | null;
position: number;
icon: string;
diff --git a/packages/twenty-front/src/modules/views/types/ViewField.ts b/packages/twenty-front/src/modules/views/types/ViewField.ts
index 1cd2dff16aa..2b8532c8d97 100644
--- a/packages/twenty-front/src/modules/views/types/ViewField.ts
+++ b/packages/twenty-front/src/modules/views/types/ViewField.ts
@@ -1,6 +1,6 @@
import { RecordBoardFieldDefinition } from '@/object-record/record-board/types/RecordBoardFieldDefinition';
import { FieldMetadata } from '@/object-record/record-field/types/FieldMetadata';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { ColumnDefinition } from '@/object-record/record-table/types/ColumnDefinition';
export type ViewField = {
@@ -10,7 +10,7 @@ export type ViewField = {
position: number;
isVisible: boolean;
size: number;
- aggregateOperation?: AGGREGATE_OPERATIONS | null;
+ aggregateOperation?: AggregateOperations | null;
definition:
| ColumnDefinition<FieldMetadata>
| RecordBoardFieldDefinition<FieldMetadata>;
diff --git a/packages/twenty-front/src/modules/views/utils/__tests__/mapRecordFilterGroupToViewFilterGroup.test.ts b/packages/twenty-front/src/modules/views/utils/__tests__/mapRecordFilterGroupToViewFilterGroup.test.ts
index 1dd72370d6b..90c577a99bf 100644
--- a/packages/twenty-front/src/modules/views/utils/__tests__/mapRecordFilterGroupToViewFilterGroup.test.ts
+++ b/packages/twenty-front/src/modules/views/utils/__tests__/mapRecordFilterGroupToViewFilterGroup.test.ts
@@ -1,14 +1,14 @@
import { RecordFilterGroup } from '@/object-record/record-filter-group/types/RecordFilterGroup';
import { RecordFilterGroupLogicalOperator } from '@/object-record/record-filter-group/types/RecordFilterGroupLogicalOperator';
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { View } from '@/views/types/View';
import { ViewFilterGroup } from '@/views/types/ViewFilterGroup';
import { ViewFilterGroupLogicalOperator } from '@/views/types/ViewFilterGroupLogicalOperator';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
import { ViewType } from '@/views/types/ViewType';
import { mapRecordFilterGroupToViewFilterGroup } from '@/views/utils/mapRecordFilterGroupToViewFilterGroup';
-import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
import { isDefined } from 'twenty-shared/utils';
+import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
const mockObjectMetadataItemNameSingular = 'company';
@@ -37,7 +37,7 @@ describe('mapRecordFilterGroupToViewFilterGroup', () => {
viewGroups: [],
viewSorts: [],
kanbanFieldMetadataId: '',
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
icon: '',
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx
index 35e390f43aa..91e7a3a0a5c 100644
--- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx
+++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectDetailPage.tsx
@@ -20,13 +20,7 @@ import { useRecoilState, useRecoilValue } from 'recoil';
import { activeTabIdComponentState } from '@/ui/layout/tab/states/activeTabIdComponentState';
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
import { useLingui } from '@lingui/react/macro';
-import { FeatureFlagKey } from '~/generated/graphql';
-import { useNavigateApp } from '~/hooks/useNavigateApp';
-import { SETTINGS_OBJECT_DETAIL_TABS } from '~/pages/settings/data-model/constants/SettingsObjectDetailTabs';
-import { updatedObjectNamePluralState } from '~/pages/settings/data-model/states/updatedObjectNamePluralState';
-import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
import { isDefined } from 'twenty-shared/utils';
-import { Button } from 'twenty-ui/input';
import {
H3Title,
IconCodeCircle,
@@ -35,8 +29,14 @@ import {
IconPoint,
IconSettings,
} from 'twenty-ui/display';
-import { MAIN_COLORS } from 'twenty-ui/theme';
+import { Button } from 'twenty-ui/input';
import { UndecoratedLink } from 'twenty-ui/navigation';
+import { MAIN_COLORS } from 'twenty-ui/theme';
+import { FeatureFlagKey } from '~/generated/graphql';
+import { useNavigateApp } from '~/hooks/useNavigateApp';
+import { SETTINGS_OBJECT_DETAIL_TABS } from '~/pages/settings/data-model/constants/SettingsObjectDetailTabs';
+import { updatedObjectNamePluralState } from '~/pages/settings/data-model/states/updatedObjectNamePluralState';
+import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
const StyledContentContainer = styled.div`
flex: 1;
@@ -76,7 +76,7 @@ export const SettingsObjectDetailPage = () => {
const isAdvancedModeEnabled = useRecoilValue(isAdvancedModeEnabledState);
const isUniqueIndexesEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsUniqueIndexesEnabled,
+ FeatureFlagKey.IS_UNIQUE_INDEXES_ENABLED,
);
useEffect(() => {
diff --git a/packages/twenty-front/src/pages/settings/workspace/SettingsDomain.tsx b/packages/twenty-front/src/pages/settings/workspace/SettingsDomain.tsx
index 32fc0b4b1cf..8424e09e099 100644
--- a/packages/twenty-front/src/pages/settings/workspace/SettingsDomain.tsx
+++ b/packages/twenty-front/src/pages/settings/workspace/SettingsDomain.tsx
@@ -11,7 +11,6 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
import { useModal } from '@/ui/layout/modal/hooks/useModal';
import { SubMenuTopBarContainer } from '@/ui/layout/page/components/SubMenuTopBarContainer';
-import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { ApolloError } from '@apollo/client';
import { zodResolver } from '@hookform/resolvers/zod';
import { Trans, useLingui } from '@lingui/react/macro';
@@ -19,10 +18,7 @@ import { FormProvider, useForm } from 'react-hook-form';
import { useRecoilState } from 'recoil';
import { isDefined } from 'twenty-shared/utils';
import { z } from 'zod';
-import {
- FeatureFlagKey,
- useUpdateWorkspaceMutation,
-} from '~/generated/graphql';
+import { useUpdateWorkspaceMutation } from '~/generated/graphql';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
import { SettingsCustomDomain } from '~/pages/settings/workspace/SettingsCustomDomain';
import { SettingsSubdomain } from '~/pages/settings/workspace/SettingsSubdomain';
@@ -68,10 +64,6 @@ export const SettingsDomain = () => {
const [updateWorkspace] = useUpdateWorkspaceMutation();
const { redirectToWorkspaceDomain } = useRedirectToWorkspaceDomain();
- const isCustomDomainEnabled = useIsFeatureEnabled(
- FeatureFlagKey.IsCustomDomainEnabled,
- );
-
const [currentWorkspace, setCurrentWorkspace] = useRecoilState(
currentWorkspaceState,
);
@@ -236,7 +228,7 @@ export const SettingsDomain = () => {
>
<SettingsPageContainer>
<SettingsSubdomain />
- {isCustomDomainEnabled && <SettingsCustomDomain />}
+ <SettingsCustomDomain />
</SettingsPageContainer>
</SubMenuTopBarContainer>
<ConfirmationModal
diff --git a/packages/twenty-front/src/testing/mock-data/config.ts b/packages/twenty-front/src/testing/mock-data/config.ts
index 4df865abd86..f713d9e4137 100644
--- a/packages/twenty-front/src/testing/mock-data/config.ts
+++ b/packages/twenty-front/src/testing/mock-data/config.ts
@@ -40,7 +40,7 @@ export const mockedClientConfig: ClientConfig = {
],
},
captcha: {
- provider: CaptchaDriverType.GoogleRecaptcha,
+ provider: CaptchaDriverType.GOOGLE_RECAPTCHA,
siteKey: 'MOCKED_SITE_KEY',
},
api: { mutationMaximumAffectedRecords: 100 },
diff --git a/packages/twenty-front/src/testing/mock-data/users.ts b/packages/twenty-front/src/testing/mock-data/users.ts
index 4e1484413ad..65f2163b897 100644
--- a/packages/twenty-front/src/testing/mock-data/users.ts
+++ b/packages/twenty-front/src/testing/mock-data/users.ts
@@ -59,15 +59,15 @@ export const mockCurrentWorkspace: Workspace = {
isMicrosoftAuthEnabled: false,
featureFlags: [
{
- key: FeatureFlagKey.IsAirtableIntegrationEnabled,
+ key: FeatureFlagKey.IS_AIRTABLE_INTEGRATION_ENABLED,
value: true,
},
{
- key: FeatureFlagKey.IsPostgreSQLIntegrationEnabled,
+ key: FeatureFlagKey.IS_POSTGRESQL_INTEGRATION_ENABLED,
value: true,
},
{
- key: FeatureFlagKey.IsWorkflowEnabled,
+ key: FeatureFlagKey.IS_WORKFLOW_ENABLED,
value: true,
},
],
diff --git a/packages/twenty-front/src/testing/mock-data/views.ts b/packages/twenty-front/src/testing/mock-data/views.ts
index 4542579b5e1..8d96ab872cb 100644
--- a/packages/twenty-front/src/testing/mock-data/views.ts
+++ b/packages/twenty-front/src/testing/mock-data/views.ts
@@ -1,4 +1,4 @@
-import { AGGREGATE_OPERATIONS } from '@/object-record/record-table/constants/AggregateOperations';
+import { AggregateOperations } from '@/object-record/record-table/constants/AggregateOperations';
import { View } from '@/views/types/View';
import { ViewKey } from '@/views/types/ViewKey';
import { ViewOpenRecordInType } from '@/views/types/ViewOpenRecordInType';
@@ -26,7 +26,7 @@ export const mockedViewsData: View[] = [
icon: 'IconSkyline',
key: ViewKey.Index,
kanbanFieldMetadataId: '',
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
@@ -46,7 +46,7 @@ export const mockedViewsData: View[] = [
icon: 'IconPerson',
key: ViewKey.Index,
kanbanFieldMetadataId: '',
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
@@ -66,7 +66,7 @@ export const mockedViewsData: View[] = [
icon: 'IconOpportunity',
key: ViewKey.Index,
kanbanFieldMetadataId: '',
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
@@ -86,7 +86,7 @@ export const mockedViewsData: View[] = [
icon: 'IconSkyline',
key: null,
kanbanFieldMetadataId: '',
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
kanbanAggregateOperationFieldMetadataId: '',
position: 0,
isCompact: false,
diff --git a/packages/twenty-server/.env.example b/packages/twenty-server/.env.example
index 37fb25af7de..1e4b3f396d9 100644
--- a/packages/twenty-server/.env.example
+++ b/packages/twenty-server/.env.example
@@ -37,7 +37,7 @@ FRONTEND_URL=http://localhost:3001
# SUPPORT_DRIVER=front
# SUPPORT_FRONT_HMAC_KEY=replace_me_with_front_chat_verification_secret
# SUPPORT_FRONT_CHAT_ID=replace_me_with_front_chat_id
-# LOGGER_DRIVER=console
+# LOGGER_DRIVER=CONSOLE
# LOGGER_IS_BUFFER_ENABLED=true
# EXCEPTION_HANDLER_DRIVER=sentry
# METER_DRIVER=opentelemetry,console
@@ -55,7 +55,7 @@ FRONTEND_URL=http://localhost:3001
# EMAIL_FROM_NAME='John from YourDomain'
-# EMAIL_DRIVER=logger
+# EMAIL_DRIVER=LOGGER
# EMAIL_SMTP_HOST=
# EMAIL_SMTP_PORT=
# EMAIL_SMTP_USER=
diff --git a/packages/twenty-server/.env.test b/packages/twenty-server/.env.test
index 42648eb28f4..eeca857db77 100644
--- a/packages/twenty-server/.env.test
+++ b/packages/twenty-server/.env.test
@@ -3,7 +3,7 @@ REDIS_URL=redis://localhost:6379
APP_SECRET=replace_me_with_a_random_string
SIGN_IN_PREFILLED=true
-EXCEPTION_HANDLER_DRIVER=console
+EXCEPTION_HANDLER_DRIVER=CONSOLE
SENTRY_DSN=https://ba869cb8fd72d5faeb6643560939cee0@o4505516959793152.ingest.sentry.io/4506660900306944
MUTATION_MAXIMUM_RECORD_AFFECTED=100
diff --git a/packages/twenty-server/jest-integration.config.ts b/packages/twenty-server/jest-integration.config.ts
index 0a8cf6e93dc..a46e52042ee 100644
--- a/packages/twenty-server/jest-integration.config.ts
+++ b/packages/twenty-server/jest-integration.config.ts
@@ -65,7 +65,7 @@ const jestConfig: JestConfigWithTsJest = {
},
globals: {
APP_PORT: 4000,
- NODE_ENV: NodeEnvironment.test,
+ NODE_ENV: NodeEnvironment.TEST,
ADMIN_ACCESS_TOKEN:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyMDIwMjAyMC05ZTNiLTQ2ZDQtYTU1Ni04OGI5ZGRjMmIwMzQiLCJ3b3Jrc3BhY2VJZCI6IjIwMjAyMDIwLTFjMjUtNGQwMi1iZjI1LTZhZWNjZjdlYTQxOSIsIndvcmtzcGFjZU1lbWJlcklkIjoiMjAyMDIwMjAtMDY4Ny00YzQxLWI3MDctZWQxYmZjYTk3MmE3IiwidXNlcldvcmtzcGFjZUlkIjoiMjAyMDIwMjAtOWUzYi00NmQ0LWE1NTYtODhiOWRkYzJiMDM1IiwiaWF0IjoxNzM5NTQ3NjYxLCJleHAiOjMzMjk3MTQ3NjYxfQ.fbOM9yhr3jWDicPZ1n771usUURiPGmNdeFApsgrbxOw',
EXPIRED_ACCESS_TOKEN:
diff --git a/packages/twenty-server/src/database/commands/upgrade-version-command/0-44/0-44-update-view-aggregate-operations.command.ts b/packages/twenty-server/src/database/commands/upgrade-version-command/0-44/0-44-update-view-aggregate-operations.command.ts
index 44ff082a770..2d8c5283394 100644
--- a/packages/twenty-server/src/database/commands/upgrade-version-command/0-44/0-44-update-view-aggregate-operations.command.ts
+++ b/packages/twenty-server/src/database/commands/upgrade-version-command/0-44/0-44-update-view-aggregate-operations.command.ts
@@ -8,7 +8,7 @@ import {
ActiveOrSuspendedWorkspacesMigrationCommandRunner,
RunOnWorkspaceArgs,
} from 'src/database/commands/command-runners/active-or-suspended-workspaces-migration.command-runner';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
@@ -28,73 +28,73 @@ import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync
const AGGREGATE_OPERATION_OPTIONS = [
{
- value: AGGREGATE_OPERATIONS.avg,
+ value: AggregateOperations.AVG,
label: 'Average',
position: 0,
color: 'red',
},
{
- value: AGGREGATE_OPERATIONS.count,
+ value: AggregateOperations.COUNT,
label: 'Count',
position: 1,
color: 'purple',
},
{
- value: AGGREGATE_OPERATIONS.max,
+ value: AggregateOperations.MAX,
label: 'Maximum',
position: 2,
color: 'sky',
},
{
- value: AGGREGATE_OPERATIONS.min,
+ value: AggregateOperations.MIN,
label: 'Minimum',
position: 3,
color: 'turquoise',
},
{
- value: AGGREGATE_OPERATIONS.sum,
+ value: AggregateOperations.SUM,
label: 'Sum',
position: 4,
color: 'yellow',
},
{
- value: AGGREGATE_OPERATIONS.countEmpty,
+ value: AggregateOperations.COUNT_EMPTY,
label: 'Count empty',
position: 5,
color: 'red',
},
{
- value: AGGREGATE_OPERATIONS.countNotEmpty,
+ value: AggregateOperations.COUNT_NOT_EMPTY,
label: 'Count not empty',
position: 6,
color: 'purple',
},
{
- value: AGGREGATE_OPERATIONS.countUniqueValues,
+ value: AggregateOperations.COUNT_UNIQUE_VALUES,
label: 'Count unique values',
position: 7,
color: 'sky',
},
{
- value: AGGREGATE_OPERATIONS.percentageEmpty,
+ value: AggregateOperations.PERCENTAGE_EMPTY,
label: 'Percent empty',
position: 8,
color: 'turquoise',
},
{
- value: AGGREGATE_OPERATIONS.percentageNotEmpty,
+ value: AggregateOperations.PERCENTAGE_NOT_EMPTY,
label: 'Percent not empty',
position: 9,
color: 'yellow',
},
{
- value: AGGREGATE_OPERATIONS.countTrue,
+ value: AggregateOperations.COUNT_TRUE,
label: 'Count true',
position: 10,
color: 'red',
},
{
- value: AGGREGATE_OPERATIONS.countFalse,
+ value: AggregateOperations.COUNT_FALSE,
label: 'Count false',
position: 11,
color: 'purple',
diff --git a/packages/twenty-server/src/database/typeorm-seeds/core/feature-flags.ts b/packages/twenty-server/src/database/typeorm-seeds/core/feature-flags.ts
index 6840e4321fc..ac2a63592db 100644
--- a/packages/twenty-server/src/database/typeorm-seeds/core/feature-flags.ts
+++ b/packages/twenty-server/src/database/typeorm-seeds/core/feature-flags.ts
@@ -16,32 +16,27 @@ export const seedFeatureFlags = async (
.orIgnore()
.values([
{
- key: FeatureFlagKey.IsAirtableIntegrationEnabled,
+ key: FeatureFlagKey.IS_AIRTABLE_INTEGRATION_ENABLED,
workspaceId: workspaceId,
value: true,
},
{
- key: FeatureFlagKey.IsPostgreSQLIntegrationEnabled,
+ key: FeatureFlagKey.IS_POSTGRESQL_INTEGRATION_ENABLED,
workspaceId: workspaceId,
value: true,
},
{
- key: FeatureFlagKey.IsStripeIntegrationEnabled,
+ key: FeatureFlagKey.IS_STRIPE_INTEGRATION_ENABLED,
workspaceId: workspaceId,
value: true,
},
{
- key: FeatureFlagKey.IsWorkflowEnabled,
+ key: FeatureFlagKey.IS_WORKFLOW_ENABLED,
workspaceId: workspaceId,
value: true,
},
{
- key: FeatureFlagKey.IsCustomDomainEnabled,
- workspaceId: workspaceId,
- value: false,
- },
- {
- key: FeatureFlagKey.IsUniqueIndexesEnabled,
+ key: FeatureFlagKey.IS_UNIQUE_INDEXES_ENABLED,
workspaceId: workspaceId,
value: false,
},
diff --git a/packages/twenty-server/src/engine/api/graphql/graphql-config/graphql-config.service.ts b/packages/twenty-server/src/engine/api/graphql/graphql-config/graphql-config.service.ts
index 72e5f775766..d426553c8f2 100644
--- a/packages/twenty-server/src/engine/api/graphql/graphql-config/graphql-config.service.ts
+++ b/packages/twenty-server/src/engine/api/graphql/graphql-config/graphql-config.service.ts
@@ -44,7 +44,7 @@ export class GraphQLConfigService
createGqlOptions(): YogaDriverConfig {
const isDebugMode =
- this.twentyConfigService.get('NODE_ENV') === NodeEnvironment.development;
+ this.twentyConfigService.get('NODE_ENV') === NodeEnvironment.DEVELOPMENT;
const plugins = [
useThrottler({
ttl: this.twentyConfigService.get('API_RATE_LIMITING_TTL'),
diff --git a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant.ts b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant.ts
index ad28365c30c..13940ccbbf4 100644
--- a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant.ts
+++ b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant.ts
@@ -1,14 +1,14 @@
-export enum AGGREGATE_OPERATIONS {
- min = 'MIN',
- max = 'MAX',
- avg = 'AVG',
- sum = 'SUM',
- count = 'COUNT',
- countUniqueValues = 'COUNT_UNIQUE_VALUES',
- countEmpty = 'COUNT_EMPTY',
- countNotEmpty = 'COUNT_NOT_EMPTY',
- countTrue = 'COUNT_TRUE',
- countFalse = 'COUNT_FALSE',
- percentageEmpty = 'PERCENTAGE_EMPTY',
- percentageNotEmpty = 'PERCENTAGE_NOT_EMPTY',
+export enum AggregateOperations {
+ MIN = 'MIN',
+ MAX = 'MAX',
+ AVG = 'AVG',
+ SUM = 'SUM',
+ COUNT = 'COUNT',
+ COUNT_UNIQUE_VALUES = 'COUNT_UNIQUE_VALUES',
+ COUNT_EMPTY = 'COUNT_EMPTY',
+ COUNT_NOT_EMPTY = 'COUNT_NOT_EMPTY',
+ COUNT_TRUE = 'COUNT_TRUE',
+ COUNT_FALSE = 'COUNT_FALSE',
+ PERCENTAGE_EMPTY = 'PERCENTAGE_EMPTY',
+ PERCENTAGE_NOT_EMPTY = 'PERCENTAGE_NOT_EMPTY',
}
diff --git a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/enums/database-event-action.ts b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/enums/database-event-action.ts
index ed5d1705b81..4a4ed09f059 100644
--- a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/enums/database-event-action.ts
+++ b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/enums/database-event-action.ts
@@ -1,7 +1,7 @@
export enum DatabaseEventAction {
- CREATED = 'created',
- UPDATED = 'updated',
- DELETED = 'deleted',
- DESTROYED = 'destroyed',
- RESTORED = 'restored',
+ CREATED = 'CREATED',
+ UPDATED = 'UPDATED',
+ DELETED = 'DELETED',
+ DESTROYED = 'DESTROYED',
+ RESTORED = 'RESTORED',
}
diff --git a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/helpers/process-aggregate.helper.ts b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/helpers/process-aggregate.helper.ts
index a03f6b53410..9842ca1cd3c 100644
--- a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/helpers/process-aggregate.helper.ts
+++ b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/helpers/process-aggregate.helper.ts
@@ -1,9 +1,9 @@
import { Injectable } from '@nestjs/common';
-import { SelectQueryBuilder } from 'typeorm';
import { isDefined } from 'twenty-shared/utils';
+import { SelectQueryBuilder } from 'typeorm';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { AggregationField } from 'src/engine/api/graphql/workspace-schema-builder/utils/get-available-aggregations-from-object-fields.util';
import { formatColumnNamesFromCompositeFieldAndSubfields } from 'src/engine/twenty-orm/utils/format-column-names-from-composite-field-and-subfield.util';
@@ -44,7 +44,7 @@ export class ProcessAggregateHelper {
: columnNames[0];
if (
- !Object.values(AGGREGATE_OPERATIONS).includes(
+ !Object.values(AggregateOperations).includes(
aggregatedField.aggregateOperation,
)
) {
@@ -58,44 +58,44 @@ export class ProcessAggregateHelper {
const columnExpression = `NULLIF(CONCAT(${concatenatedColumns}), '')`;
switch (aggregatedField.aggregateOperation) {
- case AGGREGATE_OPERATIONS.countEmpty:
+ case AggregateOperations.COUNT_EMPTY:
queryBuilder.addSelect(
`CASE WHEN COUNT(*) = 0 THEN NULL ELSE COUNT(*) - COUNT(${columnExpression}) END`,
`${aggregatedFieldName}`,
);
break;
- case AGGREGATE_OPERATIONS.countNotEmpty:
+ case AggregateOperations.COUNT_NOT_EMPTY:
queryBuilder.addSelect(
`CASE WHEN COUNT(*) = 0 THEN NULL ELSE COUNT(${columnExpression}) END`,
`${aggregatedFieldName}`,
);
break;
- case AGGREGATE_OPERATIONS.countUniqueValues:
+ case AggregateOperations.COUNT_UNIQUE_VALUES:
queryBuilder.addSelect(
`CASE WHEN COUNT(*) = 0 THEN NULL ELSE COUNT(DISTINCT ${columnExpression}) END`,
`${aggregatedFieldName}`,
);
break;
- case AGGREGATE_OPERATIONS.percentageEmpty:
+ case AggregateOperations.PERCENTAGE_EMPTY:
queryBuilder.addSelect(
`CASE WHEN COUNT(*) = 0 THEN NULL ELSE CAST(((COUNT(*) - COUNT(${columnExpression})::decimal) / COUNT(*)) AS DECIMAL) END`,
`${aggregatedFieldName}`,
);
break;
- case AGGREGATE_OPERATIONS.percentageNotEmpty:
+ case AggregateOperations.PERCENTAGE_NOT_EMPTY:
queryBuilder.addSelect(
`CASE WHEN COUNT(*) = 0 THEN NULL ELSE CAST((COUNT(${columnExpression})::decimal / COUNT(*)) AS DECIMAL) END`,
`${aggregatedFieldName}`,
);
break;
- case AGGREGATE_OPERATIONS.countTrue:
+ case AggregateOperations.COUNT_TRUE:
queryBuilder.addSelect(
`CASE WHEN COUNT(*) = 0 THEN NULL ELSE COUNT(CASE WHEN ${columnExpression}::boolean = TRUE THEN 1 ELSE NULL END) END`,
`${aggregatedFieldName}`,
);
break;
- case AGGREGATE_OPERATIONS.countFalse:
+ case AggregateOperations.COUNT_FALSE:
queryBuilder.addSelect(
`CASE WHEN COUNT(*) = 0 THEN NULL ELSE COUNT(CASE WHEN ${columnExpression}::boolean = FALSE THEN 1 ELSE NULL END) END`,
`${aggregatedFieldName}`,
diff --git a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/interfaces/base-resolver-service.ts b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/interfaces/base-resolver-service.ts
index 3412e2140c5..80ad60dda06 100644
--- a/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/interfaces/base-resolver-service.ts
+++ b/packages/twenty-server/src/engine/api/graphql/graphql-query-runner/interfaces/base-resolver-service.ts
@@ -94,7 +94,7 @@ export abstract class GraphqlQueryBaseResolverService<
const featureFlagsMap = workspaceDataSource.featureFlagMap;
const isPermissionsV2Enabled =
- featureFlagsMap[FeatureFlagKey.IsPermissionsV2Enabled];
+ featureFlagsMap[FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED];
if (objectMetadataItemWithFieldMaps.isSystem === true) {
await this.validateSystemObjectPermissionsOrThrow(options);
diff --git a/packages/twenty-server/src/engine/api/graphql/metadata.module-factory.ts b/packages/twenty-server/src/engine/api/graphql/metadata.module-factory.ts
index c86eee4d9a5..429e677fd1e 100644
--- a/packages/twenty-server/src/engine/api/graphql/metadata.module-factory.ts
+++ b/packages/twenty-server/src/engine/api/graphql/metadata.module-factory.ts
@@ -49,7 +49,7 @@ export const metadataModuleFactory = async (
}),
};
- if (twentyConfigService.get('NODE_ENV') === NodeEnvironment.development) {
+ if (twentyConfigService.get('NODE_ENV') === NodeEnvironment.DEVELOPMENT) {
config.renderGraphiQL = () => {
return renderApolloPlayground({ path: 'metadata' });
};
diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator.ts
index 83b10fa918e..1bd0454a89f 100644
--- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator.ts
+++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator.ts
@@ -29,7 +29,7 @@ export function WorkspaceQueryHook(
// Default to PreHook
if (!options.type) {
- options.type = WorkspaceQueryHookType.PreHook;
+ options.type = WorkspaceQueryHookType.PRE_HOOK;
}
// eslint-disable-next-line @typescript-eslint/ban-types
diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/types/workspace-query-hook.type.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/types/workspace-query-hook.type.ts
index b75c939d1ac..dc031e8f420 100644
--- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/types/workspace-query-hook.type.ts
+++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/types/workspace-query-hook.type.ts
@@ -14,8 +14,8 @@ import {
} from 'src/engine/api/graphql/workspace-resolver-builder/interfaces/workspace-resolvers-builder.interface';
export enum WorkspaceQueryHookType {
- PreHook = 'PreHook',
- PostHook = 'PostHook',
+ PRE_HOOK = 'PRE_HOOK',
+ POST_HOOK = 'POST_HOOK',
}
export type WorkspacePreQueryHookPayload<T> = T extends 'createMany'
diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/workspace-query-hook.explorer.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/workspace-query-hook.explorer.ts
index 2e5b5b5eecd..f16d0c0eb88 100644
--- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/workspace-query-hook.explorer.ts
+++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-hook/workspace-query-hook.explorer.ts
@@ -201,7 +201,7 @@ export class WorkspaceQueryHookExplorer implements OnModuleInit {
isRequestScoped: boolean,
) {
switch (type) {
- case WorkspaceQueryHookType.PreHook:
+ case WorkspaceQueryHookType.PRE_HOOK:
this.workspaceQueryHookStorage.registerWorkspaceQueryPreHookInstance(
key,
{
@@ -211,7 +211,7 @@ export class WorkspaceQueryHookExplorer implements OnModuleInit {
},
);
break;
- case WorkspaceQueryHookType.PostHook:
+ case WorkspaceQueryHookType.POST_HOOK:
this.workspaceQueryHookStorage.registerWorkspacePostQueryHookInstance(
key,
{
diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/utils/get-available-aggregations-from-object-fields.util.ts b/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/utils/get-available-aggregations-from-object-fields.util.ts
index 5af0264ab3a..0e7e73e71ce 100644
--- a/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/utils/get-available-aggregations-from-object-fields.util.ts
+++ b/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/utils/get-available-aggregations-from-object-fields.util.ts
@@ -1,13 +1,13 @@
import { GraphQLISODateTime } from '@nestjs/graphql';
import { GraphQLFloat, GraphQLInt, GraphQLScalarType } from 'graphql';
-import { capitalize, isFieldMetadataDateKind } from 'twenty-shared/utils';
import { FIELD_FOR_TOTAL_COUNT_AGGREGATE_OPERATION } from 'twenty-shared/constants';
import { FieldMetadataType } from 'twenty-shared/types';
+import { capitalize, isFieldMetadataDateKind } from 'twenty-shared/utils';
import { FieldMetadataInterface } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata.interface';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { getSubfieldsForAggregateOperation } from 'src/engine/twenty-orm/utils/get-subfields-for-aggregate-operation.util';
export type AggregationField = {
@@ -17,7 +17,7 @@ export type AggregationField = {
fromFieldType: FieldMetadataType;
fromSubFields?: string[];
subFieldForNumericOperation?: string;
- aggregateOperation: AGGREGATE_OPERATIONS;
+ aggregateOperation: AggregateOperations;
};
export const getAvailableAggregationsFromObjectFields = (
@@ -37,7 +37,7 @@ export const getAvailableAggregationsFromObjectFields = (
fromField: field.name,
fromFieldType: field.type,
fromSubFields,
- aggregateOperation: AGGREGATE_OPERATIONS.countUniqueValues,
+ aggregateOperation: AggregateOperations.COUNT_UNIQUE_VALUES,
};
acc[`countEmpty${capitalize(field.name)}`] = {
@@ -46,7 +46,7 @@ export const getAvailableAggregationsFromObjectFields = (
fromField: field.name,
fromFieldType: field.type,
fromSubFields,
- aggregateOperation: AGGREGATE_OPERATIONS.countEmpty,
+ aggregateOperation: AggregateOperations.COUNT_EMPTY,
};
acc[`countNotEmpty${capitalize(field.name)}`] = {
@@ -55,7 +55,7 @@ export const getAvailableAggregationsFromObjectFields = (
fromField: field.name,
fromFieldType: field.type,
fromSubFields,
- aggregateOperation: AGGREGATE_OPERATIONS.countNotEmpty,
+ aggregateOperation: AggregateOperations.COUNT_NOT_EMPTY,
};
acc[`percentageEmpty${capitalize(field.name)}`] = {
@@ -64,7 +64,7 @@ export const getAvailableAggregationsFromObjectFields = (
fromField: field.name,
fromFieldType: field.type,
fromSubFields,
- aggregateOperation: AGGREGATE_OPERATIONS.percentageEmpty,
+ aggregateOperation: AggregateOperations.PERCENTAGE_EMPTY,
};
acc[`percentageNotEmpty${capitalize(field.name)}`] = {
@@ -73,7 +73,7 @@ export const getAvailableAggregationsFromObjectFields = (
fromField: field.name,
fromFieldType: field.type,
fromSubFields,
- aggregateOperation: AGGREGATE_OPERATIONS.percentageNotEmpty,
+ aggregateOperation: AggregateOperations.PERCENTAGE_NOT_EMPTY,
};
if (isFieldMetadataDateKind(field.type)) {
@@ -82,7 +82,7 @@ export const getAvailableAggregationsFromObjectFields = (
description: `Earliest date contained in the field ${field.name}`,
fromField: field.name,
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.min,
+ aggregateOperation: AggregateOperations.MIN,
};
acc[`max${capitalize(field.name)}`] = {
@@ -90,7 +90,7 @@ export const getAvailableAggregationsFromObjectFields = (
description: `Latest date contained in the field ${field.name}`,
fromField: field.name,
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.max,
+ aggregateOperation: AggregateOperations.MAX,
};
}
@@ -101,7 +101,7 @@ export const getAvailableAggregationsFromObjectFields = (
description: `Count of true values in the field ${field.name}`,
fromField: field.name,
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.countTrue,
+ aggregateOperation: AggregateOperations.COUNT_TRUE,
};
acc[`countFalse${capitalize(field.name)}`] = {
@@ -109,7 +109,7 @@ export const getAvailableAggregationsFromObjectFields = (
description: `Count of false values in the field ${field.name}`,
fromField: field.name,
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.countFalse,
+ aggregateOperation: AggregateOperations.COUNT_FALSE,
};
break;
@@ -119,7 +119,7 @@ export const getAvailableAggregationsFromObjectFields = (
description: `Minimum amount contained in the field ${field.name}`,
fromField: field.name,
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.min,
+ aggregateOperation: AggregateOperations.MIN,
};
acc[`max${capitalize(field.name)}`] = {
@@ -127,7 +127,7 @@ export const getAvailableAggregationsFromObjectFields = (
description: `Maximum amount contained in the field ${field.name}`,
fromField: field.name,
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.max,
+ aggregateOperation: AggregateOperations.MAX,
};
acc[`avg${capitalize(field.name)}`] = {
@@ -135,7 +135,7 @@ export const getAvailableAggregationsFromObjectFields = (
description: `Average amount contained in the field ${field.name}`,
fromField: field.name,
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.avg,
+ aggregateOperation: AggregateOperations.AVG,
};
acc[`sum${capitalize(field.name)}`] = {
@@ -143,7 +143,7 @@ export const getAvailableAggregationsFromObjectFields = (
description: `Sum of amounts contained in the field ${field.name}`,
fromField: field.name,
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.sum,
+ aggregateOperation: AggregateOperations.SUM,
};
break;
case FieldMetadataType.CURRENCY:
@@ -154,7 +154,7 @@ export const getAvailableAggregationsFromObjectFields = (
fromSubFields: getSubfieldsForAggregateOperation(field.type),
subFieldForNumericOperation: 'amountMicros',
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.min,
+ aggregateOperation: AggregateOperations.MIN,
};
acc[`max${capitalize(field.name)}AmountMicros`] = {
@@ -163,7 +163,7 @@ export const getAvailableAggregationsFromObjectFields = (
fromField: field.name,
fromSubFields: getSubfieldsForAggregateOperation(field.type),
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.max,
+ aggregateOperation: AggregateOperations.MAX,
};
acc[`sum${capitalize(field.name)}AmountMicros`] = {
@@ -172,7 +172,7 @@ export const getAvailableAggregationsFromObjectFields = (
fromField: field.name,
fromSubFields: getSubfieldsForAggregateOperation(field.type),
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.sum,
+ aggregateOperation: AggregateOperations.SUM,
};
acc[`avg${capitalize(field.name)}AmountMicros`] = {
@@ -181,7 +181,7 @@ export const getAvailableAggregationsFromObjectFields = (
fromField: field.name,
fromSubFields: getSubfieldsForAggregateOperation(field.type),
fromFieldType: field.type,
- aggregateOperation: AGGREGATE_OPERATIONS.avg,
+ aggregateOperation: AggregateOperations.AVG,
};
break;
}
@@ -194,7 +194,7 @@ export const getAvailableAggregationsFromObjectFields = (
description: `Total number of records in the connection`,
fromField: FIELD_FOR_TOTAL_COUNT_AGGREGATE_OPERATION,
fromFieldType: FieldMetadataType.UUID,
- aggregateOperation: AGGREGATE_OPERATIONS.count,
+ aggregateOperation: AggregateOperations.COUNT,
},
},
);
diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts
index 9b7117301f3..24658eaa24a 100644
--- a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts
@@ -324,7 +324,7 @@ export class AuthService {
name: 'Chrome Extension',
redirectUrl:
this.twentyConfigService.get('NODE_ENV') ===
- NodeEnvironment.development
+ NodeEnvironment.DEVELOPMENT
? authorizeAppInput.redirectUrl
: `https://${this.twentyConfigService.get(
'CHROME_EXTENSION_ID',
diff --git a/packages/twenty-server/src/engine/core-modules/captcha/captcha.module.ts b/packages/twenty-server/src/engine/core-modules/captcha/captcha.module.ts
index c8547b7949a..674c69997c0 100644
--- a/packages/twenty-server/src/engine/core-modules/captcha/captcha.module.ts
+++ b/packages/twenty-server/src/engine/core-modules/captcha/captcha.module.ts
@@ -1,7 +1,7 @@
import { DynamicModule, Global } from '@nestjs/common';
-import { CAPTCHA_DRIVER } from 'src/engine/core-modules/captcha/constants/captcha-driver.constants';
import { CaptchaService } from 'src/engine/core-modules/captcha/captcha.service';
+import { CAPTCHA_DRIVER } from 'src/engine/core-modules/captcha/constants/captcha-driver.constants';
import { GoogleRecaptchaDriver } from 'src/engine/core-modules/captcha/drivers/google-recaptcha.driver';
import { TurnstileDriver } from 'src/engine/core-modules/captcha/drivers/turnstile.driver';
import {
@@ -23,9 +23,9 @@ export class CaptchaModule {
}
switch (config.type) {
- case CaptchaDriverType.GoogleRecaptcha:
+ case CaptchaDriverType.GOOGLE_RECAPTCHA:
return new GoogleRecaptchaDriver(config.options);
- case CaptchaDriverType.Turnstile:
+ case CaptchaDriverType.TURNSTILE:
return new TurnstileDriver(config.options);
default:
return;
diff --git a/packages/twenty-server/src/engine/core-modules/captcha/interfaces/captcha.interface.ts b/packages/twenty-server/src/engine/core-modules/captcha/interfaces/captcha.interface.ts
index 6688c084ac7..52d14eb3793 100644
--- a/packages/twenty-server/src/engine/core-modules/captcha/interfaces/captcha.interface.ts
+++ b/packages/twenty-server/src/engine/core-modules/captcha/interfaces/captcha.interface.ts
@@ -2,8 +2,8 @@ import { FactoryProvider, ModuleMetadata } from '@nestjs/common';
import { registerEnumType } from '@nestjs/graphql';
export enum CaptchaDriverType {
- GoogleRecaptcha = 'google-recaptcha',
- Turnstile = 'turnstile',
+ GOOGLE_RECAPTCHA = 'GOOGLE_RECAPTCHA',
+ TURNSTILE = 'TURNSTILE',
}
registerEnumType(CaptchaDriverType, {
@@ -16,12 +16,12 @@ export type CaptchaDriverOptions = {
};
export interface GoogleRecaptchaDriverFactoryOptions {
- type: CaptchaDriverType.GoogleRecaptcha;
+ type: CaptchaDriverType.GOOGLE_RECAPTCHA;
options: CaptchaDriverOptions;
}
export interface TurnstileDriverFactoryOptions {
- type: CaptchaDriverType.Turnstile;
+ type: CaptchaDriverType.TURNSTILE;
options: CaptchaDriverOptions;
}
diff --git a/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.spec.ts b/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.spec.ts
index becdcadf5c8..f764f94f2b3 100644
--- a/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.spec.ts
@@ -61,13 +61,13 @@ describe('ClientConfigService', () => {
IS_MULTIWORKSPACE_ENABLED: true,
IS_EMAIL_VERIFICATION_REQUIRED: true,
DEFAULT_SUBDOMAIN: 'app',
- NODE_ENV: NodeEnvironment.development,
- SUPPORT_DRIVER: SupportDriver.Front,
+ NODE_ENV: NodeEnvironment.DEVELOPMENT,
+ SUPPORT_DRIVER: SupportDriver.FRONT,
SUPPORT_FRONT_CHAT_ID: 'chat-123',
SENTRY_ENVIRONMENT: 'development',
APP_VERSION: '1.0.0',
SENTRY_FRONT_DSN: 'https://sentry.example.com',
- CAPTCHA_DRIVER: CaptchaDriverType.GoogleRecaptcha,
+ CAPTCHA_DRIVER: CaptchaDriverType.GOOGLE_RECAPTCHA,
CAPTCHA_SITE_KEY: 'site-key-123',
CHROME_EXTENSION_ID: 'extension-123',
MUTATION_MAXIMUM_AFFECTED_RECORDS: 1000,
@@ -120,7 +120,7 @@ describe('ClientConfigService', () => {
frontDomain: 'app.twenty.com',
debugMode: true,
support: {
- supportDriver: 'Front',
+ supportDriver: 'FRONT',
supportFrontChatId: 'chat-123',
},
sentry: {
@@ -129,7 +129,7 @@ describe('ClientConfigService', () => {
dsn: 'https://sentry.example.com',
},
captcha: {
- provider: 'GoogleRecaptcha',
+ provider: 'GOOGLE_RECAPTCHA',
siteKey: 'site-key-123',
},
chromeExtensionId: 'extension-123',
@@ -152,7 +152,7 @@ describe('ClientConfigService', () => {
jest
.spyOn(twentyConfigService, 'get')
.mockImplementation((key: string) => {
- if (key === 'NODE_ENV') return NodeEnvironment.production;
+ if (key === 'NODE_ENV') return NodeEnvironment.PRODUCTION;
if (key === 'IS_BILLING_ENABLED') return false;
return undefined;
@@ -191,14 +191,14 @@ describe('ClientConfigService', () => {
const result = await service.getClientConfig();
- expect(result.support.supportDriver).toBe(SupportDriver.None);
+ expect(result.support.supportDriver).toBe(SupportDriver.NONE);
});
it('should handle billing enabled with feature flags', async () => {
jest
.spyOn(twentyConfigService, 'get')
.mockImplementation((key: string) => {
- if (key === 'NODE_ENV') return NodeEnvironment.production;
+ if (key === 'NODE_ENV') return NodeEnvironment.PRODUCTION;
if (key === 'IS_BILLING_ENABLED') return true;
return undefined;
@@ -209,44 +209,4 @@ describe('ClientConfigService', () => {
expect(result.canManageFeatureFlags).toBe(true);
});
});
-
- describe('transformEnum', () => {
- it('should transform enum by direct key match', () => {
- const result = (service as any).transformEnum(
- 'GoogleRecaptcha',
- CaptchaDriverType,
- );
-
- expect(result).toBe(CaptchaDriverType.GoogleRecaptcha);
- });
-
- it('should transform enum by value match', () => {
- const result = (service as any).transformEnum(
- 'google-recaptcha',
- CaptchaDriverType,
- );
-
- expect(result).toBe('GoogleRecaptcha');
- });
-
- it('should transform SupportDriver enum correctly', () => {
- const result = (service as any).transformEnum('front', SupportDriver);
-
- expect(result).toBe('Front');
- });
-
- it('should throw error for unknown enum value', () => {
- expect(() => {
- (service as any).transformEnum('unknown-value', CaptchaDriverType);
- }).toThrow(
- 'Unknown enum value: unknown-value. Available keys: GoogleRecaptcha, Turnstile. Available values: google-recaptcha, turnstile',
- );
- });
-
- it('should handle direct key match for SupportDriver', () => {
- const result = (service as any).transformEnum('Front', SupportDriver);
-
- expect(result).toBe(SupportDriver.Front);
- });
- });
});
diff --git a/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.ts b/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.ts
index c8e5a3e6473..4af6aa7bbec 100644
--- a/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.ts
@@ -3,7 +3,6 @@ import { Injectable } from '@nestjs/common';
import { NodeEnvironment } from 'src/engine/core-modules/twenty-config/interfaces/node-environment.interface';
import { SupportDriver } from 'src/engine/core-modules/twenty-config/interfaces/support.interface';
-import { CaptchaDriverType } from 'src/engine/core-modules/captcha/interfaces';
import { ClientConfig } from 'src/engine/core-modules/client-config/client-config.entity';
import { DomainManagerService } from 'src/engine/core-modules/domain-manager/services/domain-manager.service';
import { PUBLIC_FEATURE_FLAGS } from 'src/engine/core-modules/feature-flag/constants/public-feature-flag.const';
@@ -57,11 +56,9 @@ export class ClientConfigService {
frontDomain: this.domainManagerService.getFrontUrl().hostname,
debugMode:
this.twentyConfigService.get('NODE_ENV') ===
- NodeEnvironment.development,
+ NodeEnvironment.DEVELOPMENT,
support: {
- supportDriver: supportDriver
- ? this.transformEnum(supportDriver, SupportDriver)
- : SupportDriver.None,
+ supportDriver: supportDriver ? supportDriver : SupportDriver.NONE,
supportFrontChatId: this.twentyConfigService.get(
'SUPPORT_FRONT_CHAT_ID',
),
@@ -72,9 +69,7 @@ export class ClientConfigService {
dsn: this.twentyConfigService.get('SENTRY_FRONT_DSN'),
},
captcha: {
- provider: captchaProvider
- ? this.transformEnum(captchaProvider, CaptchaDriverType)
- : undefined,
+ provider: captchaProvider ? captchaProvider : undefined,
siteKey: this.twentyConfigService.get('CAPTCHA_SITE_KEY'),
},
chromeExtensionId: this.twentyConfigService.get('CHROME_EXTENSION_ID'),
@@ -89,7 +84,7 @@ export class ClientConfigService {
analyticsEnabled: this.twentyConfigService.get('ANALYTICS_ENABLED'),
canManageFeatureFlags:
this.twentyConfigService.get('NODE_ENV') ===
- NodeEnvironment.development ||
+ NodeEnvironment.DEVELOPMENT ||
this.twentyConfigService.get('IS_BILLING_ENABLED'),
publicFeatureFlags: PUBLIC_FEATURE_FLAGS,
isMicrosoftMessagingEnabled: this.twentyConfigService.get(
@@ -111,34 +106,4 @@ export class ClientConfigService {
return clientConfig;
}
-
- // GraphQL enum values are in PascalCase, but the config values are in kebab-case
- // This function transforms the config values, the same way GraphQL does
- private transformEnum<T extends Record<string, string>>(
- value: string,
- enumObject: T,
- ): T[keyof T] {
- const directMatch = Object.keys(enumObject).find(
- (key) => key === value,
- ) as keyof T;
-
- if (directMatch) {
- return enumObject[directMatch];
- }
-
- const valueMatch = Object.entries(enumObject).find(
- ([, enumValue]) => enumValue === value,
- );
-
- if (valueMatch) {
- return valueMatch[0] as T[keyof T];
- }
-
- const availableKeys = Object.keys(enumObject);
- const availableValues = Object.values(enumObject);
-
- throw new Error(
- `Unknown enum value: ${value}. Available keys: ${availableKeys.join(', ')}. Available values: ${availableValues.join(', ')}`,
- );
- }
}
diff --git a/packages/twenty-server/src/engine/core-modules/email/__tests__/email-driver.factory.spec.ts b/packages/twenty-server/src/engine/core-modules/email/__tests__/email-driver.factory.spec.ts
index e94027eae25..fb551cc4223 100644
--- a/packages/twenty-server/src/engine/core-modules/email/__tests__/email-driver.factory.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/email/__tests__/email-driver.factory.spec.ts
@@ -33,7 +33,7 @@ describe('EmailDriverFactory', () => {
it('should return "logger" for logger driver', () => {
jest
.spyOn(twentyConfigService, 'get')
- .mockReturnValue(EmailDriver.Logger);
+ .mockReturnValue(EmailDriver.LOGGER);
const result = factory['buildConfigKey']();
@@ -42,7 +42,7 @@ describe('EmailDriverFactory', () => {
});
it('should return smtp config key for smtp driver', () => {
- jest.spyOn(twentyConfigService, 'get').mockReturnValue(EmailDriver.Smtp);
+ jest.spyOn(twentyConfigService, 'get').mockReturnValue(EmailDriver.SMTP);
jest
.spyOn(factory as any, 'getConfigGroupHash')
.mockReturnValue('smtp-hash-123');
@@ -66,7 +66,7 @@ describe('EmailDriverFactory', () => {
it('should create logger driver', () => {
jest
.spyOn(twentyConfigService, 'get')
- .mockReturnValue(EmailDriver.Logger);
+ .mockReturnValue(EmailDriver.LOGGER);
const driver = factory['createDriver']();
@@ -80,7 +80,7 @@ describe('EmailDriverFactory', () => {
.mockImplementation((key: string) => {
switch (key) {
case 'EMAIL_DRIVER':
- return EmailDriver.Smtp;
+ return EmailDriver.SMTP;
case 'EMAIL_SMTP_HOST':
return 'smtp.example.com';
case 'EMAIL_SMTP_PORT':
@@ -108,7 +108,7 @@ describe('EmailDriverFactory', () => {
.mockImplementation((key: string) => {
switch (key) {
case 'EMAIL_DRIVER':
- return EmailDriver.Smtp;
+ return EmailDriver.SMTP;
case 'EMAIL_SMTP_HOST':
return undefined;
case 'EMAIL_SMTP_PORT':
@@ -136,7 +136,7 @@ describe('EmailDriverFactory', () => {
it('should return current driver for logger', () => {
jest
.spyOn(twentyConfigService, 'get')
- .mockReturnValue(EmailDriver.Logger);
+ .mockReturnValue(EmailDriver.LOGGER);
const driver = factory.getCurrentDriver();
@@ -147,7 +147,7 @@ describe('EmailDriverFactory', () => {
it('should reuse driver when config key unchanged', () => {
jest
.spyOn(twentyConfigService, 'get')
- .mockReturnValue(EmailDriver.Logger);
+ .mockReturnValue(EmailDriver.LOGGER);
const driver1 = factory.getCurrentDriver();
const driver2 = factory.getCurrentDriver();
@@ -159,7 +159,7 @@ describe('EmailDriverFactory', () => {
// First call with logger
jest
.spyOn(twentyConfigService, 'get')
- .mockReturnValue(EmailDriver.Logger);
+ .mockReturnValue(EmailDriver.LOGGER);
const driver1 = factory.getCurrentDriver();
@@ -169,7 +169,7 @@ describe('EmailDriverFactory', () => {
.mockImplementation((key: string) => {
switch (key) {
case 'EMAIL_DRIVER':
- return EmailDriver.Smtp;
+ return EmailDriver.SMTP;
case 'EMAIL_SMTP_HOST':
return 'smtp.example.com';
case 'EMAIL_SMTP_PORT':
@@ -203,7 +203,7 @@ describe('EmailDriverFactory', () => {
.mockImplementation((key: string) => {
switch (key) {
case 'EMAIL_DRIVER':
- return EmailDriver.Smtp;
+ return EmailDriver.SMTP;
case 'EMAIL_SMTP_HOST':
return 'smtp.example.com';
case 'EMAIL_SMTP_PORT':
diff --git a/packages/twenty-server/src/engine/core-modules/email/email-driver.factory.ts b/packages/twenty-server/src/engine/core-modules/email/email-driver.factory.ts
index cb67404ebcc..3b4524e6903 100644
--- a/packages/twenty-server/src/engine/core-modules/email/email-driver.factory.ts
+++ b/packages/twenty-server/src/engine/core-modules/email/email-driver.factory.ts
@@ -18,11 +18,11 @@ export class EmailDriverFactory extends DriverFactoryBase<EmailDriverInterface>
protected buildConfigKey(): string {
const driver = this.twentyConfigService.get('EMAIL_DRIVER');
- if (driver === EmailDriver.Logger) {
+ if (driver === EmailDriver.LOGGER) {
return 'logger';
}
- if (driver === EmailDriver.Smtp) {
+ if (driver === EmailDriver.SMTP) {
const emailConfigHash = this.getConfigGroupHash(
ConfigVariablesGroup.EmailSettings,
);
@@ -37,10 +37,10 @@ export class EmailDriverFactory extends DriverFactoryBase<EmailDriverInterface>
const driver = this.twentyConfigService.get('EMAIL_DRIVER');
switch (driver) {
- case EmailDriver.Logger:
+ case EmailDriver.LOGGER:
return new LoggerDriver();
- case EmailDriver.Smtp: {
+ case EmailDriver.SMTP: {
const host = this.twentyConfigService.get('EMAIL_SMTP_HOST');
const port = this.twentyConfigService.get('EMAIL_SMTP_PORT');
const user = this.twentyConfigService.get('EMAIL_SMTP_USER');
diff --git a/packages/twenty-server/src/engine/core-modules/email/enums/email-driver.enum.ts b/packages/twenty-server/src/engine/core-modules/email/enums/email-driver.enum.ts
index bfccea43539..62f8b0a8c29 100644
--- a/packages/twenty-server/src/engine/core-modules/email/enums/email-driver.enum.ts
+++ b/packages/twenty-server/src/engine/core-modules/email/enums/email-driver.enum.ts
@@ -1,4 +1,4 @@
export enum EmailDriver {
- Logger = 'logger',
- Smtp = 'smtp',
+ LOGGER = 'LOGGER',
+ SMTP = 'SMTP',
}
diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-factory.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-factory.ts
index 66757461706..afb1ba3afcd 100644
--- a/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-factory.ts
+++ b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module-factory.ts
@@ -19,21 +19,21 @@ export const exceptionHandlerModuleFactory = async (
const driverType = twentyConfigService.get('EXCEPTION_HANDLER_DRIVER');
switch (driverType) {
- case ExceptionHandlerDriver.Console: {
+ case ExceptionHandlerDriver.CONSOLE: {
return {
- type: ExceptionHandlerDriver.Console,
+ type: ExceptionHandlerDriver.CONSOLE,
};
}
- case ExceptionHandlerDriver.Sentry: {
+ case ExceptionHandlerDriver.SENTRY: {
return {
- type: ExceptionHandlerDriver.Sentry,
+ type: ExceptionHandlerDriver.SENTRY,
options: {
environment: twentyConfigService.get('SENTRY_ENVIRONMENT'),
release: twentyConfigService.get('APP_VERSION'),
dsn: twentyConfigService.get('SENTRY_DSN') ?? '',
serverInstance: adapterHost.httpAdapter?.getInstance(),
debug:
- twentyConfigService.get('NODE_ENV') === NodeEnvironment.development,
+ twentyConfigService.get('NODE_ENV') === NodeEnvironment.DEVELOPMENT,
},
};
}
diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts
index 0ce3c730a81..b2646ea4edf 100644
--- a/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts
+++ b/packages/twenty-server/src/engine/core-modules/exception-handler/exception-handler.module.ts
@@ -22,7 +22,7 @@ export class ExceptionHandlerModule extends ConfigurableModuleClass {
const provider = {
provide: EXCEPTION_HANDLER_DRIVER,
useValue:
- options.type === ExceptionHandlerDriver.Console
+ options.type === ExceptionHandlerDriver.CONSOLE
? new ExceptionHandlerConsoleDriver()
: new ExceptionHandlerSentryDriver(),
};
@@ -45,7 +45,7 @@ export class ExceptionHandlerModule extends ConfigurableModuleClass {
return null;
}
- return config.type === ExceptionHandlerDriver.Console
+ return config.type === ExceptionHandlerDriver.CONSOLE
? new ExceptionHandlerConsoleDriver()
: new ExceptionHandlerSentryDriver();
},
diff --git a/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler.interface.ts b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler.interface.ts
index 431cbe4b986..9ee10a8c231 100644
--- a/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler.interface.ts
+++ b/packages/twenty-server/src/engine/core-modules/exception-handler/interfaces/exception-handler.interface.ts
@@ -1,12 +1,12 @@
import { Router } from 'express';
export enum ExceptionHandlerDriver {
- Sentry = 'sentry',
- Console = 'console',
+ SENTRY = 'SENTRY',
+ CONSOLE = 'CONSOLE',
}
export interface ExceptionHandlerSentryDriverFactoryOptions {
- type: ExceptionHandlerDriver.Sentry;
+ type: ExceptionHandlerDriver.SENTRY;
options: {
environment?: string;
release?: string;
@@ -17,7 +17,7 @@ export interface ExceptionHandlerSentryDriverFactoryOptions {
}
export interface ExceptionHandlerDriverFactoryOptions {
- type: ExceptionHandlerDriver.Console;
+ type: ExceptionHandlerDriver.CONSOLE;
}
export type ExceptionHandlerModuleOptions =
diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts
index 8d231c5f395..2505b6cf2bf 100644
--- a/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts
+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/constants/public-feature-flag.const.ts
@@ -7,16 +7,13 @@ type FeatureFlagMetadata = {
};
export type PublicFeatureFlag = {
- key: Extract<
- FeatureFlagKey,
- FeatureFlagKey.IsWorkflowEnabled | FeatureFlagKey.IsCustomDomainEnabled
- >;
+ key: Extract<FeatureFlagKey, FeatureFlagKey.IS_WORKFLOW_ENABLED>;
metadata: FeatureFlagMetadata;
};
export const PUBLIC_FEATURE_FLAGS: PublicFeatureFlag[] = [
{
- key: FeatureFlagKey.IsWorkflowEnabled,
+ key: FeatureFlagKey.IS_WORKFLOW_ENABLED,
metadata: {
label: 'Workflows',
description: 'Create custom workflows to automate your work.',
@@ -25,15 +22,9 @@ export const PUBLIC_FEATURE_FLAGS: PublicFeatureFlag[] = [
},
...(process.env.CLOUDFLARE_API_KEY
? [
- {
- key: FeatureFlagKey.IsCustomDomainEnabled as PublicFeatureFlag['key'],
- metadata: {
- label: 'Custom Domain',
- description: 'Customize your workspace URL with your own domain.',
- imagePath:
- 'https://twenty.com/images/lab/is-custom-domain-enabled.png',
- },
- },
+ // {
+ // Here you can add cloud only feature flags
+ // },
]
: []),
];
diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts
index 94dc6765e7d..eff31f48482 100644
--- a/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts
+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts
@@ -1,11 +1,10 @@
export enum FeatureFlagKey {
- IsAirtableIntegrationEnabled = 'IS_AIRTABLE_INTEGRATION_ENABLED',
- IsPostgreSQLIntegrationEnabled = 'IS_POSTGRESQL_INTEGRATION_ENABLED',
- IsStripeIntegrationEnabled = 'IS_STRIPE_INTEGRATION_ENABLED',
- IsCopilotEnabled = 'IS_COPILOT_ENABLED',
- IsWorkflowEnabled = 'IS_WORKFLOW_ENABLED',
- IsUniqueIndexesEnabled = 'IS_UNIQUE_INDEXES_ENABLED',
- IsJsonFilterEnabled = 'IS_JSON_FILTER_ENABLED',
- IsCustomDomainEnabled = 'IS_CUSTOM_DOMAIN_ENABLED',
- IsPermissionsV2Enabled = 'IS_PERMISSIONS_V2_ENABLED',
+ IS_AIRTABLE_INTEGRATION_ENABLED = 'IS_AIRTABLE_INTEGRATION_ENABLED',
+ IS_POSTGRESQL_INTEGRATION_ENABLED = 'IS_POSTGRESQL_INTEGRATION_ENABLED',
+ IS_STRIPE_INTEGRATION_ENABLED = 'IS_STRIPE_INTEGRATION_ENABLED',
+ IS_COPILOT_ENABLED = 'IS_COPILOT_ENABLED',
+ IS_WORKFLOW_ENABLED = 'IS_WORKFLOW_ENABLED',
+ IS_UNIQUE_INDEXES_ENABLED = 'IS_UNIQUE_INDEXES_ENABLED',
+ IS_JSON_FILTER_ENABLED = 'IS_JSON_FILTER_ENABLED',
+ IS_PERMISSIONS_V2_ENABLED = 'IS_PERMISSIONS_V2_ENABLED',
}
diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/services/__tests__/feature-flag.service.spec.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/services/__tests__/feature-flag.service.spec.ts
index efbadedfc7d..2c1f8fcbd7b 100644
--- a/packages/twenty-server/src/engine/core-modules/feature-flag/services/__tests__/feature-flag.service.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/services/__tests__/feature-flag.service.spec.ts
@@ -36,7 +36,7 @@ describe('FeatureFlagService', () => {
};
const workspaceId = 'workspace-id';
- const featureFlag = FeatureFlagKey.IsWorkflowEnabled;
+ const featureFlag = FeatureFlagKey.IS_WORKFLOW_ENABLED;
beforeEach(async () => {
jest.clearAllMocks();
@@ -121,13 +121,13 @@ describe('FeatureFlagService', () => {
// Prepare
mockWorkspaceFeatureFlagsMapCacheService.getWorkspaceFeatureFlagsMap.mockResolvedValue(
{
- [FeatureFlagKey.IsWorkflowEnabled]: true,
- [FeatureFlagKey.IsCopilotEnabled]: false,
+ [FeatureFlagKey.IS_WORKFLOW_ENABLED]: true,
+ [FeatureFlagKey.IS_COPILOT_ENABLED]: false,
},
);
const mockFeatureFlags = [
- { key: FeatureFlagKey.IsWorkflowEnabled, value: true },
- { key: FeatureFlagKey.IsCopilotEnabled, value: false },
+ { key: FeatureFlagKey.IS_WORKFLOW_ENABLED, value: true },
+ { key: FeatureFlagKey.IS_COPILOT_ENABLED, value: false },
];
// Act
@@ -145,8 +145,8 @@ describe('FeatureFlagService', () => {
it('should return a map of feature flags for a workspace', async () => {
// Prepare
const mockFeatureFlags = [
- { key: FeatureFlagKey.IsWorkflowEnabled, value: true, workspaceId },
- { key: FeatureFlagKey.IsCopilotEnabled, value: false, workspaceId },
+ { key: FeatureFlagKey.IS_WORKFLOW_ENABLED, value: true, workspaceId },
+ { key: FeatureFlagKey.IS_COPILOT_ENABLED, value: false, workspaceId },
];
mockFeatureFlagRepository.find.mockResolvedValue(mockFeatureFlags);
@@ -156,8 +156,8 @@ describe('FeatureFlagService', () => {
// Assert
expect(result).toEqual({
- [FeatureFlagKey.IsWorkflowEnabled]: true,
- [FeatureFlagKey.IsCopilotEnabled]: false,
+ [FeatureFlagKey.IS_WORKFLOW_ENABLED]: true,
+ [FeatureFlagKey.IS_COPILOT_ENABLED]: false,
});
});
});
@@ -166,8 +166,8 @@ describe('FeatureFlagService', () => {
it('should enable multiple feature flags for a workspace', async () => {
// Prepare
const keys = [
- FeatureFlagKey.IsWorkflowEnabled,
- FeatureFlagKey.IsCopilotEnabled,
+ FeatureFlagKey.IS_WORKFLOW_ENABLED,
+ FeatureFlagKey.IS_COPILOT_ENABLED,
];
mockFeatureFlagRepository.upsert.mockResolvedValue({});
@@ -212,7 +212,6 @@ describe('FeatureFlagService', () => {
// Assert
expect(result).toEqual(mockFeatureFlag);
expect(mockFeatureFlagRepository.save).toHaveBeenCalledWith({
- // @ts-expect-error legacy noImplicitAny
key: FeatureFlagKey[featureFlag],
value,
workspaceId,
diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/services/feature-flag.service.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/services/feature-flag.service.ts
index e42e1a04587..2948ebdb62c 100644
--- a/packages/twenty-server/src/engine/core-modules/feature-flag/services/feature-flag.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/services/feature-flag.service.ts
@@ -99,12 +99,9 @@ export class FeatureFlagService {
),
);
- // @ts-expect-error legacy noImplicitAny
- const featureFlagKey = FeatureFlagKey[featureFlag];
-
if (shouldBePublic) {
publicFeatureFlagValidator.assertIsPublicFeatureFlag(
- featureFlagKey,
+ featureFlag,
new FeatureFlagException(
'Invalid feature flag key, flag is not public',
FeatureFlagExceptionCode.INVALID_FEATURE_FLAG_KEY,
@@ -114,7 +111,7 @@ export class FeatureFlagService {
const existingFeatureFlag = await this.featureFlagRepository.findOne({
where: {
- key: featureFlagKey,
+ key: featureFlag,
workspaceId: workspaceId,
},
});
@@ -125,7 +122,7 @@ export class FeatureFlagService {
value,
}
: {
- key: featureFlagKey,
+ key: featureFlag,
value,
workspaceId: workspaceId,
};
diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/validates/feature-flag.validate.spec.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/validates/feature-flag.validate.spec.ts
index 19286d646dd..919f8e49613 100644
--- a/packages/twenty-server/src/engine/core-modules/feature-flag/validates/feature-flag.validate.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/feature-flag/validates/feature-flag.validate.spec.ts
@@ -1,12 +1,12 @@
-import { CustomException } from 'src/utils/custom-exception';
import { featureFlagValidator } from 'src/engine/core-modules/feature-flag/validates/feature-flag.validate';
+import { CustomException } from 'src/utils/custom-exception';
describe('featureFlagValidator', () => {
describe('assertIsFeatureFlagKey', () => {
it('should not throw error if featureFlagKey is valid', () => {
expect(() =>
featureFlagValidator.assertIsFeatureFlagKey(
- 'IsWorkflowEnabled',
+ 'IS_WORKFLOW_ENABLED',
new CustomException('Error', 'Error'),
),
).not.toThrow();
diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/__tests__/file-storage-driver.factory.spec.ts b/packages/twenty-server/src/engine/core-modules/file-storage/__tests__/file-storage-driver.factory.spec.ts
index 6a6c73c56a1..f65779cf013 100644
--- a/packages/twenty-server/src/engine/core-modules/file-storage/__tests__/file-storage-driver.factory.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/file-storage/__tests__/file-storage-driver.factory.spec.ts
@@ -37,7 +37,7 @@ describe('FileStorageDriverFactory', () => {
jest
.spyOn(twentyConfigService, 'get')
.mockImplementation((key: string) => {
- if (key === 'STORAGE_TYPE') return StorageDriverType.Local;
+ if (key === 'STORAGE_TYPE') return StorageDriverType.LOCAL;
if (key === 'STORAGE_LOCAL_PATH') return storagePath;
return undefined;
@@ -55,7 +55,7 @@ describe('FileStorageDriverFactory', () => {
it('should build config key for S3 storage', () => {
jest
.spyOn(twentyConfigService, 'get')
- .mockReturnValue(StorageDriverType.S3);
+ .mockReturnValue(StorageDriverType.S_3);
jest
.spyOn(factory as any, 'getConfigGroupHash')
.mockReturnValue('s3-hash-123');
@@ -84,7 +84,7 @@ describe('FileStorageDriverFactory', () => {
jest
.spyOn(twentyConfigService, 'get')
.mockImplementation((key: string) => {
- if (key === 'STORAGE_TYPE') return StorageDriverType.Local;
+ if (key === 'STORAGE_TYPE') return StorageDriverType.LOCAL;
if (key === 'STORAGE_LOCAL_PATH') return storagePath;
return undefined;
@@ -102,7 +102,7 @@ describe('FileStorageDriverFactory', () => {
.mockImplementation((key: string) => {
switch (key) {
case 'STORAGE_TYPE':
- return StorageDriverType.S3;
+ return StorageDriverType.S_3;
case 'STORAGE_S3_NAME':
return 'test-bucket';
case 'STORAGE_S3_ENDPOINT':
@@ -130,7 +130,7 @@ describe('FileStorageDriverFactory', () => {
.mockImplementation((key: string) => {
switch (key) {
case 'STORAGE_TYPE':
- return StorageDriverType.S3;
+ return StorageDriverType.S_3;
case 'STORAGE_S3_NAME':
return 'test-bucket';
case 'STORAGE_S3_ENDPOINT':
@@ -168,7 +168,7 @@ describe('FileStorageDriverFactory', () => {
jest
.spyOn(twentyConfigService, 'get')
.mockImplementation((key: string) => {
- if (key === 'STORAGE_TYPE') return StorageDriverType.Local;
+ if (key === 'STORAGE_TYPE') return StorageDriverType.LOCAL;
if (key === 'STORAGE_LOCAL_PATH') return storagePath;
return undefined;
@@ -186,7 +186,7 @@ describe('FileStorageDriverFactory', () => {
jest
.spyOn(twentyConfigService, 'get')
.mockImplementation((key: string) => {
- if (key === 'STORAGE_TYPE') return StorageDriverType.Local;
+ if (key === 'STORAGE_TYPE') return StorageDriverType.LOCAL;
if (key === 'STORAGE_LOCAL_PATH') return storagePath;
return undefined;
@@ -203,7 +203,7 @@ describe('FileStorageDriverFactory', () => {
jest
.spyOn(twentyConfigService, 'get')
.mockImplementation((key: string) => {
- if (key === 'STORAGE_TYPE') return StorageDriverType.Local;
+ if (key === 'STORAGE_TYPE') return StorageDriverType.LOCAL;
if (key === 'STORAGE_LOCAL_PATH') return '/tmp/storage1';
return undefined;
@@ -215,7 +215,7 @@ describe('FileStorageDriverFactory', () => {
jest
.spyOn(twentyConfigService, 'get')
.mockImplementation((key: string) => {
- if (key === 'STORAGE_TYPE') return StorageDriverType.Local;
+ if (key === 'STORAGE_TYPE') return StorageDriverType.LOCAL;
if (key === 'STORAGE_LOCAL_PATH') return '/tmp/storage2';
return undefined;
@@ -233,7 +233,7 @@ describe('FileStorageDriverFactory', () => {
jest
.spyOn(twentyConfigService, 'get')
.mockImplementation((key: string) => {
- if (key === 'STORAGE_TYPE') return StorageDriverType.Local;
+ if (key === 'STORAGE_TYPE') return StorageDriverType.LOCAL;
if (key === 'STORAGE_LOCAL_PATH') return '/tmp/storage';
return undefined;
@@ -247,7 +247,7 @@ describe('FileStorageDriverFactory', () => {
.mockImplementation((key: string) => {
switch (key) {
case 'STORAGE_TYPE':
- return StorageDriverType.S3;
+ return StorageDriverType.S_3;
case 'STORAGE_S3_NAME':
return 'test-bucket';
case 'STORAGE_S3_ENDPOINT':
@@ -285,7 +285,7 @@ describe('FileStorageDriverFactory', () => {
jest
.spyOn(twentyConfigService, 'get')
.mockImplementation((key: string) => {
- if (key === 'STORAGE_TYPE') return StorageDriverType.Local;
+ if (key === 'STORAGE_TYPE') return StorageDriverType.LOCAL;
if (key === 'STORAGE_LOCAL_PATH') return storagePath;
return undefined;
diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/file-storage-driver.factory.ts b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage-driver.factory.ts
index c5e323bceff..6979dfdc198 100644
--- a/packages/twenty-server/src/engine/core-modules/file-storage/file-storage-driver.factory.ts
+++ b/packages/twenty-server/src/engine/core-modules/file-storage/file-storage-driver.factory.ts
@@ -21,13 +21,13 @@ export class FileStorageDriverFactory extends DriverFactoryBase<StorageDriver> {
protected buildConfigKey(): string {
const storageType = this.twentyConfigService.get('STORAGE_TYPE');
- if (storageType === StorageDriverType.Local) {
+ if (storageType === StorageDriverType.LOCAL) {
const storagePath = this.twentyConfigService.get('STORAGE_LOCAL_PATH');
return `local|${storagePath}`;
}
- if (storageType === StorageDriverType.S3) {
+ if (storageType === StorageDriverType.S_3) {
const storageConfigHash = this.getConfigGroupHash(
ConfigVariablesGroup.StorageConfig,
);
@@ -42,7 +42,7 @@ export class FileStorageDriverFactory extends DriverFactoryBase<StorageDriver> {
const storageType = this.twentyConfigService.get('STORAGE_TYPE');
switch (storageType) {
- case StorageDriverType.Local: {
+ case StorageDriverType.LOCAL: {
const storagePath = this.twentyConfigService.get('STORAGE_LOCAL_PATH');
return new LocalDriver({
@@ -50,7 +50,7 @@ export class FileStorageDriverFactory extends DriverFactoryBase<StorageDriver> {
});
}
- case StorageDriverType.S3: {
+ case StorageDriverType.S_3: {
const bucketName = this.twentyConfigService.get('STORAGE_S3_NAME');
const endpoint = this.twentyConfigService.get('STORAGE_S3_ENDPOINT');
const region = this.twentyConfigService.get('STORAGE_S3_REGION');
diff --git a/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage.interface.ts b/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage.interface.ts
index f36162f30df..e3bb16f3512 100644
--- a/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage.interface.ts
+++ b/packages/twenty-server/src/engine/core-modules/file-storage/interfaces/file-storage.interface.ts
@@ -1,4 +1,4 @@
export enum StorageDriverType {
- S3 = 's3',
- Local = 'local',
+ S_3 = 'S_3',
+ LOCAL = 'LOCAL',
}
diff --git a/packages/twenty-server/src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface.ts b/packages/twenty-server/src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface.ts
index bb67a7e228e..af0789e61b7 100644
--- a/packages/twenty-server/src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface.ts
+++ b/packages/twenty-server/src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface.ts
@@ -1,7 +1,7 @@
-import { ModuleMetadata, FactoryProvider } from '@nestjs/common';
+import { FactoryProvider, ModuleMetadata } from '@nestjs/common';
export enum LLMChatModelDriver {
- OpenAI = 'openai',
+ OPENAI = 'OPENAI',
}
export interface LLMChatModelModuleOptions {
diff --git a/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module-factory.ts b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module-factory.ts
index ca52375ace6..5ca60e4381e 100644
--- a/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module-factory.ts
+++ b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module-factory.ts
@@ -8,8 +8,8 @@ export const llmChatModelModuleFactory = (
const driver = twentyConfigService.get('LLM_CHAT_MODEL_DRIVER');
switch (driver) {
- case LLMChatModelDriver.OpenAI: {
- return { type: LLMChatModelDriver.OpenAI };
+ case LLMChatModelDriver.OPENAI: {
+ return { type: LLMChatModelDriver.OPENAI };
}
default:
// `No LLM chat model driver (${driver})`);
diff --git a/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module.ts b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module.ts
index 148cde990c0..ea2276bb8d3 100644
--- a/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module.ts
+++ b/packages/twenty-server/src/engine/core-modules/llm-chat-model/llm-chat-model.module.ts
@@ -5,8 +5,8 @@ import {
LLMChatModelModuleAsyncOptions,
} from 'src/engine/core-modules/llm-chat-model/interfaces/llm-chat-model.interface';
-import { LLM_CHAT_MODEL_DRIVER } from 'src/engine/core-modules/llm-chat-model/llm-chat-model.constants';
import { OpenAIDriver } from 'src/engine/core-modules/llm-chat-model/drivers/openai.driver';
+import { LLM_CHAT_MODEL_DRIVER } from 'src/engine/core-modules/llm-chat-model/llm-chat-model.constants';
import { LLMChatModelService } from 'src/engine/core-modules/llm-chat-model/llm-chat-model.service';
@Global()
@@ -19,7 +19,7 @@ export class LLMChatModelModule {
const config = options.useFactory(...args);
switch (config?.type) {
- case LLMChatModelDriver.OpenAI: {
+ case LLMChatModelDriver.OPENAI: {
return new OpenAIDriver();
}
}
diff --git a/packages/twenty-server/src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface.ts
index 1195d501427..787defa7b40 100644
--- a/packages/twenty-server/src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface.ts
+++ b/packages/twenty-server/src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface.ts
@@ -1,19 +1,19 @@
-import { ModuleMetadata, FactoryProvider } from '@nestjs/common';
+import { FactoryProvider, ModuleMetadata } from '@nestjs/common';
import { LangfuseDriverOptions } from 'src/engine/core-modules/llm-tracing/drivers/langfuse.driver';
export enum LLMTracingDriver {
- Langfuse = 'langfuse',
- Console = 'console',
+ LANGFUSE = 'LANGFUSE',
+ CONSOLE = 'CONSOLE',
}
export interface LangfuseDriverFactoryOptions {
- type: LLMTracingDriver.Langfuse;
+ type: LLMTracingDriver.LANGFUSE;
options: LangfuseDriverOptions;
}
export interface ConsoleDriverFactoryOptions {
- type: LLMTracingDriver.Console;
+ type: LLMTracingDriver.CONSOLE;
}
export type LLMTracingModuleOptions =
diff --git a/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module-factory.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module-factory.ts
index 5f716415a84..43c3a345007 100644
--- a/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module-factory.ts
+++ b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module-factory.ts
@@ -8,10 +8,10 @@ export const llmTracingModuleFactory = (
const driver = twentyConfigService.get('LLM_TRACING_DRIVER');
switch (driver) {
- case LLMTracingDriver.Console: {
- return { type: LLMTracingDriver.Console as const };
+ case LLMTracingDriver.CONSOLE: {
+ return { type: LLMTracingDriver.CONSOLE as const };
}
- case LLMTracingDriver.Langfuse: {
+ case LLMTracingDriver.LANGFUSE: {
const secretKey = twentyConfigService.get('LANGFUSE_SECRET_KEY');
const publicKey = twentyConfigService.get('LANGFUSE_PUBLIC_KEY');
@@ -22,7 +22,7 @@ export const llmTracingModuleFactory = (
}
return {
- type: LLMTracingDriver.Langfuse as const,
+ type: LLMTracingDriver.LANGFUSE as const,
options: { secretKey, publicKey },
};
}
diff --git a/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module.ts b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module.ts
index ef656958032..527735c8590 100644
--- a/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module.ts
+++ b/packages/twenty-server/src/engine/core-modules/llm-tracing/llm-tracing.module.ts
@@ -1,14 +1,14 @@
-import { Global, DynamicModule } from '@nestjs/common';
+import { DynamicModule, Global } from '@nestjs/common';
import {
- LLMTracingModuleAsyncOptions,
LLMTracingDriver,
+ LLMTracingModuleAsyncOptions,
} from 'src/engine/core-modules/llm-tracing/interfaces/llm-tracing.interface';
-import { LangfuseDriver } from 'src/engine/core-modules/llm-tracing/drivers/langfuse.driver';
import { ConsoleDriver } from 'src/engine/core-modules/llm-tracing/drivers/console.driver';
-import { LLMTracingService } from 'src/engine/core-modules/llm-tracing/llm-tracing.service';
+import { LangfuseDriver } from 'src/engine/core-modules/llm-tracing/drivers/langfuse.driver';
import { LLM_TRACING_DRIVER } from 'src/engine/core-modules/llm-tracing/llm-tracing.constants';
+import { LLMTracingService } from 'src/engine/core-modules/llm-tracing/llm-tracing.service';
@Global()
export class LLMTracingModule {
@@ -20,10 +20,10 @@ export class LLMTracingModule {
const config = options.useFactory(...args);
switch (config.type) {
- case LLMTracingDriver.Langfuse: {
+ case LLMTracingDriver.LANGFUSE: {
return new LangfuseDriver(config.options);
}
- case LLMTracingDriver.Console: {
+ case LLMTracingDriver.CONSOLE: {
return new ConsoleDriver();
}
}
diff --git a/packages/twenty-server/src/engine/core-modules/logger/interfaces/logger.interface.ts b/packages/twenty-server/src/engine/core-modules/logger/interfaces/logger.interface.ts
index 87a0e473064..688e584b6ab 100644
--- a/packages/twenty-server/src/engine/core-modules/logger/interfaces/logger.interface.ts
+++ b/packages/twenty-server/src/engine/core-modules/logger/interfaces/logger.interface.ts
@@ -1,11 +1,11 @@
import { LogLevel } from '@nestjs/common';
export enum LoggerDriverType {
- Console = 'console',
+ CONSOLE = 'CONSOLE',
}
export interface ConsoleDriverFactoryOptions {
- type: LoggerDriverType.Console;
+ type: LoggerDriverType.CONSOLE;
logLevels?: LogLevel[];
}
diff --git a/packages/twenty-server/src/engine/core-modules/logger/logger.module-factory.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.module-factory.ts
index 4992061585a..01d37fbd9f7 100644
--- a/packages/twenty-server/src/engine/core-modules/logger/logger.module-factory.ts
+++ b/packages/twenty-server/src/engine/core-modules/logger/logger.module-factory.ts
@@ -16,9 +16,9 @@ export const loggerModuleFactory = async (
const logLevels = twentyConfigService.get('LOG_LEVELS');
switch (driverType) {
- case LoggerDriverType.Console: {
+ case LoggerDriverType.CONSOLE: {
return {
- type: LoggerDriverType.Console,
+ type: LoggerDriverType.CONSOLE,
logLevels: logLevels,
};
}
diff --git a/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts
index 93063c83a4b..81400acef9d 100644
--- a/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts
+++ b/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts
@@ -19,7 +19,7 @@ export class LoggerModule extends ConfigurableModuleClass {
const provider = {
provide: LOGGER_DRIVER,
useValue:
- options.type === LoggerDriverType.Console
+ options.type === LoggerDriverType.CONSOLE
? new ConsoleLogger()
: undefined,
};
@@ -45,7 +45,7 @@ export class LoggerModule extends ConfigurableModuleClass {
const logLevels = config.logLevels ?? [];
const logger =
- config?.type === LoggerDriverType.Console
+ config?.type === LoggerDriverType.CONSOLE
? new ConsoleLogger()
: undefined;
diff --git a/packages/twenty-server/src/engine/core-modules/serverless/serverless-module.factory.ts b/packages/twenty-server/src/engine/core-modules/serverless/serverless-module.factory.ts
index 93e4d80ff48..bafda120544 100644
--- a/packages/twenty-server/src/engine/core-modules/serverless/serverless-module.factory.ts
+++ b/packages/twenty-server/src/engine/core-modules/serverless/serverless-module.factory.ts
@@ -15,13 +15,13 @@ export const serverlessModuleFactory = async (
const options = { fileStorageService };
switch (driverType) {
- case ServerlessDriverType.Local: {
+ case ServerlessDriverType.LOCAL: {
return {
- type: ServerlessDriverType.Local,
+ type: ServerlessDriverType.LOCAL,
options,
};
}
- case ServerlessDriverType.Lambda: {
+ case ServerlessDriverType.LAMBDA: {
const region = twentyConfigService.get('SERVERLESS_LAMBDA_REGION');
const accessKeyId = twentyConfigService.get(
'SERVERLESS_LAMBDA_ACCESS_KEY_ID',
@@ -36,7 +36,7 @@ export const serverlessModuleFactory = async (
);
return {
- type: ServerlessDriverType.Lambda,
+ type: ServerlessDriverType.LAMBDA,
options: {
...options,
credentials: accessKeyId
diff --git a/packages/twenty-server/src/engine/core-modules/serverless/serverless.interface.ts b/packages/twenty-server/src/engine/core-modules/serverless/serverless.interface.ts
index cd7721dd27e..8febc3f6a2f 100644
--- a/packages/twenty-server/src/engine/core-modules/serverless/serverless.interface.ts
+++ b/packages/twenty-server/src/engine/core-modules/serverless/serverless.interface.ts
@@ -1,20 +1,20 @@
import { FactoryProvider, ModuleMetadata } from '@nestjs/common';
-import { LocalDriverOptions } from 'src/engine/core-modules/serverless/drivers/local.driver';
import { LambdaDriverOptions } from 'src/engine/core-modules/serverless/drivers/lambda.driver';
+import { LocalDriverOptions } from 'src/engine/core-modules/serverless/drivers/local.driver';
export enum ServerlessDriverType {
- Lambda = 'lambda',
- Local = 'local',
+ LAMBDA = 'LAMBDA',
+ LOCAL = 'LOCAL',
}
export interface LocalDriverFactoryOptions {
- type: ServerlessDriverType.Local;
+ type: ServerlessDriverType.LOCAL;
options: LocalDriverOptions;
}
export interface LambdaDriverFactoryOptions {
- type: ServerlessDriverType.Lambda;
+ type: ServerlessDriverType.LAMBDA;
options: LambdaDriverOptions;
}
diff --git a/packages/twenty-server/src/engine/core-modules/serverless/serverless.module.ts b/packages/twenty-server/src/engine/core-modules/serverless/serverless.module.ts
index fb6d8137efb..b2a45c92c25 100644
--- a/packages/twenty-server/src/engine/core-modules/serverless/serverless.module.ts
+++ b/packages/twenty-server/src/engine/core-modules/serverless/serverless.module.ts
@@ -1,5 +1,6 @@
import { DynamicModule, Global } from '@nestjs/common';
+import { AddPackagesCommand } from 'src/engine/core-modules/serverless/commands/add-packages.command';
import { LambdaDriver } from 'src/engine/core-modules/serverless/drivers/lambda.driver';
import { LocalDriver } from 'src/engine/core-modules/serverless/drivers/local.driver';
import { SERVERLESS_DRIVER } from 'src/engine/core-modules/serverless/serverless.constants';
@@ -8,7 +9,6 @@ import {
ServerlessModuleAsyncOptions,
} from 'src/engine/core-modules/serverless/serverless.interface';
import { ServerlessService } from 'src/engine/core-modules/serverless/serverless.service';
-import { AddPackagesCommand } from 'src/engine/core-modules/serverless/commands/add-packages.command';
@Global()
export class ServerlessModule {
@@ -19,7 +19,7 @@ export class ServerlessModule {
useFactory: async (...args: any[]) => {
const config = await options.useFactory(...args);
- return config?.type === ServerlessDriverType.Local
+ return config?.type === ServerlessDriverType.LOCAL
? new LocalDriver(config.options)
: new LambdaDriver(config.options);
},
diff --git a/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts b/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts
index 9fe018bd6aa..8632216c236 100644
--- a/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts
+++ b/packages/twenty-server/src/engine/core-modules/twenty-config/config-variables.ts
@@ -27,6 +27,7 @@ import { ServerlessDriverType } from 'src/engine/core-modules/serverless/serverl
import { CastToLogLevelArray } from 'src/engine/core-modules/twenty-config/decorators/cast-to-log-level-array.decorator';
import { CastToMeterDriverArray } from 'src/engine/core-modules/twenty-config/decorators/cast-to-meter-driver.decorator';
import { CastToPositiveNumber } from 'src/engine/core-modules/twenty-config/decorators/cast-to-positive-number.decorator';
+import { CastToUpperSnakeCase } from 'src/engine/core-modules/twenty-config/decorators/cast-to-upper-snake-case.decorator';
import { ConfigVariablesMetadata } from 'src/engine/core-modules/twenty-config/decorators/config-variables-metadata.decorator';
import { IsAWSRegion } from 'src/engine/core-modules/twenty-config/decorators/is-aws-region.decorator';
import { IsDuration } from 'src/engine/core-modules/twenty-config/decorators/is-duration.decorator';
@@ -301,7 +302,8 @@ export class ConfigVariables {
type: ConfigVariableType.ENUM,
options: Object.values(EmailDriver),
})
- EMAIL_DRIVER: EmailDriver = EmailDriver.Logger;
+ @CastToUpperSnakeCase()
+ EMAIL_DRIVER: EmailDriver = EmailDriver.LOGGER;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.EmailSettings,
@@ -349,14 +351,15 @@ export class ConfigVariables {
options: Object.values(StorageDriverType),
})
@IsOptional()
- STORAGE_TYPE: StorageDriverType = StorageDriverType.Local;
+ @CastToUpperSnakeCase()
+ STORAGE_TYPE: StorageDriverType = StorageDriverType.LOCAL;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.StorageConfig,
description: 'Local path for storage when using local storage type',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.Local)
+ @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.LOCAL)
STORAGE_LOCAL_PATH = '.local-storage';
@ConfigVariablesMetadata({
@@ -364,7 +367,7 @@ export class ConfigVariables {
description: 'S3 region for storage when using S3 storage type',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S3)
+ @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S_3)
@IsAWSRegion()
STORAGE_S3_REGION: AwsRegion;
@@ -373,7 +376,7 @@ export class ConfigVariables {
description: 'S3 bucket name for storage when using S3 storage type',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S3)
+ @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S_3)
STORAGE_S3_NAME: string;
@ConfigVariablesMetadata({
@@ -381,7 +384,7 @@ export class ConfigVariables {
description: 'S3 endpoint for storage when using S3 storage type',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S3)
+ @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S_3)
@IsOptional()
STORAGE_S3_ENDPOINT: string;
@@ -392,7 +395,7 @@ export class ConfigVariables {
'S3 access key ID for authentication when using S3 storage type',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S3)
+ @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S_3)
@IsOptional()
STORAGE_S3_ACCESS_KEY_ID: string;
@@ -403,7 +406,7 @@ export class ConfigVariables {
'S3 secret access key for authentication when using S3 storage type',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S3)
+ @ValidateIf((env) => env.STORAGE_TYPE === StorageDriverType.S_3)
@IsOptional()
STORAGE_S3_SECRET_ACCESS_KEY: string;
@@ -415,7 +418,8 @@ export class ConfigVariables {
isEnvOnly: true,
})
@IsOptional()
- SERVERLESS_TYPE: ServerlessDriverType = ServerlessDriverType.Local;
+ @CastToUpperSnakeCase()
+ SERVERLESS_TYPE: ServerlessDriverType = ServerlessDriverType.LOCAL;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.ServerlessConfig,
@@ -439,7 +443,7 @@ export class ConfigVariables {
description: 'Region for AWS Lambda functions',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.SERVERLESS_TYPE === ServerlessDriverType.Lambda)
+ @ValidateIf((env) => env.SERVERLESS_TYPE === ServerlessDriverType.LAMBDA)
@IsAWSRegion()
SERVERLESS_LAMBDA_REGION: AwsRegion;
@@ -448,7 +452,7 @@ export class ConfigVariables {
description: 'IAM role for AWS Lambda functions',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.SERVERLESS_TYPE === ServerlessDriverType.Lambda)
+ @ValidateIf((env) => env.SERVERLESS_TYPE === ServerlessDriverType.LAMBDA)
SERVERLESS_LAMBDA_ROLE: string;
@ConfigVariablesMetadata({
@@ -456,7 +460,7 @@ export class ConfigVariables {
description: 'Role to assume when hosting lambdas in dedicated AWS account',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.SERVERLESS_TYPE === ServerlessDriverType.Lambda)
+ @ValidateIf((env) => env.SERVERLESS_TYPE === ServerlessDriverType.LAMBDA)
@IsOptional()
SERVERLESS_LAMBDA_SUBHOSTING_ROLE?: string;
@@ -466,7 +470,7 @@ export class ConfigVariables {
description: 'Access key ID for AWS Lambda functions',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.SERVERLESS_TYPE === ServerlessDriverType.Lambda)
+ @ValidateIf((env) => env.SERVERLESS_TYPE === ServerlessDriverType.LAMBDA)
@IsOptional()
SERVERLESS_LAMBDA_ACCESS_KEY_ID: string;
@@ -476,7 +480,7 @@ export class ConfigVariables {
description: 'Secret access key for AWS Lambda functions',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.SERVERLESS_TYPE === ServerlessDriverType.Lambda)
+ @ValidateIf((env) => env.SERVERLESS_TYPE === ServerlessDriverType.LAMBDA)
@IsOptional()
SERVERLESS_LAMBDA_SECRET_ACCESS_KEY: string;
@@ -634,8 +638,9 @@ export class ConfigVariables {
isEnvOnly: true,
})
@IsOptional()
+ @CastToUpperSnakeCase()
EXCEPTION_HANDLER_DRIVER: ExceptionHandlerDriver =
- ExceptionHandlerDriver.Console;
+ ExceptionHandlerDriver.CONSOLE;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.Logging,
@@ -676,7 +681,8 @@ export class ConfigVariables {
isEnvOnly: true,
})
@IsOptional()
- LOGGER_DRIVER: LoggerDriverType = LoggerDriverType.Console;
+ @CastToUpperSnakeCase()
+ LOGGER_DRIVER: LoggerDriverType = LoggerDriverType.CONSOLE;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.ExceptionHandler,
@@ -685,7 +691,7 @@ export class ConfigVariables {
isSensitive: true,
})
@ValidateIf(
- (env) => env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.Sentry,
+ (env) => env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.SENTRY,
)
SENTRY_DSN: string;
@@ -696,7 +702,7 @@ export class ConfigVariables {
isSensitive: true,
})
@ValidateIf(
- (env) => env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.Sentry,
+ (env) => env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.SENTRY,
)
SENTRY_FRONT_DSN: string;
@ConfigVariablesMetadata({
@@ -705,7 +711,7 @@ export class ConfigVariables {
type: ConfigVariableType.STRING,
})
@ValidateIf(
- (env) => env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.Sentry,
+ (env) => env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.SENTRY,
)
@IsOptional()
SENTRY_ENVIRONMENT: string;
@@ -717,7 +723,8 @@ export class ConfigVariables {
options: Object.values(SupportDriver),
})
@IsOptional()
- SUPPORT_DRIVER: SupportDriver = SupportDriver.None;
+ @CastToUpperSnakeCase()
+ SUPPORT_DRIVER: SupportDriver = SupportDriver.NONE;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.SupportChatConfig,
@@ -725,7 +732,7 @@ export class ConfigVariables {
description: 'Chat ID for the support front integration',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.SUPPORT_DRIVER === SupportDriver.Front)
+ @ValidateIf((env) => env.SUPPORT_DRIVER === SupportDriver.FRONT)
SUPPORT_FRONT_CHAT_ID: string;
@ConfigVariablesMetadata({
@@ -734,7 +741,7 @@ export class ConfigVariables {
description: 'HMAC key for the support front integration',
type: ConfigVariableType.STRING,
})
- @ValidateIf((env) => env.SUPPORT_DRIVER === SupportDriver.Front)
+ @ValidateIf((env) => env.SUPPORT_DRIVER === SupportDriver.FRONT)
SUPPORT_FRONT_HMAC_KEY: string;
@ConfigVariablesMetadata({
@@ -840,7 +847,8 @@ export class ConfigVariables {
options: Object.values(NodeEnvironment),
isEnvOnly: true,
})
- NODE_ENV: NodeEnvironment = NodeEnvironment.production;
+ // @CastToUpperSnakeCase()
+ NODE_ENV: NodeEnvironment = NodeEnvironment.PRODUCTION;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.ServerConfig,
@@ -949,6 +957,7 @@ export class ConfigVariables {
options: Object.values(LLMChatModelDriver),
isEnvOnly: true,
})
+ @CastToUpperSnakeCase()
LLM_CHAT_MODEL_DRIVER: LLMChatModelDriver;
@ConfigVariablesMetadata({
@@ -981,7 +990,8 @@ export class ConfigVariables {
options: Object.values(LLMTracingDriver),
isEnvOnly: true,
})
- LLM_TRACING_DRIVER: LLMTracingDriver = LLMTracingDriver.Console;
+ @CastToUpperSnakeCase()
+ LLM_TRACING_DRIVER: LLMTracingDriver = LLMTracingDriver.CONSOLE;
@ConfigVariablesMetadata({
group: ConfigVariablesGroup.ServerConfig,
@@ -1059,6 +1069,7 @@ export class ConfigVariables {
isEnvOnly: true,
})
@IsOptional()
+ @CastToUpperSnakeCase()
CAPTCHA_DRIVER?: CaptchaDriverType;
@ConfigVariablesMetadata({
diff --git a/packages/twenty-server/src/engine/core-modules/twenty-config/decorators/__tests__/cast-to-upper-snake-case.decorator.spec.ts b/packages/twenty-server/src/engine/core-modules/twenty-config/decorators/__tests__/cast-to-upper-snake-case.decorator.spec.ts
new file mode 100644
index 00000000000..11e0a74bde0
--- /dev/null
+++ b/packages/twenty-server/src/engine/core-modules/twenty-config/decorators/__tests__/cast-to-upper-snake-case.decorator.spec.ts
@@ -0,0 +1,84 @@
+import { plainToClass } from 'class-transformer';
+
+import { CastToUpperSnakeCase } from 'src/engine/core-modules/twenty-config/decorators/cast-to-upper-snake-case.decorator';
+
+class TestClass {
+ @CastToUpperSnakeCase()
+ value: string;
+}
+
+describe('CastToUpperSnakeCase Decorator', () => {
+ it('should transform lowercase string to UPPER_SNAKE_CASE', () => {
+ const result = plainToClass(TestClass, { value: 'local' });
+
+ expect(result.value).toBe('LOCAL');
+ });
+
+ it('should transform camelCase string to UPPER_SNAKE_CASE', () => {
+ const result = plainToClass(TestClass, { value: 'camelCase' });
+
+ expect(result.value).toBe('CAMEL_CASE');
+ });
+
+ it('should transform kebab-case string to UPPER_SNAKE_CASE', () => {
+ const result = plainToClass(TestClass, { value: 'kebab-case' });
+
+ expect(result.value).toBe('KEBAB_CASE');
+ });
+
+ it('should transform space-separated string to UPPER_SNAKE_CASE', () => {
+ const result = plainToClass(TestClass, { value: 'space separated' });
+
+ expect(result.value).toBe('SPACE_SEPARATED');
+ });
+
+ it('should handle already UPPER_SNAKE_CASE string', () => {
+ const result = plainToClass(TestClass, { value: 'ALREADY_UPPER_SNAKE' });
+
+ expect(result.value).toBe('ALREADY_UPPER_SNAKE');
+ });
+
+ it('should handle mixed case with numbers', () => {
+ const result = plainToClass(TestClass, { value: 'test123Value' });
+
+ expect(result.value).toBe('TEST_123_VALUE');
+ });
+
+ it('should trim whitespace', () => {
+ const result = plainToClass(TestClass, { value: ' local ' });
+
+ expect(result.value).toBe('LOCAL');
+ });
+
+ it('should handle empty string', () => {
+ const result = plainToClass(TestClass, { value: '' });
+
+ expect(result.value).toBe('');
+ });
+
+ it('should return undefined for non-string values', () => {
+ const result = plainToClass(TestClass, { value: 123 });
+
+ expect(result.value).toBeUndefined();
+ });
+
+ it('should return undefined for null values', () => {
+ const result = plainToClass(TestClass, { value: null });
+
+ expect(result.value).toBeUndefined();
+ });
+
+ it('should return undefined for undefined values', () => {
+ const result = plainToClass(TestClass, { value: undefined });
+
+ expect(result.value).toBeUndefined();
+ });
+
+ it('should handle complex mixed formats', () => {
+ const result = plainToClass(TestClass, {
+ value: 'Complex-Mixed_Format test123',
+ });
+
+ expect(result.value).toBe('COMPLEX_MIXED_FORMAT_TEST_123');
+ });
+});
diff --git a/packages/twenty-server/src/engine/core-modules/twenty-config/decorators/cast-to-upper-snake-case.decorator.ts b/packages/twenty-server/src/engine/core-modules/twenty-config/decorators/cast-to-upper-snake-case.decorator.ts
new file mode 100644
index 00000000000..f208eb4bb1e
--- /dev/null
+++ b/packages/twenty-server/src/engine/core-modules/twenty-config/decorators/cast-to-upper-snake-case.decorator.ts
@@ -0,0 +1,13 @@
+import { Transform } from 'class-transformer';
+import snakeCase from 'lodash.snakecase';
+
+export const CastToUpperSnakeCase = () =>
+ Transform(({ value }: { value: string }) => toUpperSnakeCase(value));
+
+const toUpperSnakeCase = (value: unknown): string | undefined => {
+ if (typeof value === 'string') {
+ return snakeCase(value.trim()).toUpperCase();
+ }
+
+ return undefined;
+};
diff --git a/packages/twenty-server/src/engine/core-modules/twenty-config/interfaces/node-environment.interface.ts b/packages/twenty-server/src/engine/core-modules/twenty-config/interfaces/node-environment.interface.ts
index 31af6fb0965..48edceaa8d2 100644
--- a/packages/twenty-server/src/engine/core-modules/twenty-config/interfaces/node-environment.interface.ts
+++ b/packages/twenty-server/src/engine/core-modules/twenty-config/interfaces/node-environment.interface.ts
@@ -1,5 +1,5 @@
export enum NodeEnvironment {
- test = 'test',
- development = 'development',
- production = 'production',
+ TEST = 'test',
+ DEVELOPMENT = 'development',
+ PRODUCTION = 'production',
}
diff --git a/packages/twenty-server/src/engine/core-modules/twenty-config/interfaces/support.interface.ts b/packages/twenty-server/src/engine/core-modules/twenty-config/interfaces/support.interface.ts
index f5199e52d5c..2b2804c3087 100644
--- a/packages/twenty-server/src/engine/core-modules/twenty-config/interfaces/support.interface.ts
+++ b/packages/twenty-server/src/engine/core-modules/twenty-config/interfaces/support.interface.ts
@@ -1,4 +1,4 @@
export enum SupportDriver {
- None = 'none',
- Front = 'front',
+ NONE = 'NONE',
+ FRONT = 'FRONT',
}
diff --git a/packages/twenty-server/src/engine/core-modules/twenty-config/twenty-config.service.ts b/packages/twenty-server/src/engine/core-modules/twenty-config/twenty-config.service.ts
index 31cfc3bddbe..626dbd2c7ee 100644
--- a/packages/twenty-server/src/engine/core-modules/twenty-config/twenty-config.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/twenty-config/twenty-config.service.ts
@@ -201,9 +201,9 @@ export class TwentyConfigService {
getLoggingConfig(): LoggerOptions {
switch (this.get('NODE_ENV')) {
- case NodeEnvironment.development:
+ case NodeEnvironment.DEVELOPMENT:
return ['query', 'error'];
- case NodeEnvironment.test:
+ case NodeEnvironment.TEST:
return [];
default:
return ['error'];
diff --git a/packages/twenty-server/src/engine/core-modules/user/user.resolver.ts b/packages/twenty-server/src/engine/core-modules/user/user.resolver.ts
index a395df8e6dd..447efd2a80d 100644
--- a/packages/twenty-server/src/engine/core-modules/user/user.resolver.ts
+++ b/packages/twenty-server/src/engine/core-modules/user/user.resolver.ts
@@ -123,7 +123,7 @@ export class UserResolver {
) {
const isPermissionsV2Enabled =
await this.featureFlagService.isFeatureEnabled(
- FeatureFlagKey.IsPermissionsV2Enabled,
+ FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED,
workspace.id,
);
@@ -334,7 +334,7 @@ export class UserResolver {
})
supportUserHash(@Parent() parent: User): string | null {
if (
- this.twentyConfigService.get('SUPPORT_DRIVER') !== SupportDriver.Front
+ this.twentyConfigService.get('SUPPORT_DRIVER') !== SupportDriver.FRONT
) {
return null;
}
diff --git a/packages/twenty-server/src/engine/metadata-modules/permissions/permissions.service.ts b/packages/twenty-server/src/engine/metadata-modules/permissions/permissions.service.ts
index 77e13b26571..ee828db79a1 100644
--- a/packages/twenty-server/src/engine/metadata-modules/permissions/permissions.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/permissions/permissions.service.ts
@@ -206,7 +206,7 @@ export class PermissionsService {
const isPermissionsV2Enabled =
await this.featureFlagService.isFeatureEnabled(
- FeatureFlagKey.IsPermissionsV2Enabled,
+ FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED,
workspaceId,
);
@@ -234,7 +234,7 @@ export class PermissionsService {
}): Promise<boolean> {
const isPermissionsV2Enabled =
await this.featureFlagService.isFeatureEnabled(
- FeatureFlagKey.IsPermissionsV2Enabled,
+ FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED,
workspaceId,
);
diff --git a/packages/twenty-server/src/engine/metadata-modules/remote-server/utils/validate-remote-server-type.util.ts b/packages/twenty-server/src/engine/metadata-modules/remote-server/utils/validate-remote-server-type.util.ts
index 1dab2254e03..70590fe2886 100644
--- a/packages/twenty-server/src/engine/metadata-modules/remote-server/utils/validate-remote-server-type.util.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/remote-server/utils/validate-remote-server-type.util.ts
@@ -34,9 +34,9 @@ export const validateRemoteServerType = async (
const getFeatureFlagKey = (remoteServerType: RemoteServerType) => {
switch (remoteServerType) {
case RemoteServerType.POSTGRES_FDW:
- return FeatureFlagKey.IsPostgreSQLIntegrationEnabled;
+ return FeatureFlagKey.IS_POSTGRESQL_INTEGRATION_ENABLED;
case RemoteServerType.STRIPE_FDW:
- return FeatureFlagKey.IsStripeIntegrationEnabled;
+ return FeatureFlagKey.IS_STRIPE_INTEGRATION_ENABLED;
default:
throw new RemoteServerException(
`Type ${remoteServerType} is not supported.`,
diff --git a/packages/twenty-server/src/engine/metadata-modules/role/role.resolver.ts b/packages/twenty-server/src/engine/metadata-modules/role/role.resolver.ts
index 9b1a5997ee9..dc11400de21 100644
--- a/packages/twenty-server/src/engine/metadata-modules/role/role.resolver.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/role/role.resolver.ts
@@ -205,7 +205,7 @@ export class RoleResolver {
private async validatePermissionsV2EnabledOrThrow(workspace: Workspace) {
const isPermissionsV2Enabled =
await this.featureFlagService.isFeatureEnabled(
- FeatureFlagKey.IsPermissionsV2Enabled,
+ FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED,
workspace.id,
);
diff --git a/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.resolver.ts b/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.resolver.ts
index 0c84726575d..ee43330597f 100644
--- a/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.resolver.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.resolver.ts
@@ -11,11 +11,11 @@ import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
import { AuthWorkspace } from 'src/engine/decorators/auth/auth-workspace.decorator';
import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
import { CreateServerlessFunctionInput } from 'src/engine/metadata-modules/serverless-function/dtos/create-serverless-function.input';
-import { ServerlessFunctionIdInput } from 'src/engine/metadata-modules/serverless-function/dtos/serverless-function-id.input';
import { ExecuteServerlessFunctionInput } from 'src/engine/metadata-modules/serverless-function/dtos/execute-serverless-function.input';
import { GetServerlessFunctionSourceCodeInput } from 'src/engine/metadata-modules/serverless-function/dtos/get-serverless-function-source-code.input';
import { PublishServerlessFunctionInput } from 'src/engine/metadata-modules/serverless-function/dtos/publish-serverless-function.input';
import { ServerlessFunctionExecutionResultDTO } from 'src/engine/metadata-modules/serverless-function/dtos/serverless-function-execution-result.dto';
+import { ServerlessFunctionIdInput } from 'src/engine/metadata-modules/serverless-function/dtos/serverless-function-id.input';
import { ServerlessFunctionDTO } from 'src/engine/metadata-modules/serverless-function/dtos/serverless-function.dto';
import { UpdateServerlessFunctionInput } from 'src/engine/metadata-modules/serverless-function/dtos/update-serverless-function.input';
import {
@@ -37,7 +37,7 @@ export class ServerlessFunctionResolver {
async checkFeatureFlag(workspaceId: string) {
const isWorkflowEnabled = await this.featureFlagRepository.findOneBy({
workspaceId,
- key: FeatureFlagKey.IsWorkflowEnabled,
+ key: FeatureFlagKey.IS_WORKFLOW_ENABLED,
value: true,
});
diff --git a/packages/twenty-server/src/engine/metadata-modules/workspace-permissions-cache/workspace-permissions-cache.service.ts b/packages/twenty-server/src/engine/metadata-modules/workspace-permissions-cache/workspace-permissions-cache.service.ts
index 0241a1dc331..9bf5f10801e 100644
--- a/packages/twenty-server/src/engine/metadata-modules/workspace-permissions-cache/workspace-permissions-cache.service.ts
+++ b/packages/twenty-server/src/engine/metadata-modules/workspace-permissions-cache/workspace-permissions-cache.service.ts
@@ -87,7 +87,7 @@ export class WorkspacePermissionsCacheService {
const isPermissionsV2Enabled =
await this.featureFlagService.isFeatureEnabled(
- FeatureFlagKey.IsPermissionsV2Enabled,
+ FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED,
workspaceId,
);
diff --git a/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts b/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts
index fe165ee7796..4ea1ff6ca5e 100644
--- a/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts
+++ b/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.spec.ts
@@ -42,13 +42,13 @@ describe('WorkspaceEntityManager', () => {
idByNameSingular: {},
},
featureFlagsMap: {
- [FeatureFlagKey.IsPermissionsV2Enabled]: true,
+ [FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED]: true,
},
} as WorkspaceInternalContext;
mockDataSource = {
featureFlagMap: {
- [FeatureFlagKey.IsPermissionsV2Enabled]: true,
+ [FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED]: true,
},
permissionsPerRoleId: {},
} as WorkspaceDataSource;
@@ -118,7 +118,7 @@ describe('WorkspaceEntityManager', () => {
// Mock getFeatureFlagMap
jest.spyOn(entityManager as any, 'getFeatureFlagMap').mockReturnValue({
- [FeatureFlagKey.IsPermissionsV2Enabled]: true,
+ [FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED]: true,
});
// Mock typeORM's EntityManager methods
diff --git a/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.ts b/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.ts
index 09ad6b4b2b4..72216ecc326 100644
--- a/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.ts
+++ b/packages/twenty-server/src/engine/twenty-orm/entity-manager/workspace-entity-manager.ts
@@ -94,7 +94,7 @@ export class WorkspaceEntityManager extends EntityManager {
const featureFlagMap = this.getFeatureFlagMap();
const isPermissionsV2Enabled =
- featureFlagMap[FeatureFlagKey.IsPermissionsV2Enabled];
+ featureFlagMap[FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED];
if (permissionOptions?.roleId) {
const objectPermissionsByRoleId = dataSource.permissionsPerRoleId;
@@ -159,7 +159,7 @@ export class WorkspaceEntityManager extends EntityManager {
const featureFlagMap = this.getFeatureFlagMap();
const isPermissionsV2Enabled =
- featureFlagMap[FeatureFlagKey.IsPermissionsV2Enabled];
+ featureFlagMap[FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED];
if (!isPermissionsV2Enabled) {
return queryBuilder;
@@ -371,7 +371,7 @@ export class WorkspaceEntityManager extends EntityManager {
const featureFlagMap = this.getFeatureFlagMap();
const isPermissionsV2Enabled =
- featureFlagMap[FeatureFlagKey.IsPermissionsV2Enabled];
+ featureFlagMap[FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED];
if (!isPermissionsV2Enabled) {
return;
diff --git a/packages/twenty-server/src/engine/twenty-orm/repository/workspace.repository.ts b/packages/twenty-server/src/engine/twenty-orm/repository/workspace.repository.ts
index ad4c8446086..f16392eb7e7 100644
--- a/packages/twenty-server/src/engine/twenty-orm/repository/workspace.repository.ts
+++ b/packages/twenty-server/src/engine/twenty-orm/repository/workspace.repository.ts
@@ -67,7 +67,7 @@ export class WorkspaceRepository<
queryRunner,
) as unknown as WorkspaceSelectQueryBuilder<U>;
const isPermissionsV2Enabled =
- this.featureFlagMap[FeatureFlagKey.IsPermissionsV2Enabled];
+ this.featureFlagMap[FeatureFlagKey.IS_PERMISSIONS_V2_ENABLED];
if (!isPermissionsV2Enabled) {
return queryBuilder;
diff --git a/packages/twenty-server/src/engine/utils/global-exception-handler.util.ts b/packages/twenty-server/src/engine/utils/global-exception-handler.util.ts
index 41d73b8f6f1..24524a0cf3f 100644
--- a/packages/twenty-server/src/engine/utils/global-exception-handler.util.ts
+++ b/packages/twenty-server/src/engine/utils/global-exception-handler.util.ts
@@ -137,7 +137,7 @@ const convertHttpExceptionToGraphql = (exception: HttpException) => {
}
// Only show the stack trace in development mode
- if (process.env.NODE_ENV === NodeEnvironment.development) {
+ if (process.env.NODE_ENV === NodeEnvironment.DEVELOPMENT) {
error.stack = exception.stack;
error.extensions['response'] = exception.getResponse();
}
diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface.ts
index 5bfc69eaa5e..b0bf4911e74 100644
--- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface.ts
@@ -1,4 +1,4 @@
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { ViewOpenRecordInType } from 'src/modules/view/standard-objects/view.workspace-entity';
export interface ViewDefinition {
@@ -11,14 +11,14 @@ export interface ViewDefinition {
icon?: string;
openRecordIn?: ViewOpenRecordInType;
kanbanFieldMetadataId?: string;
- kanbanAggregateOperation?: AGGREGATE_OPERATIONS;
+ kanbanAggregateOperation?: AggregateOperations;
kanbanAggregateOperationFieldMetadataId?: string;
fields?: {
fieldMetadataId: string;
position: number;
isVisible: boolean;
size: number;
- aggregateOperation?: AGGREGATE_OPERATIONS;
+ aggregateOperation?: AggregateOperations;
}[];
filters?: {
fieldMetadataId: string;
diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/companies-all.view.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/companies-all.view.ts
index 8c2d79d9ce7..6eba0dcb7cc 100644
--- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/companies-all.view.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/companies-all.view.ts
@@ -1,6 +1,6 @@
import { ObjectMetadataStandardIdToIdMap } from 'src/engine/metadata-modules/object-metadata/interfaces/object-metadata-standard-id-to-id-map';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import {
BASE_OBJECT_STANDARD_FIELD_IDS,
COMPANY_STANDARD_FIELD_IDS,
@@ -38,7 +38,7 @@ export const companiesAllView = (
position: 1,
isVisible: true,
size: 100,
- aggregateOperation: AGGREGATE_OPERATIONS.count,
+ aggregateOperation: AggregateOperations.COUNT,
},
{
fieldMetadataId:
@@ -75,7 +75,7 @@ export const companiesAllView = (
position: 5,
isVisible: true,
size: 150,
- aggregateOperation: AGGREGATE_OPERATIONS.max,
+ aggregateOperation: AggregateOperations.MAX,
},
{
fieldMetadataId:
@@ -85,7 +85,7 @@ export const companiesAllView = (
position: 6,
isVisible: true,
size: 170,
- aggregateOperation: AGGREGATE_OPERATIONS.percentageEmpty,
+ aggregateOperation: AggregateOperations.PERCENTAGE_EMPTY,
},
{
fieldMetadataId:
@@ -95,7 +95,7 @@ export const companiesAllView = (
position: 7,
isVisible: true,
size: 170,
- aggregateOperation: AGGREGATE_OPERATIONS.countNotEmpty,
+ aggregateOperation: AggregateOperations.COUNT_NOT_EMPTY,
},
],
};
diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunities-all.view.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunities-all.view.ts
index ae234bb3e93..42ad6efa6e2 100644
--- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunities-all.view.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunities-all.view.ts
@@ -1,6 +1,6 @@
import { ObjectMetadataStandardIdToIdMap } from 'src/engine/metadata-modules/object-metadata/interfaces/object-metadata-standard-id-to-id-map';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { OPPORTUNITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
@@ -33,7 +33,7 @@ export const opportunitiesAllView = (
position: 1,
isVisible: true,
size: 150,
- aggregateOperation: AGGREGATE_OPERATIONS.avg,
+ aggregateOperation: AggregateOperations.AVG,
},
{
fieldMetadataId:
@@ -50,7 +50,7 @@ export const opportunitiesAllView = (
position: 3,
isVisible: true,
size: 150,
- aggregateOperation: AGGREGATE_OPERATIONS.min,
+ aggregateOperation: AggregateOperations.MIN,
},
{
fieldMetadataId:
diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunity-by-stage.view.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunity-by-stage.view.ts
index bacffb44a43..ea4fa62be6d 100644
--- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunity-by-stage.view.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunity-by-stage.view.ts
@@ -1,6 +1,6 @@
import { ObjectMetadataStandardIdToIdMap } from 'src/engine/metadata-modules/object-metadata/interfaces/object-metadata-standard-id-to-id-map';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { OPPORTUNITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
@@ -19,7 +19,7 @@ export const opportunitiesByStageView = (
objectMetadataStandardIdToIdMap[STANDARD_OBJECT_IDS.opportunity].fields[
OPPORTUNITY_STANDARD_FIELD_IDS.stage
],
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.min,
+ kanbanAggregateOperation: AggregateOperations.MIN,
kanbanAggregateOperationFieldMetadataId:
objectMetadataStandardIdToIdMap[STANDARD_OBJECT_IDS.opportunity].fields[
OPPORTUNITY_STANDARD_FIELD_IDS.amount
diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunity-table-by-stage.view.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunity-table-by-stage.view.ts
index 066b6178081..a3af01591d8 100644
--- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunity-table-by-stage.view.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/opportunity-table-by-stage.view.ts
@@ -1,6 +1,6 @@
import { ObjectMetadataStandardIdToIdMap } from 'src/engine/metadata-modules/object-metadata/interfaces/object-metadata-standard-id-to-id-map';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { OPPORTUNITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
@@ -36,7 +36,7 @@ export const opportunitiesTableByStageView = (
position: 1,
isVisible: true,
size: 150,
- aggregateOperation: AGGREGATE_OPERATIONS.avg,
+ aggregateOperation: AggregateOperations.AVG,
},
{
fieldMetadataId:
@@ -53,7 +53,7 @@ export const opportunitiesTableByStageView = (
position: 3,
isVisible: true,
size: 150,
- aggregateOperation: AGGREGATE_OPERATIONS.max,
+ aggregateOperation: AggregateOperations.MAX,
},
{
fieldMetadataId:
@@ -62,7 +62,7 @@ export const opportunitiesTableByStageView = (
position: 4,
isVisible: true,
size: 150,
- aggregateOperation: AGGREGATE_OPERATIONS.count,
+ aggregateOperation: AggregateOperations.COUNT,
},
{
fieldMetadataId:
diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/people-all.view.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/people-all.view.ts
index 7e416e3fd6e..fc9cec40bb8 100644
--- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/people-all.view.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/views/people-all.view.ts
@@ -1,6 +1,6 @@
import { ObjectMetadataStandardIdToIdMap } from 'src/engine/metadata-modules/object-metadata/interfaces/object-metadata-standard-id-to-id-map';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import {
BASE_OBJECT_STANDARD_FIELD_IDS,
PERSON_STANDARD_FIELD_IDS,
@@ -38,7 +38,7 @@ export const peopleAllView = (
position: 1,
isVisible: true,
size: 150,
- aggregateOperation: AGGREGATE_OPERATIONS.countUniqueValues,
+ aggregateOperation: AggregateOperations.COUNT_UNIQUE_VALUES,
},
{
fieldMetadataId:
@@ -66,7 +66,7 @@ export const peopleAllView = (
position: 4,
isVisible: true,
size: 150,
- aggregateOperation: AGGREGATE_OPERATIONS.percentageEmpty,
+ aggregateOperation: AggregateOperations.PERCENTAGE_EMPTY,
},
{
fieldMetadataId:
@@ -76,7 +76,7 @@ export const peopleAllView = (
position: 5,
isVisible: true,
size: 150,
- aggregateOperation: AGGREGATE_OPERATIONS.min,
+ aggregateOperation: AggregateOperations.MIN,
},
{
fieldMetadataId:
diff --git a/packages/twenty-server/src/instrument.ts b/packages/twenty-server/src/instrument.ts
index c4975eee05a..91eed821b6a 100644
--- a/packages/twenty-server/src/instrument.ts
+++ b/packages/twenty-server/src/instrument.ts
@@ -23,7 +23,7 @@ const meterDrivers = parseArrayEnvVar(
[],
);
-if (process.env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.Sentry) {
+if (process.env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.SENTRY) {
Sentry.init({
environment: process.env.SENTRY_ENVIRONMENT,
release: process.env.APP_VERSION,
@@ -43,7 +43,7 @@ if (process.env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.Sentry) {
],
tracesSampleRate: 0.1,
profilesSampleRate: 0.3,
- debug: process.env.NODE_ENV === NodeEnvironment.development,
+ debug: process.env.NODE_ENV === NodeEnvironment.DEVELOPMENT,
});
}
diff --git a/packages/twenty-server/src/main.ts b/packages/twenty-server/src/main.ts
index d52856e8bcd..ced56dd8723 100644
--- a/packages/twenty-server/src/main.ts
+++ b/packages/twenty-server/src/main.ts
@@ -27,7 +27,7 @@ const bootstrap = async () => {
cors: true,
bufferLogs: process.env.LOGGER_IS_BUFFER_ENABLED === 'true',
rawBody: true,
- snapshot: process.env.NODE_ENV === NodeEnvironment.development,
+ snapshot: process.env.NODE_ENV === NodeEnvironment.DEVELOPMENT,
...(process.env.SSL_KEY_PATH && process.env.SSL_CERT_PATH
? {
httpsOptions: {
diff --git a/packages/twenty-server/src/modules/calendar/common/query-hooks/calendar-event/calendar-event-find-many.post-query.hook.ts b/packages/twenty-server/src/modules/calendar/common/query-hooks/calendar-event/calendar-event-find-many.post-query.hook.ts
index d7cfb358786..1c3e3332962 100644
--- a/packages/twenty-server/src/modules/calendar/common/query-hooks/calendar-event/calendar-event-find-many.post-query.hook.ts
+++ b/packages/twenty-server/src/modules/calendar/common/query-hooks/calendar-event/calendar-event-find-many.post-query.hook.ts
@@ -11,7 +11,7 @@ import { CalendarEventWorkspaceEntity } from 'src/modules/calendar/common/standa
@WorkspaceQueryHook({
key: `calendarEvent.findMany`,
- type: WorkspaceQueryHookType.PostHook,
+ type: WorkspaceQueryHookType.POST_HOOK,
})
export class CalendarEventFindManyPostQueryHook
implements WorkspacePostQueryHookInstance
diff --git a/packages/twenty-server/src/modules/calendar/common/query-hooks/calendar-event/calendar-event-find-one.post-query.hook.ts b/packages/twenty-server/src/modules/calendar/common/query-hooks/calendar-event/calendar-event-find-one.post-query.hook.ts
index 407694962b8..059404da4f3 100644
--- a/packages/twenty-server/src/modules/calendar/common/query-hooks/calendar-event/calendar-event-find-one.post-query.hook.ts
+++ b/packages/twenty-server/src/modules/calendar/common/query-hooks/calendar-event/calendar-event-find-one.post-query.hook.ts
@@ -11,7 +11,7 @@ import { CalendarEventWorkspaceEntity } from 'src/modules/calendar/common/standa
@WorkspaceQueryHook({
key: `calendarEvent.findOne`,
- type: WorkspaceQueryHookType.PostHook,
+ type: WorkspaceQueryHookType.POST_HOOK,
})
export class CalendarEventFindOnePostQueryHook
implements WorkspacePostQueryHookInstance
diff --git a/packages/twenty-server/src/modules/messaging/common/query-hooks/message/message-find-many.post-query.hook.ts b/packages/twenty-server/src/modules/messaging/common/query-hooks/message/message-find-many.post-query.hook.ts
index 8c03a766836..1a980f7cae7 100644
--- a/packages/twenty-server/src/modules/messaging/common/query-hooks/message/message-find-many.post-query.hook.ts
+++ b/packages/twenty-server/src/modules/messaging/common/query-hooks/message/message-find-many.post-query.hook.ts
@@ -11,7 +11,7 @@ import { MessageWorkspaceEntity } from 'src/modules/messaging/common/standard-ob
@WorkspaceQueryHook({
key: `message.findMany`,
- type: WorkspaceQueryHookType.PostHook,
+ type: WorkspaceQueryHookType.POST_HOOK,
})
export class MessageFindManyPostQueryHook
implements WorkspacePostQueryHookInstance
diff --git a/packages/twenty-server/src/modules/messaging/common/query-hooks/message/message-find-one.post-query.hook.ts b/packages/twenty-server/src/modules/messaging/common/query-hooks/message/message-find-one.post-query.hook.ts
index 05863d7d4df..abdb82ae353 100644
--- a/packages/twenty-server/src/modules/messaging/common/query-hooks/message/message-find-one.post-query.hook.ts
+++ b/packages/twenty-server/src/modules/messaging/common/query-hooks/message/message-find-one.post-query.hook.ts
@@ -11,7 +11,7 @@ import { MessageWorkspaceEntity } from 'src/modules/messaging/common/standard-ob
@WorkspaceQueryHook({
key: `message.findOne`,
- type: WorkspaceQueryHookType.PostHook,
+ type: WorkspaceQueryHookType.POST_HOOK,
})
export class MessageFindOnePostQueryHook
implements WorkspacePostQueryHookInstance
diff --git a/packages/twenty-server/src/modules/view/services/view.service.ts b/packages/twenty-server/src/modules/view/services/view.service.ts
index 63f7ab9d519..1ba3e03b156 100644
--- a/packages/twenty-server/src/modules/view/services/view.service.ts
+++ b/packages/twenty-server/src/modules/view/services/view.service.ts
@@ -3,7 +3,7 @@ import { Injectable, Logger } from '@nestjs/common';
import { isDefined } from 'class-validator';
import isEmpty from 'lodash.isempty';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager';
@Injectable()
@@ -140,7 +140,7 @@ export class ViewService {
{ kanbanAggregateOperationFieldMetadataId: fieldMetadataId },
{
kanbanAggregateOperationFieldMetadataId: null,
- kanbanAggregateOperation: AGGREGATE_OPERATIONS.count,
+ kanbanAggregateOperation: AggregateOperations.COUNT,
},
);
}
diff --git a/packages/twenty-server/src/modules/view/standard-objects/view-field.workspace-entity.ts b/packages/twenty-server/src/modules/view/standard-objects/view-field.workspace-entity.ts
index 6bd9819178f..2d871f1394f 100644
--- a/packages/twenty-server/src/modules/view/standard-objects/view-field.workspace-entity.ts
+++ b/packages/twenty-server/src/modules/view/standard-objects/view-field.workspace-entity.ts
@@ -6,7 +6,7 @@ import { Relation } from 'typeorm';
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { RelationOnDeleteAction } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
@@ -21,7 +21,7 @@ import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sy
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
import { ViewWorkspaceEntity } from 'src/modules/view/standard-objects/view.workspace-entity';
-registerEnumType(AGGREGATE_OPERATIONS, {
+registerEnumType(AggregateOperations, {
name: 'AggregateOperations',
});
@@ -99,73 +99,73 @@ export class ViewFieldWorkspaceEntity extends BaseWorkspaceEntity {
icon: 'IconCalculator',
options: [
{
- value: AGGREGATE_OPERATIONS.avg,
+ value: AggregateOperations.AVG,
label: 'Average',
position: 0,
color: 'red',
},
{
- value: AGGREGATE_OPERATIONS.count,
+ value: AggregateOperations.COUNT,
label: 'Count',
position: 1,
color: 'purple',
},
{
- value: AGGREGATE_OPERATIONS.max,
+ value: AggregateOperations.MAX,
label: 'Maximum',
position: 2,
color: 'sky',
},
{
- value: AGGREGATE_OPERATIONS.min,
+ value: AggregateOperations.MIN,
label: 'Minimum',
position: 3,
color: 'turquoise',
},
{
- value: AGGREGATE_OPERATIONS.sum,
+ value: AggregateOperations.SUM,
label: 'Sum',
position: 4,
color: 'yellow',
},
{
- value: AGGREGATE_OPERATIONS.countEmpty,
+ value: AggregateOperations.COUNT_EMPTY,
label: 'Count empty',
position: 5,
color: 'red',
},
{
- value: AGGREGATE_OPERATIONS.countNotEmpty,
+ value: AggregateOperations.COUNT_NOT_EMPTY,
label: 'Count not empty',
position: 6,
color: 'purple',
},
{
- value: AGGREGATE_OPERATIONS.countUniqueValues,
+ value: AggregateOperations.COUNT_UNIQUE_VALUES,
label: 'Count unique values',
position: 7,
color: 'sky',
},
{
- value: AGGREGATE_OPERATIONS.percentageEmpty,
+ value: AggregateOperations.PERCENTAGE_EMPTY,
label: 'Percent empty',
position: 8,
color: 'turquoise',
},
{
- value: AGGREGATE_OPERATIONS.percentageNotEmpty,
+ value: AggregateOperations.PERCENTAGE_NOT_EMPTY,
label: 'Percent not empty',
position: 9,
color: 'yellow',
},
{
- value: AGGREGATE_OPERATIONS.countTrue,
+ value: AggregateOperations.COUNT_TRUE,
label: 'Count true',
position: 10,
color: 'red',
},
{
- value: AGGREGATE_OPERATIONS.countFalse,
+ value: AggregateOperations.COUNT_FALSE,
label: 'Count false',
position: 11,
color: 'purple',
@@ -174,7 +174,7 @@ export class ViewFieldWorkspaceEntity extends BaseWorkspaceEntity {
defaultValue: null,
})
@WorkspaceIsNullable()
- aggregateOperation?: AGGREGATE_OPERATIONS | null;
+ aggregateOperation?: AggregateOperations | null;
@WorkspaceJoinColumn('view')
viewId: string;
diff --git a/packages/twenty-server/src/modules/view/standard-objects/view.workspace-entity.ts b/packages/twenty-server/src/modules/view/standard-objects/view.workspace-entity.ts
index d3c2118c2b0..5052d5f662f 100644
--- a/packages/twenty-server/src/modules/view/standard-objects/view.workspace-entity.ts
+++ b/packages/twenty-server/src/modules/view/standard-objects/view.workspace-entity.ts
@@ -7,7 +7,7 @@ import { RelationOnDeleteAction } from 'src/engine/metadata-modules/field-metada
import { RelationType } from 'src/engine/metadata-modules/field-metadata/interfaces/relation-type.interface';
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
-import { AGGREGATE_OPERATIONS } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
+import { AggregateOperations } from 'src/engine/api/graphql/graphql-query-runner/constants/aggregate-operations.constant';
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
@@ -221,82 +221,82 @@ export class ViewWorkspaceEntity extends BaseWorkspaceEntity {
icon: 'IconCalculator',
options: [
{
- value: AGGREGATE_OPERATIONS.avg,
+ value: AggregateOperations.AVG,
label: 'Average',
position: 0,
color: 'red',
},
{
- value: AGGREGATE_OPERATIONS.count,
+ value: AggregateOperations.COUNT,
label: 'Count',
position: 1,
color: 'purple',
},
{
- value: AGGREGATE_OPERATIONS.max,
+ value: AggregateOperations.MAX,
label: 'Maximum',
position: 2,
color: 'sky',
},
{
- value: AGGREGATE_OPERATIONS.min,
+ value: AggregateOperations.MIN,
label: 'Minimum',
position: 3,
color: 'turquoise',
},
{
- value: AGGREGATE_OPERATIONS.sum,
+ value: AggregateOperations.SUM,
label: 'Sum',
position: 4,
color: 'yellow',
},
{
- value: AGGREGATE_OPERATIONS.countEmpty,
+ value: AggregateOperations.COUNT_EMPTY,
label: 'Count empty',
position: 5,
color: 'red',
},
{
- value: AGGREGATE_OPERATIONS.countNotEmpty,
+ value: AggregateOperations.COUNT_NOT_EMPTY,
label: 'Count not empty',
position: 6,
color: 'purple',
},
{
- value: AGGREGATE_OPERATIONS.countUniqueValues,
+ value: AggregateOperations.COUNT_UNIQUE_VALUES,
label: 'Count unique values',
position: 7,
color: 'sky',
},
{
- value: AGGREGATE_OPERATIONS.percentageEmpty,
+ value: AggregateOperations.PERCENTAGE_EMPTY,
label: 'Percent empty',
position: 8,
color: 'turquoise',
},
{
- value: AGGREGATE_OPERATIONS.percentageNotEmpty,
+ value: AggregateOperations.PERCENTAGE_NOT_EMPTY,
label: 'Percent not empty',
position: 9,
color: 'yellow',
},
{
- value: AGGREGATE_OPERATIONS.countTrue,
+ value: AggregateOperations.COUNT_TRUE,
label: 'Count true',
position: 10,
color: 'red',
},
{
- value: AGGREGATE_OPERATIONS.countFalse,
+ value: AggregateOperations.COUNT_FALSE,
label: 'Count false',
position: 11,
color: 'purple',
},
],
- defaultValue: `'${AGGREGATE_OPERATIONS.count}'`,
+ defaultValue: `'${AggregateOperations.COUNT}'`,
})
@WorkspaceIsNullable()
- kanbanAggregateOperation?: AGGREGATE_OPERATIONS | null;
+ kanbanAggregateOperation?: AggregateOperations | null;
@WorkspaceField({
standardId: VIEW_STANDARD_FIELD_IDS.kanbanAggregateOperationFieldMetadataId,
diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-many.post-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-many.post-query.hook.ts
index 424e8f8b533..878731ce258 100644
--- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-many.post-query.hook.ts
+++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-many.post-query.hook.ts
@@ -20,7 +20,7 @@ import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-ob
@WorkspaceQueryHook({
key: `workflow.createMany`,
- type: WorkspaceQueryHookType.PostHook,
+ type: WorkspaceQueryHookType.POST_HOOK,
})
export class WorkflowCreateManyPostQueryHook
implements WorkspacePostQueryHookInstance
diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-one.post-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-one.post-query.hook.ts
index d5822fbd1e1..67cc8fdfcd6 100644
--- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-one.post-query.hook.ts
+++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-create-one.post-query.hook.ts
@@ -20,7 +20,7 @@ import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-ob
@WorkspaceQueryHook({
key: `workflow.createOne`,
- type: WorkspaceQueryHookType.PostHook,
+ type: WorkspaceQueryHookType.POST_HOOK,
})
export class WorkflowCreateOnePostQueryHook
implements WorkspacePostQueryHookInstance
diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-delete-many.post-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-delete-many.post-query.hook.ts
index 759c75c67c2..467e756c978 100644
--- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-delete-many.post-query.hook.ts
+++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-delete-many.post-query.hook.ts
@@ -8,7 +8,7 @@ import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/work
@WorkspaceQueryHook({
key: `workflow.deleteMany`,
- type: WorkspaceQueryHookType.PostHook,
+ type: WorkspaceQueryHookType.POST_HOOK,
})
export class WorkflowDeleteManyPostQueryHook
implements WorkspacePostQueryHookInstance
diff --git a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-delete-one.post-query.hook.ts b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-delete-one.post-query.hook.ts
index 9bfaa8605ce..280537e93c2 100644
--- a/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-delete-one.post-query.hook.ts
+++ b/packages/twenty-server/src/modules/workflow/common/query-hooks/workflow-delete-one.post-query.hook.ts
@@ -8,7 +8,7 @@ import { WorkflowCommonWorkspaceService } from 'src/modules/workflow/common/work
@WorkspaceQueryHook({
key: `workflow.deleteOne`,
- type: WorkspaceQueryHookType.PostHook,
+ type: WorkspaceQueryHookType.POST_HOOK,
})
export class WorkflowDeleteOnePostQueryHook
implements WorkspacePostQueryHookInstance
diff --git a/packages/twenty-server/src/modules/workflow/workflow-trigger/automated-trigger/listeners/database-event-trigger.listener.ts b/packages/twenty-server/src/modules/workflow/workflow-trigger/automated-trigger/listeners/database-event-trigger.listener.ts
index 755f164e885..5b09608ed7d 100644
--- a/packages/twenty-server/src/modules/workflow/workflow-trigger/automated-trigger/listeners/database-event-trigger.listener.ts
+++ b/packages/twenty-server/src/modules/workflow/workflow-trigger/automated-trigger/listeners/database-event-trigger.listener.ts
@@ -232,7 +232,7 @@ export class DatabaseEventTriggerListener {
const isWorkflowEnabled =
await this.isFeatureFlagEnabledService.isFeatureEnabled(
- FeatureFlagKey.IsWorkflowEnabled,
+ FeatureFlagKey.IS_WORKFLOW_ENABLED,
workspaceId,
);
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/create-many-object-records-permissions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/create-many-object-records-permissions.integration-spec.ts
index 5dacfd1f2aa..1bf388ba179 100644
--- a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/create-many-object-records-permissions.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/create-many-object-records-permissions.integration-spec.ts
@@ -68,7 +68,7 @@ describe('createManyObjectRecordsPermissions', () => {
// beforeAll(async () => {
// const enablePermissionsQuery = updateFeatureFlagFactory(
// SEED_APPLE_WORKSPACE_ID,
- // 'IsPermissionsV2Enabled',
+ // 'IS_PERMISSIONS_V2_ENABLED',
// true,
// );
@@ -78,7 +78,7 @@ describe('createManyObjectRecordsPermissions', () => {
// afterAll(async () => {
// const disablePermissionsQuery = updateFeatureFlagFactory(
// SEED_APPLE_WORKSPACE_ID,
- // 'IsPermissionsV2Enabled',
+ // 'IS_PERMISSIONS_V2_ENABLED',
// false,
// );
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/create-one-object-records-permissions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/create-one-object-records-permissions.integration-spec.ts
index 56f57c16ca9..4443b0f3220 100644
--- a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/create-one-object-records-permissions.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/create-one-object-records-permissions.integration-spec.ts
@@ -55,7 +55,7 @@ describe('createOneObjectRecordsPermissions', () => {
beforeAll(async () => {
const enablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
true,
);
@@ -65,7 +65,7 @@ describe('createOneObjectRecordsPermissions', () => {
afterAll(async () => {
const disablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
false,
);
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/delete-many-object-records-permissions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/delete-many-object-records-permissions.integration-spec.ts
index c557a5c48f7..20305ea8039 100644
--- a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/delete-many-object-records-permissions.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/delete-many-object-records-permissions.integration-spec.ts
@@ -82,7 +82,7 @@ describe('deleteManyObjectRecordsPermissions', () => {
beforeAll(async () => {
const enablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
true,
);
@@ -92,7 +92,7 @@ describe('deleteManyObjectRecordsPermissions', () => {
afterAll(async () => {
const disablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
false,
);
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/delete-one-object-records-permissions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/delete-one-object-records-permissions.integration-spec.ts
index 6ac5ba4eb39..e3d55fe0339 100644
--- a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/delete-one-object-records-permissions.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/delete-one-object-records-permissions.integration-spec.ts
@@ -78,7 +78,7 @@ describe('deleteOneObjectRecordsPermissions', () => {
const enablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
true,
);
@@ -88,7 +88,7 @@ describe('deleteOneObjectRecordsPermissions', () => {
afterAll(async () => {
const disablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
false,
);
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/destroy-many-object-records-permissions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/destroy-many-object-records-permissions.integration-spec.ts
index 3d7f10418d3..9d2ef0959e8 100644
--- a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/destroy-many-object-records-permissions.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/destroy-many-object-records-permissions.integration-spec.ts
@@ -81,7 +81,7 @@ describe('destroyManyObjectRecordsPermissions', () => {
beforeAll(async () => {
const enablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
true,
);
@@ -91,7 +91,7 @@ describe('destroyManyObjectRecordsPermissions', () => {
afterAll(async () => {
const disablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
false,
);
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/destroy-one-object-records-permissions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/destroy-one-object-records-permissions.integration-spec.ts
index 3bfb818f3a0..38c84393c03 100644
--- a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/destroy-one-object-records-permissions.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/destroy-one-object-records-permissions.integration-spec.ts
@@ -76,7 +76,7 @@ describe('destroyOneObjectRecordsPermissions', () => {
const enablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
true,
);
@@ -86,7 +86,7 @@ describe('destroyOneObjectRecordsPermissions', () => {
afterAll(async () => {
const disablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
false,
);
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/restore-many-object-records-permissions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/restore-many-object-records-permissions.integration-spec.ts
index 44d059e6543..6fd44433ea9 100644
--- a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/restore-many-object-records-permissions.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/restore-many-object-records-permissions.integration-spec.ts
@@ -133,7 +133,7 @@ describe('restoreManyObjectRecordsPermissions', () => {
const enablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
true,
);
@@ -143,7 +143,7 @@ describe('restoreManyObjectRecordsPermissions', () => {
afterAll(async () => {
const disablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
false,
);
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/update-many-object-records-permissions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/update-many-object-records-permissions.integration-spec.ts
index d4ab07d88c3..52040332526 100644
--- a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/update-many-object-records-permissions.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/update-many-object-records-permissions.integration-spec.ts
@@ -90,7 +90,7 @@ describe('updateManyObjectRecordsPermissions', () => {
beforeAll(async () => {
const enablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
true,
);
@@ -100,7 +100,7 @@ describe('updateManyObjectRecordsPermissions', () => {
afterAll(async () => {
const disablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
false,
);
diff --git a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/update-one-object-records-permissions.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/update-one-object-records-permissions.integration-spec.ts
index fda37a11efb..6a1c6caf992 100644
--- a/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/update-one-object-records-permissions.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/object-records-permissions/update-one-object-records-permissions.integration-spec.ts
@@ -90,7 +90,7 @@ describe('updateOneObjectRecordsPermissions', () => {
const enablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
true,
);
@@ -116,7 +116,7 @@ describe('updateOneObjectRecordsPermissions', () => {
afterAll(async () => {
const disablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
false,
);
diff --git a/packages/twenty-server/test/integration/graphql/suites/settings-permissions/roles.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/settings-permissions/roles.integration-spec.ts
index e59e7c79cce..e28b5af1428 100644
--- a/packages/twenty-server/test/integration/graphql/suites/settings-permissions/roles.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/settings-permissions/roles.integration-spec.ts
@@ -40,7 +40,7 @@ describe('roles permissions', () => {
beforeAll(async () => {
const enablePermissionsV2Query = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
true,
);
@@ -76,7 +76,7 @@ describe('roles permissions', () => {
afterAll(async () => {
const disablePermissionsV2Query = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsV2Enabled',
+ 'IS_PERMISSIONS_V2_ENABLED',
false,
);
diff --git a/packages/twenty-server/test/integration/graphql/suites/settings-permissions/workspace.integration-spec.ts b/packages/twenty-server/test/integration/graphql/suites/settings-permissions/workspace.integration-spec.ts
index e8a4fe6d36f..3304b4958af 100644
--- a/packages/twenty-server/test/integration/graphql/suites/settings-permissions/workspace.integration-spec.ts
+++ b/packages/twenty-server/test/integration/graphql/suites/settings-permissions/workspace.integration-spec.ts
@@ -25,7 +25,6 @@ describe('workspace permissions', () => {
logo
isPublicInviteLinkEnabled
subdomain
- isCustomDomainEnabled
}
}
`;
@@ -38,7 +37,7 @@ describe('workspace permissions', () => {
afterAll(async () => {
const disablePermissionsQuery = updateFeatureFlagFactory(
SEED_APPLE_WORKSPACE_ID,
- 'IsPermissionsEnabled',
+ 'IS_PERMISSIONS_ENABLED',
false,
);
@@ -463,7 +462,7 @@ describe('workspace permissions', () => {
`,
variables: {
input: {
- publicFeatureFlag: 'IsStripeIntegrationEnabled',
+ publicFeatureFlag: 'IS_STRIPE_INTEGRATION_ENABLED',
value: true,
},
},
diff --git a/packages/twenty-ui/src/utilities/index.ts b/packages/twenty-ui/src/utilities/index.ts
index c6805b1bbd0..4ad512a6d37 100644
--- a/packages/twenty-ui/src/utilities/index.ts
+++ b/packages/twenty-ui/src/utilities/index.ts
@@ -29,4 +29,3 @@ export { createState } from './state/utils/createState';
export type { ClickOutsideAttributes } from './types/ClickOutsideAttributes';
export type { Nullable } from './types/Nullable';
export { getDisplayValueByUrlType } from './utils/getDisplayValueByUrlType';
-