From 0bdd1c48034b638ee23d607071aec2a2d025e7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bosi?= <71827178+bosiraphael@users.noreply.github.com> Date: Fri, 29 Aug 2025 11:20:56 +0200 Subject: [PATCH] Various fixes on core views (#14093) - Fix fragments - Add id to create inputs - Refresh core views - Fix kanban loading - Fix core views creation from current view --------- Co-authored-by: Charles Bochet --- .../src/generated-metadata/graphql.ts | 87 +++++++++---------- .../twenty-front/src/generated/graphql.ts | 83 +++++++++--------- .../favorites/hooks/useFavoritesByFolder.ts | 12 ++- .../favorites/hooks/useWorkspaceFavorites.ts | 19 +++- .../favoriteViewsWithMinimalDataSelector.ts | 17 +++- .../modules/favorites/utils/sortFavorites.ts | 5 +- ...ionDrawerSectionForObjectMetadataItems.tsx | 12 +-- .../useSetViewTypeFromLayoutOptionsMenu.ts | 8 +- .../hooks/useLoadRecordIndexStates.ts | 3 +- .../components/UpdateViewButtonGroup.tsx | 7 ++ .../graphql/fragments/viewFieldFragment.ts | 2 - .../graphql/fragments/viewFilterFragment.ts | 2 - .../fragments/viewFilterGroupFragment.ts | 2 - .../views/graphql/fragments/viewFragment.ts | 2 - .../graphql/fragments/viewGroupFragment.ts | 2 - .../graphql/fragments/viewSortFragment.ts | 2 - .../internal/usePersistViewFieldRecords.ts | 5 +- .../usePersistViewFilterGroupRecords.ts | 9 +- .../internal/usePersistViewFilterRecords.ts | 9 +- .../internal/usePersistViewGroupRecords.ts | 7 +- .../internal/usePersistViewSortRecords.ts | 9 +- .../hooks/useCreateViewFromCurrentView.ts | 52 ++++------- .../views/hooks/useRefreshCoreViews.ts | 42 +++++++++ .../views/hooks/useSaveCurrentViewFields.ts | 2 +- ...aveRecordFilterGroupsToViewFilterGroups.ts | 8 +- .../useSaveRecordFiltersToViewFilters.ts | 8 +- .../hooks/useSaveRecordSortsToViewSorts.ts | 8 +- .../src/modules/views/hooks/useUpdateView.ts | 46 ++++++---- ...reViewsByObjectMetadataIdFamilySelector.ts | 41 +++++++++ .../views/types/CoreViewWithRelations.ts | 16 ++-- .../utils/convertCoreViewFieldToViewField.ts | 10 ++- ...ertCoreViewFilterGroupToViewFilterGroup.ts | 9 +- .../convertCoreViewFilterToViewFilter.ts | 21 +++-- .../utils/convertCoreViewGroupToViewGroup.ts | 5 +- .../utils/convertCoreViewSortToViewSort.ts | 2 +- .../utils/convertUpdateViewInputToCore.ts | 5 +- .../views/utils/getViewFiltersToCreate.ts | 2 +- .../views/utils/getViewFiltersToUpdate.ts | 2 +- .../engine/core-modules/file/dtos/file.dto.ts | 2 +- .../dtos/inputs/create-view-field.input.ts | 3 + .../inputs/create-view-filter-group.input.ts | 3 + .../dtos/inputs/create-view-filter.input.ts | 3 + .../dtos/inputs/create-view-group.input.ts | 5 +- .../dtos/inputs/create-view-sort.input.ts | 3 + .../view/dtos/inputs/create-view.input.ts | 3 + .../workspace-manager.service.spec.ts | 13 ++- .../data/services/dev-seeder-data.service.ts | 24 ----- .../services/dev-seeder-metadata.service.ts | 19 ++-- .../prefill-companies.ts | 9 +- .../prefill-core-views.ts | 43 +++++++-- .../prefill-people.ts | 9 +- .../prefill-views.ts | 22 ++--- .../prefill-workflows.ts | 12 +-- .../prefill-workspace-favorites.ts | 9 +- .../standard-objects-prefill-data.ts | 58 ++++++------- .../workspace-manager.service.ts | 22 +++-- 56 files changed, 504 insertions(+), 341 deletions(-) create mode 100644 packages/twenty-front/src/modules/views/hooks/useRefreshCoreViews.ts create mode 100644 packages/twenty-front/src/modules/views/states/coreViewsByObjectMetadataIdFamilySelector.ts diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts index 92fd89aefd8..046c8a13fc4 100644 --- a/packages/twenty-front/src/generated-metadata/graphql.ts +++ b/packages/twenty-front/src/generated-metadata/graphql.ts @@ -717,6 +717,7 @@ export type CreateServerlessFunctionInput = { export type CreateViewFieldInput = { aggregateOperation?: InputMaybe; fieldMetadataId: Scalars['UUID']; + id?: InputMaybe; isVisible?: InputMaybe; position?: InputMaybe; size?: InputMaybe; @@ -724,6 +725,7 @@ export type CreateViewFieldInput = { }; export type CreateViewFilterGroupInput = { + id?: InputMaybe; logicalOperator?: InputMaybe; parentViewFilterGroupId?: InputMaybe; positionInViewFilterGroup?: InputMaybe; @@ -732,6 +734,7 @@ export type CreateViewFilterGroupInput = { export type CreateViewFilterInput = { fieldMetadataId: Scalars['UUID']; + id?: InputMaybe; operand?: InputMaybe; positionInViewFilterGroup?: InputMaybe; subFieldName?: InputMaybe; @@ -743,6 +746,7 @@ export type CreateViewFilterInput = { export type CreateViewGroupInput = { fieldMetadataId: Scalars['UUID']; fieldValue: Scalars['String']; + id?: InputMaybe; isVisible?: InputMaybe; position?: InputMaybe; viewId: Scalars['UUID']; @@ -751,6 +755,7 @@ export type CreateViewGroupInput = { export type CreateViewInput = { anyFieldFilterValue?: InputMaybe; icon: Scalars['String']; + id?: InputMaybe; isCompact?: InputMaybe; kanbanAggregateOperation?: InputMaybe; kanbanAggregateOperationFieldMetadataId?: InputMaybe; @@ -765,6 +770,7 @@ export type CreateViewInput = { export type CreateViewSortInput = { direction?: InputMaybe; fieldMetadataId: Scalars['UUID']; + id?: InputMaybe; viewId: Scalars['UUID']; }; @@ -3292,6 +3298,7 @@ export type UpdateViewFieldInput = { }; export type UpdateViewFilterGroupInput = { + id?: InputMaybe; logicalOperator?: InputMaybe; parentViewFilterGroupId?: InputMaybe; positionInViewFilterGroup?: InputMaybe; @@ -3300,6 +3307,7 @@ export type UpdateViewFilterGroupInput = { export type UpdateViewFilterInput = { fieldMetadataId?: InputMaybe; + id?: InputMaybe; operand?: InputMaybe; positionInViewFilterGroup?: InputMaybe; subFieldName?: InputMaybe; @@ -3311,6 +3319,7 @@ export type UpdateViewFilterInput = { export type UpdateViewGroupInput = { fieldMetadataId?: InputMaybe; fieldValue?: InputMaybe; + id?: InputMaybe; isVisible?: InputMaybe; position?: InputMaybe; viewId?: InputMaybe; @@ -3319,6 +3328,7 @@ export type UpdateViewGroupInput = { export type UpdateViewInput = { anyFieldFilterValue?: InputMaybe; icon?: InputMaybe; + id?: InputMaybe; isCompact?: InputMaybe; kanbanAggregateOperation?: InputMaybe; kanbanAggregateOperationFieldMetadataId?: InputMaybe; @@ -3333,6 +3343,7 @@ export type UpdateViewInput = { export type UpdateViewSortInput = { direction?: InputMaybe; fieldMetadataId?: InputMaybe; + id?: InputMaybe; viewId?: InputMaybe; }; @@ -4628,7 +4639,7 @@ export type VerifyTwoFactorAuthenticationMethodForAuthenticatedUserMutationVaria export type VerifyTwoFactorAuthenticationMethodForAuthenticatedUserMutation = { __typename?: 'Mutation', verifyTwoFactorAuthenticationMethodForAuthenticatedUser: { __typename?: 'VerifyTwoFactorAuthenticationMethodOutput', success: boolean } }; -export type UserQueryFragmentFragment = { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canAccessFullAdminPanel: boolean, canImpersonate: boolean, supportUserHash?: string | null, onboardingStatus?: OnboardingStatus | null, userVars?: any | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, workspaceMembers?: Array<{ __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, deletedWorkspaceMembers?: Array<{ __typename?: 'DeletedWorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, currentUserWorkspace?: { __typename?: 'UserWorkspace', permissionFlags?: Array | null, objectRecordsPermissions?: Array | null, objectPermissions?: Array<{ __typename?: 'ObjectPermission', objectMetadataId: string, canReadObjectRecords?: boolean | null, canUpdateObjectRecords?: boolean | null, canSoftDeleteObjectRecords?: boolean | null, canDestroyObjectRecords?: boolean | null, restrictedFields?: any | null }> | null, twoFactorAuthenticationMethodSummary?: Array<{ __typename?: 'TwoFactorAuthenticationMethodDTO', twoFactorAuthenticationMethodId: string, status: string, strategy: string }> | null } | null, currentWorkspace?: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, inviteHash?: string | null, allowImpersonation: boolean, activationStatus: WorkspaceActivationStatus, isPublicInviteLinkEnabled: boolean, isGoogleAuthEnabled: boolean, isMicrosoftAuthEnabled: boolean, isPasswordAuthEnabled: boolean, subdomain: string, hasValidEnterpriseKey: boolean, customDomain?: string | null, isCustomDomainEnabled: boolean, metadataVersion: number, workspaceMembersCount?: number | null, isTwoFactorAuthenticationEnforced: boolean, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, featureFlags?: Array<{ __typename?: 'FeatureFlagDTO', key: FeatureFlagKey, value: boolean }> | null, currentBillingSubscription?: { __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, interval?: SubscriptionInterval | null, metadata: any, billingSubscriptionItems?: Array<{ __typename?: 'BillingSubscriptionItem', id: string, hasReachedCurrentPeriodCap: boolean, quantity?: number | null, billingProduct?: { __typename?: 'BillingProduct', name: string, description: string, metadata: { __typename?: 'BillingProductMetadata', planKey: BillingPlanKey, priceUsageBased: BillingUsageType, productKey: BillingProductKey } } | null }> | null } | null, billingSubscriptions: Array<{ __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, metadata: any }>, defaultRole?: { __typename?: 'Role', id: string, label: string, description?: string | null, icon?: string | null, canUpdateAllSettings: boolean, canAccessAllTools: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean } | null, defaultAgent?: { __typename?: 'Agent', id: string } | null, views?: Array<{ __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string }> }> | null } | null, availableWorkspaces: { __typename?: 'AvailableWorkspaces', availableWorkspacesForSignIn: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }>, availableWorkspacesForSignUp: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }> } }; +export type UserQueryFragmentFragment = { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canAccessFullAdminPanel: boolean, canImpersonate: boolean, supportUserHash?: string | null, onboardingStatus?: OnboardingStatus | null, userVars?: any | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, workspaceMembers?: Array<{ __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, deletedWorkspaceMembers?: Array<{ __typename?: 'DeletedWorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, currentUserWorkspace?: { __typename?: 'UserWorkspace', permissionFlags?: Array | null, objectRecordsPermissions?: Array | null, objectPermissions?: Array<{ __typename?: 'ObjectPermission', objectMetadataId: string, canReadObjectRecords?: boolean | null, canUpdateObjectRecords?: boolean | null, canSoftDeleteObjectRecords?: boolean | null, canDestroyObjectRecords?: boolean | null, restrictedFields?: any | null }> | null, twoFactorAuthenticationMethodSummary?: Array<{ __typename?: 'TwoFactorAuthenticationMethodDTO', twoFactorAuthenticationMethodId: string, status: string, strategy: string }> | null } | null, currentWorkspace?: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, inviteHash?: string | null, allowImpersonation: boolean, activationStatus: WorkspaceActivationStatus, isPublicInviteLinkEnabled: boolean, isGoogleAuthEnabled: boolean, isMicrosoftAuthEnabled: boolean, isPasswordAuthEnabled: boolean, subdomain: string, hasValidEnterpriseKey: boolean, customDomain?: string | null, isCustomDomainEnabled: boolean, metadataVersion: number, workspaceMembersCount?: number | null, isTwoFactorAuthenticationEnforced: boolean, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, featureFlags?: Array<{ __typename?: 'FeatureFlagDTO', key: FeatureFlagKey, value: boolean }> | null, currentBillingSubscription?: { __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, interval?: SubscriptionInterval | null, metadata: any, billingSubscriptionItems?: Array<{ __typename?: 'BillingSubscriptionItem', id: string, hasReachedCurrentPeriodCap: boolean, quantity?: number | null, billingProduct?: { __typename?: 'BillingProduct', name: string, description: string, metadata: { __typename?: 'BillingProductMetadata', planKey: BillingPlanKey, priceUsageBased: BillingUsageType, productKey: BillingProductKey } } | null }> | null } | null, billingSubscriptions: Array<{ __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, metadata: any }>, defaultRole?: { __typename?: 'Role', id: string, label: string, description?: string | null, icon?: string | null, canUpdateAllSettings: boolean, canAccessAllTools: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean } | null, defaultAgent?: { __typename?: 'Agent', id: string } | null, views?: Array<{ __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string }> }> | null } | null, availableWorkspaces: { __typename?: 'AvailableWorkspaces', availableWorkspacesForSignIn: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }>, availableWorkspacesForSignUp: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }> } }; export type WorkspaceUrlsFragmentFragment = { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }; @@ -4647,61 +4658,61 @@ export type UploadProfilePictureMutation = { __typename?: 'Mutation', uploadProf export type GetCurrentUserQueryVariables = Exact<{ [key: string]: never; }>; -export type GetCurrentUserQuery = { __typename?: 'Query', currentUser: { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canAccessFullAdminPanel: boolean, canImpersonate: boolean, supportUserHash?: string | null, onboardingStatus?: OnboardingStatus | null, userVars?: any | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, workspaceMembers?: Array<{ __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, deletedWorkspaceMembers?: Array<{ __typename?: 'DeletedWorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, currentUserWorkspace?: { __typename?: 'UserWorkspace', permissionFlags?: Array | null, objectRecordsPermissions?: Array | null, objectPermissions?: Array<{ __typename?: 'ObjectPermission', objectMetadataId: string, canReadObjectRecords?: boolean | null, canUpdateObjectRecords?: boolean | null, canSoftDeleteObjectRecords?: boolean | null, canDestroyObjectRecords?: boolean | null, restrictedFields?: any | null }> | null, twoFactorAuthenticationMethodSummary?: Array<{ __typename?: 'TwoFactorAuthenticationMethodDTO', twoFactorAuthenticationMethodId: string, status: string, strategy: string }> | null } | null, currentWorkspace?: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, inviteHash?: string | null, allowImpersonation: boolean, activationStatus: WorkspaceActivationStatus, isPublicInviteLinkEnabled: boolean, isGoogleAuthEnabled: boolean, isMicrosoftAuthEnabled: boolean, isPasswordAuthEnabled: boolean, subdomain: string, hasValidEnterpriseKey: boolean, customDomain?: string | null, isCustomDomainEnabled: boolean, metadataVersion: number, workspaceMembersCount?: number | null, isTwoFactorAuthenticationEnforced: boolean, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, featureFlags?: Array<{ __typename?: 'FeatureFlagDTO', key: FeatureFlagKey, value: boolean }> | null, currentBillingSubscription?: { __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, interval?: SubscriptionInterval | null, metadata: any, billingSubscriptionItems?: Array<{ __typename?: 'BillingSubscriptionItem', id: string, hasReachedCurrentPeriodCap: boolean, quantity?: number | null, billingProduct?: { __typename?: 'BillingProduct', name: string, description: string, metadata: { __typename?: 'BillingProductMetadata', planKey: BillingPlanKey, priceUsageBased: BillingUsageType, productKey: BillingProductKey } } | null }> | null } | null, billingSubscriptions: Array<{ __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, metadata: any }>, defaultRole?: { __typename?: 'Role', id: string, label: string, description?: string | null, icon?: string | null, canUpdateAllSettings: boolean, canAccessAllTools: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean } | null, defaultAgent?: { __typename?: 'Agent', id: string } | null, views?: Array<{ __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string }> }> | null } | null, availableWorkspaces: { __typename?: 'AvailableWorkspaces', availableWorkspacesForSignIn: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }>, availableWorkspacesForSignUp: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }> } } }; +export type GetCurrentUserQuery = { __typename?: 'Query', currentUser: { __typename?: 'User', id: string, firstName: string, lastName: string, email: string, canAccessFullAdminPanel: boolean, canImpersonate: boolean, supportUserHash?: string | null, onboardingStatus?: OnboardingStatus | null, userVars?: any | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, workspaceMembers?: Array<{ __typename?: 'WorkspaceMember', id: string, colorScheme: string, avatarUrl?: string | null, locale?: string | null, userEmail: string, timeZone?: string | null, dateFormat?: WorkspaceMemberDateFormatEnum | null, timeFormat?: WorkspaceMemberTimeFormatEnum | null, calendarStartDay?: number | null, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, deletedWorkspaceMembers?: Array<{ __typename?: 'DeletedWorkspaceMember', id: string, avatarUrl?: string | null, userEmail: string, name: { __typename?: 'FullName', firstName: string, lastName: string } }> | null, currentUserWorkspace?: { __typename?: 'UserWorkspace', permissionFlags?: Array | null, objectRecordsPermissions?: Array | null, objectPermissions?: Array<{ __typename?: 'ObjectPermission', objectMetadataId: string, canReadObjectRecords?: boolean | null, canUpdateObjectRecords?: boolean | null, canSoftDeleteObjectRecords?: boolean | null, canDestroyObjectRecords?: boolean | null, restrictedFields?: any | null }> | null, twoFactorAuthenticationMethodSummary?: Array<{ __typename?: 'TwoFactorAuthenticationMethodDTO', twoFactorAuthenticationMethodId: string, status: string, strategy: string }> | null } | null, currentWorkspace?: { __typename?: 'Workspace', id: string, displayName?: string | null, logo?: string | null, inviteHash?: string | null, allowImpersonation: boolean, activationStatus: WorkspaceActivationStatus, isPublicInviteLinkEnabled: boolean, isGoogleAuthEnabled: boolean, isMicrosoftAuthEnabled: boolean, isPasswordAuthEnabled: boolean, subdomain: string, hasValidEnterpriseKey: boolean, customDomain?: string | null, isCustomDomainEnabled: boolean, metadataVersion: number, workspaceMembersCount?: number | null, isTwoFactorAuthenticationEnforced: boolean, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, featureFlags?: Array<{ __typename?: 'FeatureFlagDTO', key: FeatureFlagKey, value: boolean }> | null, currentBillingSubscription?: { __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, interval?: SubscriptionInterval | null, metadata: any, billingSubscriptionItems?: Array<{ __typename?: 'BillingSubscriptionItem', id: string, hasReachedCurrentPeriodCap: boolean, quantity?: number | null, billingProduct?: { __typename?: 'BillingProduct', name: string, description: string, metadata: { __typename?: 'BillingProductMetadata', planKey: BillingPlanKey, priceUsageBased: BillingUsageType, productKey: BillingProductKey } } | null }> | null } | null, billingSubscriptions: Array<{ __typename?: 'BillingSubscription', id: string, status: SubscriptionStatus, metadata: any }>, defaultRole?: { __typename?: 'Role', id: string, label: string, description?: string | null, icon?: string | null, canUpdateAllSettings: boolean, canAccessAllTools: boolean, isEditable: boolean, canReadAllObjectRecords: boolean, canUpdateAllObjectRecords: boolean, canSoftDeleteAllObjectRecords: boolean, canDestroyAllObjectRecords: boolean } | null, defaultAgent?: { __typename?: 'Agent', id: string } | null, views?: Array<{ __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string }> }> | null } | null, availableWorkspaces: { __typename?: 'AvailableWorkspaces', availableWorkspacesForSignIn: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }>, availableWorkspacesForSignUp: Array<{ __typename?: 'AvailableWorkspace', id: string, displayName?: string | null, loginToken?: string | null, inviteHash?: string | null, personalInviteToken?: string | null, logo?: string | null, workspaceUrls: { __typename?: 'WorkspaceUrls', subdomainUrl: string, customUrl?: string | null }, sso: Array<{ __typename?: 'SSOConnection', type: IdentityProviderType, id: string, issuer: string, name: string, status: SsoIdentityProviderStatus }> }> } } }; -export type ViewFieldFragmentFragment = { __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }; +export type ViewFieldFragmentFragment = { __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }; -export type ViewFilterFragmentFragment = { __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string }; +export type ViewFilterFragmentFragment = { __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string }; -export type ViewFilterGroupFragmentFragment = { __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string }; +export type ViewFilterGroupFragmentFragment = { __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string }; -export type ViewFragmentFragment = { __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string }> }; +export type ViewFragmentFragment = { __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string }> }; -export type ViewGroupFragmentFragment = { __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string }; +export type ViewGroupFragmentFragment = { __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string }; -export type ViewSortFragmentFragment = { __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string }; +export type ViewSortFragmentFragment = { __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string }; export type CreateCoreViewMutationVariables = Exact<{ input: CreateViewInput; }>; -export type CreateCoreViewMutation = { __typename?: 'Mutation', createCoreView: { __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string }> } }; +export type CreateCoreViewMutation = { __typename?: 'Mutation', createCoreView: { __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string }> } }; export type CreateCoreViewFieldMutationVariables = Exact<{ input: CreateViewFieldInput; }>; -export type CreateCoreViewFieldMutation = { __typename?: 'Mutation', createCoreViewField: { __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string } }; +export type CreateCoreViewFieldMutation = { __typename?: 'Mutation', createCoreViewField: { __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null } }; export type CreateCoreViewFilterMutationVariables = Exact<{ input: CreateViewFilterInput; }>; -export type CreateCoreViewFilterMutation = { __typename?: 'Mutation', createCoreViewFilter: { __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string } }; +export type CreateCoreViewFilterMutation = { __typename?: 'Mutation', createCoreViewFilter: { __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string } }; export type CreateCoreViewFilterGroupMutationVariables = Exact<{ input: CreateViewFilterGroupInput; }>; -export type CreateCoreViewFilterGroupMutation = { __typename?: 'Mutation', createCoreViewFilterGroup: { __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string } }; +export type CreateCoreViewFilterGroupMutation = { __typename?: 'Mutation', createCoreViewFilterGroup: { __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string } }; export type CreateCoreViewGroupMutationVariables = Exact<{ input: CreateViewGroupInput; }>; -export type CreateCoreViewGroupMutation = { __typename?: 'Mutation', createCoreViewGroup: { __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string } }; +export type CreateCoreViewGroupMutation = { __typename?: 'Mutation', createCoreViewGroup: { __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string } }; export type CreateCoreViewSortMutationVariables = Exact<{ input: CreateViewSortInput; }>; -export type CreateCoreViewSortMutation = { __typename?: 'Mutation', createCoreViewSort: { __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string } }; +export type CreateCoreViewSortMutation = { __typename?: 'Mutation', createCoreViewSort: { __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string } }; export type DeleteCoreViewMutationVariables = Exact<{ id: Scalars['String']; @@ -4793,7 +4804,7 @@ export type UpdateCoreViewMutationVariables = Exact<{ }>; -export type UpdateCoreViewMutation = { __typename?: 'Mutation', updateCoreView: { __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string }> } }; +export type UpdateCoreViewMutation = { __typename?: 'Mutation', updateCoreView: { __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string }> } }; export type UpdateCoreViewFieldMutationVariables = Exact<{ id: Scalars['String']; @@ -4801,7 +4812,7 @@ export type UpdateCoreViewFieldMutationVariables = Exact<{ }>; -export type UpdateCoreViewFieldMutation = { __typename?: 'Mutation', updateCoreViewField: { __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string } }; +export type UpdateCoreViewFieldMutation = { __typename?: 'Mutation', updateCoreViewField: { __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null } }; export type UpdateCoreViewFilterMutationVariables = Exact<{ id: Scalars['String']; @@ -4809,7 +4820,7 @@ export type UpdateCoreViewFilterMutationVariables = Exact<{ }>; -export type UpdateCoreViewFilterMutation = { __typename?: 'Mutation', updateCoreViewFilter: { __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string } }; +export type UpdateCoreViewFilterMutation = { __typename?: 'Mutation', updateCoreViewFilter: { __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string } }; export type UpdateCoreViewFilterGroupMutationVariables = Exact<{ id: Scalars['String']; @@ -4817,7 +4828,7 @@ export type UpdateCoreViewFilterGroupMutationVariables = Exact<{ }>; -export type UpdateCoreViewFilterGroupMutation = { __typename?: 'Mutation', updateCoreViewFilterGroup: { __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string } }; +export type UpdateCoreViewFilterGroupMutation = { __typename?: 'Mutation', updateCoreViewFilterGroup: { __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string } }; export type UpdateCoreViewGroupMutationVariables = Exact<{ id: Scalars['String']; @@ -4825,7 +4836,7 @@ export type UpdateCoreViewGroupMutationVariables = Exact<{ }>; -export type UpdateCoreViewGroupMutation = { __typename?: 'Mutation', updateCoreViewGroup: { __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string } }; +export type UpdateCoreViewGroupMutation = { __typename?: 'Mutation', updateCoreViewGroup: { __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string } }; export type UpdateCoreViewSortMutationVariables = Exact<{ id: Scalars['String']; @@ -4833,91 +4844,91 @@ export type UpdateCoreViewSortMutationVariables = Exact<{ }>; -export type UpdateCoreViewSortMutation = { __typename?: 'Mutation', updateCoreViewSort: { __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string } }; +export type UpdateCoreViewSortMutation = { __typename?: 'Mutation', updateCoreViewSort: { __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string } }; export type FindManyCoreViewFieldsQueryVariables = Exact<{ viewId: Scalars['String']; }>; -export type FindManyCoreViewFieldsQuery = { __typename?: 'Query', getCoreViewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }> }; +export type FindManyCoreViewFieldsQuery = { __typename?: 'Query', getCoreViewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }> }; export type FindManyCoreViewFilterGroupsQueryVariables = Exact<{ viewId?: InputMaybe; }>; -export type FindManyCoreViewFilterGroupsQuery = { __typename?: 'Query', getCoreViewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string }> }; +export type FindManyCoreViewFilterGroupsQuery = { __typename?: 'Query', getCoreViewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string }> }; export type FindManyCoreViewFiltersQueryVariables = Exact<{ viewId?: InputMaybe; }>; -export type FindManyCoreViewFiltersQuery = { __typename?: 'Query', getCoreViewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string }> }; +export type FindManyCoreViewFiltersQuery = { __typename?: 'Query', getCoreViewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string }> }; export type FindManyCoreViewGroupsQueryVariables = Exact<{ viewId?: InputMaybe; }>; -export type FindManyCoreViewGroupsQuery = { __typename?: 'Query', getCoreViewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string }> }; +export type FindManyCoreViewGroupsQuery = { __typename?: 'Query', getCoreViewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string }> }; export type FindManyCoreViewSortsQueryVariables = Exact<{ viewId?: InputMaybe; }>; -export type FindManyCoreViewSortsQuery = { __typename?: 'Query', getCoreViewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string }> }; +export type FindManyCoreViewSortsQuery = { __typename?: 'Query', getCoreViewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string }> }; export type FindManyCoreViewsQueryVariables = Exact<{ objectMetadataId?: InputMaybe; }>; -export type FindManyCoreViewsQuery = { __typename?: 'Query', getCoreViews: Array<{ __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string }> }> }; +export type FindManyCoreViewsQuery = { __typename?: 'Query', getCoreViews: Array<{ __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string }> }> }; export type FindOneCoreViewQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewQuery = { __typename?: 'Query', getCoreView?: { __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string }> } | null }; +export type FindOneCoreViewQuery = { __typename?: 'Query', getCoreView?: { __typename?: 'CoreView', id: string, name: string, objectMetadataId: string, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: string | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string }> } | null }; export type FindOneCoreViewFieldQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewFieldQuery = { __typename?: 'Query', getCoreViewField?: { __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string } | null }; +export type FindOneCoreViewFieldQuery = { __typename?: 'Query', getCoreViewField?: { __typename?: 'CoreViewField', id: string, fieldMetadataId: string, viewId: string, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null } | null }; export type FindOneCoreViewFilterQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewFilterQuery = { __typename?: 'Query', getCoreViewFilter?: { __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string, createdAt: string, updatedAt: string } | null }; +export type FindOneCoreViewFilterQuery = { __typename?: 'Query', getCoreViewFilter?: { __typename?: 'CoreViewFilter', id: string, fieldMetadataId: string, operand: ViewFilterOperand, value: any, viewFilterGroupId?: string | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: string } | null }; export type FindOneCoreViewFilterGroupQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewFilterGroupQuery = { __typename?: 'Query', getCoreViewFilterGroup?: { __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string, createdAt: string, updatedAt: string } | null }; +export type FindOneCoreViewFilterGroupQuery = { __typename?: 'Query', getCoreViewFilterGroup?: { __typename?: 'CoreViewFilterGroup', id: string, parentViewFilterGroupId?: string | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: string } | null }; export type FindOneCoreViewGroupQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewGroupQuery = { __typename?: 'Query', getCoreViewGroup?: { __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string, createdAt: string, updatedAt: string } | null }; +export type FindOneCoreViewGroupQuery = { __typename?: 'Query', getCoreViewGroup?: { __typename?: 'CoreViewGroup', id: string, fieldMetadataId: string, isVisible: boolean, fieldValue: string, position: number, viewId: string } | null }; export type FindOneCoreViewSortQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewSortQuery = { __typename?: 'Query', getCoreViewSort?: { __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string, createdAt: string, updatedAt: string } | null }; +export type FindOneCoreViewSortQuery = { __typename?: 'Query', getCoreViewSort?: { __typename?: 'CoreViewSort', id: string, fieldMetadataId: string, direction: ViewSortDirection, viewId: string } | null }; export type ActivateWorkflowVersionMutationVariables = Exact<{ workflowVersionId: Scalars['UUID']; @@ -5267,8 +5278,6 @@ export const ViewFieldFragmentFragmentDoc = gql` position size aggregateOperation - createdAt - updatedAt } `; export const ViewFilterFragmentFragmentDoc = gql` @@ -5281,8 +5290,6 @@ export const ViewFilterFragmentFragmentDoc = gql` positionInViewFilterGroup subFieldName viewId - createdAt - updatedAt } `; export const ViewFilterGroupFragmentFragmentDoc = gql` @@ -5292,8 +5299,6 @@ export const ViewFilterGroupFragmentFragmentDoc = gql` logicalOperator positionInViewFilterGroup viewId - createdAt - updatedAt } `; export const ViewSortFragmentFragmentDoc = gql` @@ -5302,8 +5307,6 @@ export const ViewSortFragmentFragmentDoc = gql` fieldMetadataId direction viewId - createdAt - updatedAt } `; export const ViewGroupFragmentFragmentDoc = gql` @@ -5314,8 +5317,6 @@ export const ViewGroupFragmentFragmentDoc = gql` fieldValue position viewId - createdAt - updatedAt } `; export const ViewFragmentFragmentDoc = gql` @@ -5331,8 +5332,6 @@ export const ViewFragmentFragmentDoc = gql` openRecordIn kanbanAggregateOperation kanbanAggregateOperationFieldMetadataId - createdAt - updatedAt anyFieldFilterValue viewFields { ...ViewFieldFragment diff --git a/packages/twenty-front/src/generated/graphql.ts b/packages/twenty-front/src/generated/graphql.ts index 98240fcf1c4..8853fd75c0a 100644 --- a/packages/twenty-front/src/generated/graphql.ts +++ b/packages/twenty-front/src/generated/graphql.ts @@ -681,6 +681,7 @@ export type CreateServerlessFunctionInput = { export type CreateViewFieldInput = { aggregateOperation?: InputMaybe; fieldMetadataId: Scalars['UUID']; + id?: InputMaybe; isVisible?: InputMaybe; position?: InputMaybe; size?: InputMaybe; @@ -688,6 +689,7 @@ export type CreateViewFieldInput = { }; export type CreateViewFilterGroupInput = { + id?: InputMaybe; logicalOperator?: InputMaybe; parentViewFilterGroupId?: InputMaybe; positionInViewFilterGroup?: InputMaybe; @@ -696,6 +698,7 @@ export type CreateViewFilterGroupInput = { export type CreateViewFilterInput = { fieldMetadataId: Scalars['UUID']; + id?: InputMaybe; operand?: InputMaybe; positionInViewFilterGroup?: InputMaybe; subFieldName?: InputMaybe; @@ -707,6 +710,7 @@ export type CreateViewFilterInput = { export type CreateViewGroupInput = { fieldMetadataId: Scalars['UUID']; fieldValue: Scalars['String']; + id?: InputMaybe; isVisible?: InputMaybe; position?: InputMaybe; viewId: Scalars['UUID']; @@ -715,6 +719,7 @@ export type CreateViewGroupInput = { export type CreateViewInput = { anyFieldFilterValue?: InputMaybe; icon: Scalars['String']; + id?: InputMaybe; isCompact?: InputMaybe; kanbanAggregateOperation?: InputMaybe; kanbanAggregateOperationFieldMetadataId?: InputMaybe; @@ -729,6 +734,7 @@ export type CreateViewInput = { export type CreateViewSortInput = { direction?: InputMaybe; fieldMetadataId: Scalars['UUID']; + id?: InputMaybe; viewId: Scalars['UUID']; }; @@ -3130,6 +3136,7 @@ export type UpdateViewFieldInput = { }; export type UpdateViewFilterGroupInput = { + id?: InputMaybe; logicalOperator?: InputMaybe; parentViewFilterGroupId?: InputMaybe; positionInViewFilterGroup?: InputMaybe; @@ -3138,6 +3145,7 @@ export type UpdateViewFilterGroupInput = { export type UpdateViewFilterInput = { fieldMetadataId?: InputMaybe; + id?: InputMaybe; operand?: InputMaybe; positionInViewFilterGroup?: InputMaybe; subFieldName?: InputMaybe; @@ -3149,6 +3157,7 @@ export type UpdateViewFilterInput = { export type UpdateViewGroupInput = { fieldMetadataId?: InputMaybe; fieldValue?: InputMaybe; + id?: InputMaybe; isVisible?: InputMaybe; position?: InputMaybe; viewId?: InputMaybe; @@ -3157,6 +3166,7 @@ export type UpdateViewGroupInput = { export type UpdateViewInput = { anyFieldFilterValue?: InputMaybe; icon?: InputMaybe; + id?: InputMaybe; isCompact?: InputMaybe; kanbanAggregateOperation?: InputMaybe; kanbanAggregateOperationFieldMetadataId?: InputMaybe; @@ -3171,6 +3181,7 @@ export type UpdateViewInput = { export type UpdateViewSortInput = { direction?: InputMaybe; fieldMetadataId?: InputMaybe; + id?: InputMaybe; viewId?: InputMaybe; }; @@ -3592,59 +3603,59 @@ export type OnDbEventSubscriptionVariables = Exact<{ export type OnDbEventSubscription = { __typename?: 'Subscription', onDbEvent: { __typename?: 'OnDbEventDTO', eventDate: string, action: DatabaseEventAction, objectNameSingular: string, updatedFields?: Array | null, record: any } }; -export type ViewFieldFragmentFragment = { __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }; +export type ViewFieldFragmentFragment = { __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }; -export type ViewFilterFragmentFragment = { __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any, createdAt: string, updatedAt: string }; +export type ViewFilterFragmentFragment = { __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any }; -export type ViewFilterGroupFragmentFragment = { __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any, createdAt: string, updatedAt: string }; +export type ViewFilterGroupFragmentFragment = { __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any }; -export type ViewFragmentFragment = { __typename?: 'CoreView', id: any, name: string, objectMetadataId: any, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: any | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any, createdAt: string, updatedAt: string }> }; +export type ViewFragmentFragment = { __typename?: 'CoreView', id: any, name: string, objectMetadataId: any, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: any | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any }> }; -export type ViewGroupFragmentFragment = { __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any, createdAt: string, updatedAt: string }; +export type ViewGroupFragmentFragment = { __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any }; -export type ViewSortFragmentFragment = { __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any, createdAt: string, updatedAt: string }; +export type ViewSortFragmentFragment = { __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any }; export type CreateCoreViewMutationVariables = Exact<{ input: CreateViewInput; }>; -export type CreateCoreViewMutation = { __typename?: 'Mutation', createCoreView: { __typename?: 'CoreView', id: any, name: string, objectMetadataId: any, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: any | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any, createdAt: string, updatedAt: string }> } }; +export type CreateCoreViewMutation = { __typename?: 'Mutation', createCoreView: { __typename?: 'CoreView', id: any, name: string, objectMetadataId: any, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: any | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any }> } }; export type CreateCoreViewFieldMutationVariables = Exact<{ input: CreateViewFieldInput; }>; -export type CreateCoreViewFieldMutation = { __typename?: 'Mutation', createCoreViewField: { __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string } }; +export type CreateCoreViewFieldMutation = { __typename?: 'Mutation', createCoreViewField: { __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null } }; export type CreateCoreViewFilterMutationVariables = Exact<{ input: CreateViewFilterInput; }>; -export type CreateCoreViewFilterMutation = { __typename?: 'Mutation', createCoreViewFilter: { __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any, createdAt: string, updatedAt: string } }; +export type CreateCoreViewFilterMutation = { __typename?: 'Mutation', createCoreViewFilter: { __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any } }; export type CreateCoreViewFilterGroupMutationVariables = Exact<{ input: CreateViewFilterGroupInput; }>; -export type CreateCoreViewFilterGroupMutation = { __typename?: 'Mutation', createCoreViewFilterGroup: { __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any, createdAt: string, updatedAt: string } }; +export type CreateCoreViewFilterGroupMutation = { __typename?: 'Mutation', createCoreViewFilterGroup: { __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any } }; export type CreateCoreViewGroupMutationVariables = Exact<{ input: CreateViewGroupInput; }>; -export type CreateCoreViewGroupMutation = { __typename?: 'Mutation', createCoreViewGroup: { __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any, createdAt: string, updatedAt: string } }; +export type CreateCoreViewGroupMutation = { __typename?: 'Mutation', createCoreViewGroup: { __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any } }; export type CreateCoreViewSortMutationVariables = Exact<{ input: CreateViewSortInput; }>; -export type CreateCoreViewSortMutation = { __typename?: 'Mutation', createCoreViewSort: { __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any, createdAt: string, updatedAt: string } }; +export type CreateCoreViewSortMutation = { __typename?: 'Mutation', createCoreViewSort: { __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any } }; export type DeleteCoreViewMutationVariables = Exact<{ id: Scalars['String']; @@ -3736,7 +3747,7 @@ export type UpdateCoreViewMutationVariables = Exact<{ }>; -export type UpdateCoreViewMutation = { __typename?: 'Mutation', updateCoreView: { __typename?: 'CoreView', id: any, name: string, objectMetadataId: any, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: any | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any, createdAt: string, updatedAt: string }> } }; +export type UpdateCoreViewMutation = { __typename?: 'Mutation', updateCoreView: { __typename?: 'CoreView', id: any, name: string, objectMetadataId: any, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: any | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any }> } }; export type UpdateCoreViewFieldMutationVariables = Exact<{ id: Scalars['String']; @@ -3744,7 +3755,7 @@ export type UpdateCoreViewFieldMutationVariables = Exact<{ }>; -export type UpdateCoreViewFieldMutation = { __typename?: 'Mutation', updateCoreViewField: { __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string } }; +export type UpdateCoreViewFieldMutation = { __typename?: 'Mutation', updateCoreViewField: { __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null } }; export type UpdateCoreViewFilterMutationVariables = Exact<{ id: Scalars['String']; @@ -3752,7 +3763,7 @@ export type UpdateCoreViewFilterMutationVariables = Exact<{ }>; -export type UpdateCoreViewFilterMutation = { __typename?: 'Mutation', updateCoreViewFilter: { __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any, createdAt: string, updatedAt: string } }; +export type UpdateCoreViewFilterMutation = { __typename?: 'Mutation', updateCoreViewFilter: { __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any } }; export type UpdateCoreViewFilterGroupMutationVariables = Exact<{ id: Scalars['String']; @@ -3760,7 +3771,7 @@ export type UpdateCoreViewFilterGroupMutationVariables = Exact<{ }>; -export type UpdateCoreViewFilterGroupMutation = { __typename?: 'Mutation', updateCoreViewFilterGroup: { __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any, createdAt: string, updatedAt: string } }; +export type UpdateCoreViewFilterGroupMutation = { __typename?: 'Mutation', updateCoreViewFilterGroup: { __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any } }; export type UpdateCoreViewGroupMutationVariables = Exact<{ id: Scalars['String']; @@ -3768,7 +3779,7 @@ export type UpdateCoreViewGroupMutationVariables = Exact<{ }>; -export type UpdateCoreViewGroupMutation = { __typename?: 'Mutation', updateCoreViewGroup: { __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any, createdAt: string, updatedAt: string } }; +export type UpdateCoreViewGroupMutation = { __typename?: 'Mutation', updateCoreViewGroup: { __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any } }; export type UpdateCoreViewSortMutationVariables = Exact<{ id: Scalars['String']; @@ -3776,91 +3787,91 @@ export type UpdateCoreViewSortMutationVariables = Exact<{ }>; -export type UpdateCoreViewSortMutation = { __typename?: 'Mutation', updateCoreViewSort: { __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any, createdAt: string, updatedAt: string } }; +export type UpdateCoreViewSortMutation = { __typename?: 'Mutation', updateCoreViewSort: { __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any } }; export type FindManyCoreViewFieldsQueryVariables = Exact<{ viewId: Scalars['String']; }>; -export type FindManyCoreViewFieldsQuery = { __typename?: 'Query', getCoreViewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }> }; +export type FindManyCoreViewFieldsQuery = { __typename?: 'Query', getCoreViewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }> }; export type FindManyCoreViewFilterGroupsQueryVariables = Exact<{ viewId?: InputMaybe; }>; -export type FindManyCoreViewFilterGroupsQuery = { __typename?: 'Query', getCoreViewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any, createdAt: string, updatedAt: string }> }; +export type FindManyCoreViewFilterGroupsQuery = { __typename?: 'Query', getCoreViewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any }> }; export type FindManyCoreViewFiltersQueryVariables = Exact<{ viewId?: InputMaybe; }>; -export type FindManyCoreViewFiltersQuery = { __typename?: 'Query', getCoreViewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any, createdAt: string, updatedAt: string }> }; +export type FindManyCoreViewFiltersQuery = { __typename?: 'Query', getCoreViewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any }> }; export type FindManyCoreViewGroupsQueryVariables = Exact<{ viewId?: InputMaybe; }>; -export type FindManyCoreViewGroupsQuery = { __typename?: 'Query', getCoreViewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any, createdAt: string, updatedAt: string }> }; +export type FindManyCoreViewGroupsQuery = { __typename?: 'Query', getCoreViewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any }> }; export type FindManyCoreViewSortsQueryVariables = Exact<{ viewId?: InputMaybe; }>; -export type FindManyCoreViewSortsQuery = { __typename?: 'Query', getCoreViewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any, createdAt: string, updatedAt: string }> }; +export type FindManyCoreViewSortsQuery = { __typename?: 'Query', getCoreViewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any }> }; export type FindManyCoreViewsQueryVariables = Exact<{ objectMetadataId?: InputMaybe; }>; -export type FindManyCoreViewsQuery = { __typename?: 'Query', getCoreViews: Array<{ __typename?: 'CoreView', id: any, name: string, objectMetadataId: any, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: any | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any, createdAt: string, updatedAt: string }> }> }; +export type FindManyCoreViewsQuery = { __typename?: 'Query', getCoreViews: Array<{ __typename?: 'CoreView', id: any, name: string, objectMetadataId: any, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: any | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any }> }> }; export type FindOneCoreViewQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewQuery = { __typename?: 'Query', getCoreView?: { __typename?: 'CoreView', id: any, name: string, objectMetadataId: any, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: any | null, createdAt: string, updatedAt: string, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any, createdAt: string, updatedAt: string }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any, createdAt: string, updatedAt: string }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any, createdAt: string, updatedAt: string }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any, createdAt: string, updatedAt: string }> } | null }; +export type FindOneCoreViewQuery = { __typename?: 'Query', getCoreView?: { __typename?: 'CoreView', id: any, name: string, objectMetadataId: any, type: ViewType, key?: ViewKey | null, icon: string, position: number, isCompact: boolean, openRecordIn: ViewOpenRecordIn, kanbanAggregateOperation?: AggregateOperations | null, kanbanAggregateOperationFieldMetadataId?: any | null, anyFieldFilterValue?: string | null, viewFields: Array<{ __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null }>, viewFilters: Array<{ __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any }>, viewFilterGroups: Array<{ __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any }>, viewSorts: Array<{ __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any }>, viewGroups: Array<{ __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any }> } | null }; export type FindOneCoreViewFieldQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewFieldQuery = { __typename?: 'Query', getCoreViewField?: { __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null, createdAt: string, updatedAt: string } | null }; +export type FindOneCoreViewFieldQuery = { __typename?: 'Query', getCoreViewField?: { __typename?: 'CoreViewField', id: any, fieldMetadataId: any, viewId: any, isVisible: boolean, position: number, size: number, aggregateOperation?: AggregateOperations | null } | null }; export type FindOneCoreViewFilterQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewFilterQuery = { __typename?: 'Query', getCoreViewFilter?: { __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any, createdAt: string, updatedAt: string } | null }; +export type FindOneCoreViewFilterQuery = { __typename?: 'Query', getCoreViewFilter?: { __typename?: 'CoreViewFilter', id: any, fieldMetadataId: any, operand: ViewFilterOperand, value: any, viewFilterGroupId?: any | null, positionInViewFilterGroup?: number | null, subFieldName?: string | null, viewId: any } | null }; export type FindOneCoreViewFilterGroupQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewFilterGroupQuery = { __typename?: 'Query', getCoreViewFilterGroup?: { __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any, createdAt: string, updatedAt: string } | null }; +export type FindOneCoreViewFilterGroupQuery = { __typename?: 'Query', getCoreViewFilterGroup?: { __typename?: 'CoreViewFilterGroup', id: any, parentViewFilterGroupId?: any | null, logicalOperator: ViewFilterGroupLogicalOperator, positionInViewFilterGroup?: number | null, viewId: any } | null }; export type FindOneCoreViewGroupQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewGroupQuery = { __typename?: 'Query', getCoreViewGroup?: { __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any, createdAt: string, updatedAt: string } | null }; +export type FindOneCoreViewGroupQuery = { __typename?: 'Query', getCoreViewGroup?: { __typename?: 'CoreViewGroup', id: any, fieldMetadataId: any, isVisible: boolean, fieldValue: string, position: number, viewId: any } | null }; export type FindOneCoreViewSortQueryVariables = Exact<{ id: Scalars['String']; }>; -export type FindOneCoreViewSortQuery = { __typename?: 'Query', getCoreViewSort?: { __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any, createdAt: string, updatedAt: string } | null }; +export type FindOneCoreViewSortQuery = { __typename?: 'Query', getCoreViewSort?: { __typename?: 'CoreViewSort', id: any, fieldMetadataId: any, direction: ViewSortDirection, viewId: any } | null }; export const ViewFieldFragmentFragmentDoc = gql` fragment ViewFieldFragment on CoreViewField { @@ -3871,8 +3882,6 @@ export const ViewFieldFragmentFragmentDoc = gql` position size aggregateOperation - createdAt - updatedAt } `; export const ViewFilterFragmentFragmentDoc = gql` @@ -3885,8 +3894,6 @@ export const ViewFilterFragmentFragmentDoc = gql` positionInViewFilterGroup subFieldName viewId - createdAt - updatedAt } `; export const ViewFilterGroupFragmentFragmentDoc = gql` @@ -3896,8 +3903,6 @@ export const ViewFilterGroupFragmentFragmentDoc = gql` logicalOperator positionInViewFilterGroup viewId - createdAt - updatedAt } `; export const ViewSortFragmentFragmentDoc = gql` @@ -3906,8 +3911,6 @@ export const ViewSortFragmentFragmentDoc = gql` fieldMetadataId direction viewId - createdAt - updatedAt } `; export const ViewGroupFragmentFragmentDoc = gql` @@ -3918,8 +3921,6 @@ export const ViewGroupFragmentFragmentDoc = gql` fieldValue position viewId - createdAt - updatedAt } `; export const ViewFragmentFragmentDoc = gql` @@ -3935,8 +3936,6 @@ export const ViewFragmentFragmentDoc = gql` openRecordIn kanbanAggregateOperation kanbanAggregateOperationFieldMetadataId - createdAt - updatedAt anyFieldFilterValue viewFields { ...ViewFieldFragment diff --git a/packages/twenty-front/src/modules/favorites/hooks/useFavoritesByFolder.ts b/packages/twenty-front/src/modules/favorites/hooks/useFavoritesByFolder.ts index 4f9977f1f31..2dd216e4064 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/useFavoritesByFolder.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/useFavoritesByFolder.ts @@ -1,6 +1,9 @@ import { sortFavorites } from '@/favorites/utils/sortFavorites'; import { prefetchViewsState } from '@/prefetch/states/prefetchViewsState'; +import { coreViewsState } from '@/views/states/coreViewState'; +import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useRecoilValue } from 'recoil'; +import { FeatureFlagKey } from '~/generated/graphql'; import { useFavoritesMetadata } from './useFavoritesMetadata'; import { usePrefetchedFavoritesData } from './usePrefetchedFavoritesData'; import { usePrefetchedFavoritesFoldersData } from './usePrefetchedFavoritesFoldersData'; @@ -15,6 +18,13 @@ export const useFavoritesByFolder = () => { } = useFavoritesMetadata(); const prefetchViews = useRecoilValue(prefetchViewsState); + const coreViews = useRecoilValue(coreViewsState); + + const isCoreViewEnabled = useIsFeatureEnabled( + FeatureFlagKey.IS_CORE_VIEW_ENABLED, + ); + + const views = isCoreViewEnabled ? coreViews : prefetchViews; const favoritesByFolder = favoriteFolders.map((folder) => ({ folderId: folder.id, @@ -24,7 +34,7 @@ export const useFavoritesByFolder = () => { favoriteRelationFields, getObjectRecordIdentifierByNameSingular, true, - prefetchViews, + views, objectMetadataItems, ), })); diff --git a/packages/twenty-front/src/modules/favorites/hooks/useWorkspaceFavorites.ts b/packages/twenty-front/src/modules/favorites/hooks/useWorkspaceFavorites.ts index 98d9221efe8..7538104b8c9 100644 --- a/packages/twenty-front/src/modules/favorites/hooks/useWorkspaceFavorites.ts +++ b/packages/twenty-front/src/modules/favorites/hooks/useWorkspaceFavorites.ts @@ -5,14 +5,23 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata import { objectMetadataItemsState } from '@/object-metadata/states/objectMetadataItemsState'; import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { prefetchViewsState } from '@/prefetch/states/prefetchViewsState'; +import { coreViewsState } from '@/views/states/coreViewState'; +import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled'; import { useMemo } from 'react'; import { useRecoilValue } from 'recoil'; -import { FieldMetadataType } from '~/generated-metadata/graphql'; +import { + FeatureFlagKey, + FieldMetadataType, +} from '~/generated-metadata/graphql'; import { usePrefetchedFavoritesData } from './usePrefetchedFavoritesData'; export const useWorkspaceFavorites = () => { const { workspaceFavorites } = usePrefetchedFavoritesData(); + const isCoreViewEnabled = useIsFeatureEnabled( + FeatureFlagKey.IS_CORE_VIEW_ENABLED, + ); const prefetchViews = useRecoilValue(prefetchViewsState); + const coreViews = useRecoilValue(coreViewsState); const objectMetadataItems = useRecoilValue(objectMetadataItemsState); const { objectMetadataItem: favoriteObjectMetadataItem } = useObjectMetadataItem({ @@ -32,6 +41,8 @@ export const useWorkspaceFavorites = () => { [favoriteObjectMetadataItem.fields], ); + const views = isCoreViewEnabled ? coreViews : prefetchViews; + const sortedWorkspaceFavorites = useMemo( () => sortFavorites( @@ -39,14 +50,14 @@ export const useWorkspaceFavorites = () => { favoriteRelationFieldMetadataItems, getObjectRecordIdentifierByNameSingular, false, - prefetchViews, + views, objectMetadataItems, ), [ workspaceFavorites, favoriteRelationFieldMetadataItems, getObjectRecordIdentifierByNameSingular, - prefetchViews, + views, objectMetadataItems, ], ); @@ -56,7 +67,7 @@ export const useWorkspaceFavorites = () => { ); const favoriteViewObjectMetadataIds = new Set( - prefetchViews.reduce((acc, view) => { + views.reduce((acc, view) => { if (workspaceFavoriteIds.has(view.id)) { acc.push(view.objectMetadataId); } diff --git a/packages/twenty-front/src/modules/favorites/states/selectors/favoriteViewsWithMinimalDataSelector.ts b/packages/twenty-front/src/modules/favorites/states/selectors/favoriteViewsWithMinimalDataSelector.ts index e0e0670f0c9..b46b0c74037 100644 --- a/packages/twenty-front/src/modules/favorites/states/selectors/favoriteViewsWithMinimalDataSelector.ts +++ b/packages/twenty-front/src/modules/favorites/states/selectors/favoriteViewsWithMinimalDataSelector.ts @@ -1,13 +1,28 @@ +import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState'; import { prefetchViewsState } from '@/prefetch/states/prefetchViewsState'; +import { coreViewsState } from '@/views/states/coreViewState'; import { type View } from '@/views/types/View'; +import { convertCoreViewToView } from '@/views/utils/convertCoreViewToView'; +import { extractFeatureFlagMapFromWorkspace } from '@/workspace/utils/extractFeatureFlagMapFromWorkspace'; import { selector } from 'recoil'; +import { FeatureFlagKey } from '~/generated/graphql'; export const favoriteViewsWithMinimalDataSelector = selector< Pick[] >({ key: 'favoriteViewsWithMinimalDataSelector', get: ({ get }) => { - const views = get(prefetchViewsState); + const prefetchedViews = get(prefetchViewsState); + const coreViews = get(coreViewsState); + + const currentWorkspace = get(currentWorkspaceState); + const featureFlags = extractFeatureFlagMapFromWorkspace(currentWorkspace); + + const isCoreViewEnabled = featureFlags[FeatureFlagKey.IS_CORE_VIEW_ENABLED]; + + const views = isCoreViewEnabled + ? coreViews.map(convertCoreViewToView) + : prefetchedViews; return views.map((view) => ({ id: view.id, name: view.name, diff --git a/packages/twenty-front/src/modules/favorites/utils/sortFavorites.ts b/packages/twenty-front/src/modules/favorites/utils/sortFavorites.ts index 9bd1297b541..8e8e183c27b 100644 --- a/packages/twenty-front/src/modules/favorites/utils/sortFavorites.ts +++ b/packages/twenty-front/src/modules/favorites/utils/sortFavorites.ts @@ -27,10 +27,7 @@ export const sortFavorites = ( ): ProcessedFavorite[] => { return favorites .map((favorite) => { - if ( - isDefined(favorite.viewId) && - isDefined(favorite.forWorkspaceMemberId) - ) { + if (isDefined(favorite.viewId)) { const view = views.find((view) => view.id === favorite.viewId); if (!isDefined(view)) { diff --git a/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItems.tsx b/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItems.tsx index 9fa5bd7eb9a..3f2dee9505f 100644 --- a/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItems.tsx +++ b/packages/twenty-front/src/modules/object-metadata/components/NavigationDrawerSectionForObjectMetadataItems.tsx @@ -16,15 +16,17 @@ const ORDERED_STANDARD_OBJECTS = [ 'note', ]; +type NavigationDrawerSectionForObjectMetadataItemsProps = { + sectionTitle: string; + isRemote: boolean; + objectMetadataItems: ObjectMetadataItem[]; +}; + export const NavigationDrawerSectionForObjectMetadataItems = ({ sectionTitle, isRemote, objectMetadataItems, -}: { - sectionTitle: string; - isRemote: boolean; - objectMetadataItems: ObjectMetadataItem[]; -}) => { +}: NavigationDrawerSectionForObjectMetadataItemsProps) => { const { toggleNavigationSection, isNavigationSectionOpenState } = useNavigationSection('Objects' + (isRemote ? 'Remote' : 'Workspace')); const isNavigationSectionOpen = useRecoilValue(isNavigationSectionOpenState); diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSetViewTypeFromLayoutOptionsMenu.ts b/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSetViewTypeFromLayoutOptionsMenu.ts index 9cd90646210..90fb60a6c81 100644 --- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSetViewTypeFromLayoutOptionsMenu.ts +++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/hooks/useSetViewTypeFromLayoutOptionsMenu.ts @@ -95,8 +95,8 @@ export const useSetViewTypeFromLayoutOptionsMenu = () => { } const previouslySelectedKanbanField = availableFieldsForKanban.find( (fieldsForKanban) => - // TODO: replace with viewGroups.fieldMetadataId - fieldsForKanban.id === currentView.kanbanFieldMetadataId, + fieldsForKanban.id === + currentView.viewGroups[0].fieldMetadataId, ); const kanbanField = isDefined(previouslySelectedKanbanField) @@ -104,8 +104,8 @@ export const useSetViewTypeFromLayoutOptionsMenu = () => { : availableFieldsForKanban[0]; if (!isDefined(previouslySelectedKanbanField)) { - // TODO: replace with viewGroups.fieldMetadataId - updateCurrentViewParams.kanbanFieldMetadataId = kanbanField.id; + updateCurrentViewParams.kanbanFieldMetadataId = + currentView.viewGroups[0].fieldMetadataId; } const hasViewGroups = currentView.viewGroups.some( diff --git a/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts b/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts index 1a9349d5902..e8761d901c4 100644 --- a/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts +++ b/packages/twenty-front/src/modules/object-record/record-index/hooks/useLoadRecordIndexStates.ts @@ -180,8 +180,7 @@ export const useLoadRecordIndexStates = () => { setRecordIndexViewType(view.type); setRecordIndexOpenRecordIn(view.openRecordIn); setRecordIndexViewKanbanFieldMetadataIdState( - // TODO: replace with viewGroups.fieldMetadataId - view.kanbanFieldMetadataId, + view.viewGroups?.[0]?.fieldMetadataId, ); const kanbanAggregateOperationFieldMetadataType = objectMetadataItem.fields?.find( diff --git a/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx b/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx index bae9ee6234c..3296cdf23f4 100644 --- a/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx +++ b/packages/twenty-front/src/modules/views/components/UpdateViewButtonGroup.tsx @@ -1,6 +1,7 @@ import styled from '@emotion/styled'; import { contextStoreCurrentViewIdComponentState } from '@/context-store/states/contextStoreCurrentViewIdComponentState'; +import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown'; import { DropdownContent } from '@/ui/layout/dropdown/components/DropdownContent'; import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer'; @@ -15,6 +16,7 @@ import { useAreViewFiltersDifferentFromRecordFilters } from '@/views/hooks/useAr import { useAreViewSortsDifferentFromRecordSorts } from '@/views/hooks/useAreViewSortsDifferentFromRecordSorts'; import { useGetCurrentViewOnly } from '@/views/hooks/useGetCurrentViewOnly'; import { useIsViewAnyFieldFilterDifferentFromCurrentAnyFieldFilter } from '@/views/hooks/useIsViewAnyFieldFilterDifferentFromCurrentAnyFieldFilter'; +import { useRefreshCoreViews } from '@/views/hooks/useRefreshCoreViews'; import { useSaveCurrentViewFiltersAndSorts } from '@/views/hooks/useSaveCurrentViewFiltersAndSorts'; import { VIEW_PICKER_DROPDOWN_ID } from '@/views/view-picker/constants/ViewPickerDropdownId'; import { useViewPickerMode } from '@/views/view-picker/hooks/useViewPickerMode'; @@ -34,6 +36,10 @@ const StyledContainer = styled.div` export const UpdateViewButtonGroup = () => { const { saveCurrentViewFilterAndSorts } = useSaveCurrentViewFiltersAndSorts(); + const { refreshCoreViews } = useRefreshCoreViews(); + + const { objectMetadataItem } = useRecordIndexContextOrThrow(); + const { setViewPickerMode } = useViewPickerMode(); const currentViewId = useRecoilComponentValue( @@ -72,6 +78,7 @@ export const UpdateViewButtonGroup = () => { const handleUpdateViewClick = async () => { await saveCurrentViewFilterAndSorts(); + await refreshCoreViews(objectMetadataItem.id); }; const { hasFiltersQueryParams } = useViewFromQueryParams(); diff --git a/packages/twenty-front/src/modules/views/graphql/fragments/viewFieldFragment.ts b/packages/twenty-front/src/modules/views/graphql/fragments/viewFieldFragment.ts index 9f95338938e..cb168a618f5 100644 --- a/packages/twenty-front/src/modules/views/graphql/fragments/viewFieldFragment.ts +++ b/packages/twenty-front/src/modules/views/graphql/fragments/viewFieldFragment.ts @@ -9,7 +9,5 @@ export const VIEW_FIELD_FRAGMENT = gql` position size aggregateOperation - createdAt - updatedAt } `; diff --git a/packages/twenty-front/src/modules/views/graphql/fragments/viewFilterFragment.ts b/packages/twenty-front/src/modules/views/graphql/fragments/viewFilterFragment.ts index df96f08f17c..a45a5d0d2c6 100644 --- a/packages/twenty-front/src/modules/views/graphql/fragments/viewFilterFragment.ts +++ b/packages/twenty-front/src/modules/views/graphql/fragments/viewFilterFragment.ts @@ -10,7 +10,5 @@ export const VIEW_FILTER_FRAGMENT = gql` positionInViewFilterGroup subFieldName viewId - createdAt - updatedAt } `; diff --git a/packages/twenty-front/src/modules/views/graphql/fragments/viewFilterGroupFragment.ts b/packages/twenty-front/src/modules/views/graphql/fragments/viewFilterGroupFragment.ts index 921434faf89..7784c391d4e 100644 --- a/packages/twenty-front/src/modules/views/graphql/fragments/viewFilterGroupFragment.ts +++ b/packages/twenty-front/src/modules/views/graphql/fragments/viewFilterGroupFragment.ts @@ -7,7 +7,5 @@ export const VIEW_FILTER_GROUP_FRAGMENT = gql` logicalOperator positionInViewFilterGroup viewId - createdAt - updatedAt } `; diff --git a/packages/twenty-front/src/modules/views/graphql/fragments/viewFragment.ts b/packages/twenty-front/src/modules/views/graphql/fragments/viewFragment.ts index 377dee88aab..268a984e701 100644 --- a/packages/twenty-front/src/modules/views/graphql/fragments/viewFragment.ts +++ b/packages/twenty-front/src/modules/views/graphql/fragments/viewFragment.ts @@ -24,8 +24,6 @@ export const VIEW_FRAGMENT = gql` openRecordIn kanbanAggregateOperation kanbanAggregateOperationFieldMetadataId - createdAt - updatedAt anyFieldFilterValue viewFields { ...ViewFieldFragment diff --git a/packages/twenty-front/src/modules/views/graphql/fragments/viewGroupFragment.ts b/packages/twenty-front/src/modules/views/graphql/fragments/viewGroupFragment.ts index 4810c162534..bcd91d780cc 100644 --- a/packages/twenty-front/src/modules/views/graphql/fragments/viewGroupFragment.ts +++ b/packages/twenty-front/src/modules/views/graphql/fragments/viewGroupFragment.ts @@ -8,7 +8,5 @@ export const VIEW_GROUP_FRAGMENT = gql` fieldValue position viewId - createdAt - updatedAt } `; diff --git a/packages/twenty-front/src/modules/views/graphql/fragments/viewSortFragment.ts b/packages/twenty-front/src/modules/views/graphql/fragments/viewSortFragment.ts index 4ea966d0d40..12712b5ee86 100644 --- a/packages/twenty-front/src/modules/views/graphql/fragments/viewSortFragment.ts +++ b/packages/twenty-front/src/modules/views/graphql/fragments/viewSortFragment.ts @@ -6,7 +6,5 @@ export const VIEW_SORT_FRAGMENT = gql` fieldMetadataId direction viewId - createdAt - updatedAt } `; diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFieldRecords.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFieldRecords.ts index 9cd808fbd5a..0ca698b8847 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFieldRecords.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFieldRecords.ts @@ -100,7 +100,7 @@ export const usePersistViewFieldRecords = () => { apolloCoreClient.mutate({ mutation: updateOneRecordMutation, variables: { - idToUpdate: viewField.id, + id: viewField.id, input: { isVisible: viewField.isVisible, position: viewField.position, @@ -151,6 +151,7 @@ export const usePersistViewFieldRecords = () => { mutation: CREATE_CORE_VIEW_FIELD, variables: { input: { + id: viewField.id, fieldMetadataId: viewField.fieldMetadataId, viewId: view.id, isVisible: viewField.isVisible, @@ -191,7 +192,7 @@ export const usePersistViewFieldRecords = () => { apolloClient.mutate({ mutation: UPDATE_CORE_VIEW_FIELD, variables: { - idToUpdate: viewField.id, + id: viewField.id, input: { isVisible: viewField.isVisible, position: viewField.position, diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterGroupRecords.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterGroupRecords.ts index cf1a2f051e8..b55434dd214 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterGroupRecords.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterGroupRecords.ts @@ -146,7 +146,7 @@ export const usePersistViewFilterGroupRecords = () => { apolloCoreClient.mutate<{ updateViewFilterGroup: ViewFilterGroup }>({ mutation: updateOneRecordMutation, variables: { - idToUpdate: viewFilterGroup.id, + id: viewFilterGroup.id, input: { parentViewFilterGroupId: viewFilterGroup.parentViewFilterGroupId, @@ -194,7 +194,7 @@ export const usePersistViewFilterGroupRecords = () => { apolloCoreClient.mutate<{ destroyViewFilterGroup: ViewFilterGroup }>({ mutation: destroyOneRecordMutation, variables: { - idToDestroy: viewFilterGroupId, + id: viewFilterGroupId, }, update: (cache, { data }) => { const record = data?.destroyViewFilterGroup; @@ -231,6 +231,7 @@ export const usePersistViewFilterGroupRecords = () => { mutation: CREATE_CORE_VIEW_FILTER_GROUP, variables: { input: { + id: viewFilterGroup.id, viewId: view.id, parentViewFilterGroupId: viewFilterGroup.parentViewFilterGroupId, logicalOperator: viewFilterGroup.logicalOperator, @@ -315,7 +316,7 @@ export const usePersistViewFilterGroupRecords = () => { apolloClient.mutate<{ updateCoreViewFilterGroup: ViewFilterGroup }>({ mutation: UPDATE_CORE_VIEW_FILTER_GROUP, variables: { - idToUpdate: viewFilterGroup.id, + id: viewFilterGroup.id, input: { parentViewFilterGroupId: viewFilterGroup.parentViewFilterGroupId, @@ -357,7 +358,7 @@ export const usePersistViewFilterGroupRecords = () => { apolloClient.mutate<{ destroyCoreViewFilterGroup: ViewFilterGroup }>({ mutation: DESTROY_CORE_VIEW_FILTER_GROUP, variables: { - idToDestroy: viewFilterGroupId, + id: viewFilterGroupId, }, update: (cache, { data }) => { const record = data?.destroyCoreViewFilterGroup; diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterRecords.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterRecords.ts index fbf1edebf1a..a674352923d 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterRecords.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewFilterRecords.ts @@ -106,7 +106,7 @@ export const usePersistViewFilterRecords = () => { apolloCoreClient.mutate({ mutation: updateOneRecordMutation, variables: { - idToUpdate: viewFilter.id, + id: viewFilter.id, input: { value: viewFilter.value, displayValue: viewFilter.displayValue, @@ -155,7 +155,7 @@ export const usePersistViewFilterRecords = () => { apolloCoreClient.mutate({ mutation: destroyOneRecordMutation, variables: { - idToDestroy: viewFilterId, + id: viewFilterId, }, update: (cache, { data }) => { const record = data?.['destroyViewFilter']; @@ -197,6 +197,7 @@ export const usePersistViewFilterRecords = () => { mutation: CREATE_CORE_VIEW_FILTER, variables: { input: { + id: viewFilter.id, fieldMetadataId: viewFilter.fieldMetadataId, viewId: view.id, value: viewFilter.value, @@ -238,7 +239,7 @@ export const usePersistViewFilterRecords = () => { apolloClient.mutate({ mutation: UPDATE_CORE_VIEW_FILTER, variables: { - idToUpdate: viewFilter.id, + id: viewFilter.id, input: { value: viewFilter.value, operand: convertViewFilterOperandToCore(viewFilter.operand), @@ -280,7 +281,7 @@ export const usePersistViewFilterRecords = () => { apolloClient.mutate({ mutation: DESTROY_CORE_VIEW_FILTER, variables: { - idToDestroy: viewFilterId, + id: viewFilterId, }, update: (cache, { data }) => { const record = data?.['destroyCoreViewFilter']; diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewGroupRecords.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewGroupRecords.ts index e9728c22ec6..68478b9fc9c 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewGroupRecords.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewGroupRecords.ts @@ -60,7 +60,7 @@ export const usePersistViewGroupRecords = () => { apolloCoreClient.mutate<{ updateViewGroup: ViewGroup }>({ mutation: updateOneRecordMutation, variables: { - idToUpdate: viewGroup.id, + id: viewGroup.id, input: { isVisible: viewGroup.isVisible, position: viewGroup.position, @@ -119,7 +119,10 @@ export const usePersistViewGroupRecords = () => { mutation: CREATE_CORE_VIEW_GROUP, variables: { input: { + id: viewGroup.id, viewId, + fieldMetadataId: viewGroup.fieldMetadataId, + fieldValue: viewGroup.fieldValue, isVisible: viewGroup.isVisible, position: viewGroup.position, }, @@ -183,7 +186,7 @@ export const usePersistViewGroupRecords = () => { apolloClient.mutate({ mutation: DESTROY_CORE_VIEW_GROUP, variables: { - idToDestroy: viewGroup.id, + id: viewGroup.id, }, }), ), diff --git a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewSortRecords.ts b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewSortRecords.ts index 89cbe11073c..55e9128b545 100644 --- a/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewSortRecords.ts +++ b/packages/twenty-front/src/modules/views/hooks/internal/usePersistViewSortRecords.ts @@ -100,7 +100,7 @@ export const usePersistViewSortRecords = () => { apolloCoreClient.mutate({ mutation: updateOneRecordMutation, variables: { - idToUpdate: viewSort.id, + id: viewSort.id, input: { direction: viewSort.direction, }, @@ -144,7 +144,7 @@ export const usePersistViewSortRecords = () => { apolloCoreClient.mutate({ mutation: destroyOneRecordMutation, variables: { - idToDestroy: viewSortId, + id: viewSortId, }, update: (cache, { data }) => { const record = data?.['destroyViewSort']; @@ -185,6 +185,7 @@ export const usePersistViewSortRecords = () => { mutation: CREATE_CORE_VIEW_SORT, variables: { input: { + id: viewSort.id, fieldMetadataId: viewSort.fieldMetadataId, viewId: view.id, direction: convertViewSortDirectionToCore(viewSort.direction), @@ -222,7 +223,7 @@ export const usePersistViewSortRecords = () => { apolloClient.mutate({ mutation: UPDATE_CORE_VIEW_SORT, variables: { - idToUpdate: viewSort.id, + id: viewSort.id, input: { direction: convertViewSortDirectionToCore(viewSort.direction), } satisfies Partial, @@ -260,7 +261,7 @@ export const usePersistViewSortRecords = () => { apolloClient.mutate({ mutation: DESTROY_CORE_VIEW_SORT, variables: { - idToDestroy: viewSortId, + id: viewSortId, }, update: (cache, { data }) => { const record = data?.['destroyCoreViewSort']; diff --git a/packages/twenty-front/src/modules/views/hooks/useCreateViewFromCurrentView.ts b/packages/twenty-front/src/modules/views/hooks/useCreateViewFromCurrentView.ts index 713f9776d06..916404185ea 100644 --- a/packages/twenty-front/src/modules/views/hooks/useCreateViewFromCurrentView.ts +++ b/packages/twenty-front/src/modules/views/hooks/useCreateViewFromCurrentView.ts @@ -16,7 +16,7 @@ import { usePersistViewFilterGroupRecords } from '@/views/hooks/internal/usePers import { usePersistViewFilterRecords } from '@/views/hooks/internal/usePersistViewFilterRecords'; import { usePersistViewGroupRecords } from '@/views/hooks/internal/usePersistViewGroupRecords'; import { usePersistViewSortRecords } from '@/views/hooks/internal/usePersistViewSortRecords'; -import { coreViewsState } from '@/views/states/coreViewState'; +import { useRefreshCoreViews } from '@/views/hooks/useRefreshCoreViews'; import { isPersistingViewFieldsState } from '@/views/states/isPersistingViewFieldsState'; import { type GraphQLView } from '@/views/types/GraphQLView'; import { type View } from '@/views/types/View'; @@ -33,12 +33,7 @@ import { useFeatureFlagsMap } from '@/workspace/hooks/useFeatureFlagsMap'; import { useRecoilCallback } from 'recoil'; import { isDefined } from 'twenty-shared/utils'; import { v4 } from 'uuid'; -import { - FeatureFlagKey, - useCreateCoreViewMutation, - useFindManyCoreViewsLazyQuery, -} from '~/generated/graphql'; -import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; +import { FeatureFlagKey, useCreateCoreViewMutation } from '~/generated/graphql'; import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull'; export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => { @@ -70,7 +65,7 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => { const { objectMetadataItem } = useRecordIndexContextOrThrow(); - const [findManyCoreViewsLazy] = useFindManyCoreViewsLazyQuery(); + const { refreshCoreViews } = useRefreshCoreViews(); const { findManyRecordsLazy } = useLazyFindManyRecords({ objectNameSingular: CoreObjectNameSingular.View, @@ -135,6 +130,7 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => { const result = await createCoreViewMutation({ variables: { input: { + id: id ?? v4(), name: name ?? sourceView.name, icon: icon ?? sourceView.icon, key: null, @@ -258,23 +254,7 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => { } if (isCoreViewEnabled) { - const result = await findManyCoreViewsLazy({ - variables: { - objectMetadataId: objectMetadataItem.id, - }, - fetchPolicy: 'network-only', - }); - - const existingCoreViews = snapshot - .getLoadable(coreViewsState) - .getValue(); - - if ( - isDefined(result.data?.getCoreViews) && - !isDeeplyEqual(existingCoreViews, result.data.getCoreViews) - ) { - set(coreViewsState, result.data.getCoreViews); - } + await refreshCoreViews(objectMetadataItem.id); } else { await findManyRecordsLazy(); } @@ -283,23 +263,23 @@ export const useCreateViewFromCurrentView = (viewBarComponentId?: string) => { return newViewId; }, [ - anyFieldFilterValue, currentViewIdCallbackState, - createOneRecord, + isCoreViewEnabled, createViewFieldRecords, - findManyRecordsLazy, + createCoreViewMutation, + anyFieldFilterValue, + createOneRecord, objectMetadataItem.fields, + objectMetadataItem.id, createViewGroupRecords, - createViewSortRecords, - createViewFilterRecords, - createViewFilterGroupRecords, + currentRecordFilterGroups, currentRecordFilters, currentRecordSorts, - currentRecordFilterGroups, - isCoreViewEnabled, - createCoreViewMutation, - findManyCoreViewsLazy, - objectMetadataItem.id, + createViewFilterGroupRecords, + createViewFilterRecords, + createViewSortRecords, + refreshCoreViews, + findManyRecordsLazy, ], ); diff --git a/packages/twenty-front/src/modules/views/hooks/useRefreshCoreViews.ts b/packages/twenty-front/src/modules/views/hooks/useRefreshCoreViews.ts new file mode 100644 index 00000000000..a737ced2a71 --- /dev/null +++ b/packages/twenty-front/src/modules/views/hooks/useRefreshCoreViews.ts @@ -0,0 +1,42 @@ +import { coreViewsByObjectMetadataIdFamilySelector } from '@/views/states/coreViewsByObjectMetadataIdFamilySelector'; +import { useRecoilCallback } from 'recoil'; +import { isDefined } from 'twenty-shared/utils'; +import { useFindManyCoreViewsLazyQuery } from '~/generated/graphql'; +import { isDeeplyEqual } from '~/utils/isDeeplyEqual'; + +export const useRefreshCoreViews = () => { + const [findManyCoreViewsLazy] = useFindManyCoreViewsLazyQuery(); + + const refreshCoreViews = useRecoilCallback( + ({ snapshot, set }) => + async (objectMetadataId: string) => { + const result = await findManyCoreViewsLazy({ + variables: { + objectMetadataId, + }, + fetchPolicy: 'network-only', + }); + + const coreViewsForObjectMetadataId = snapshot + .getLoadable( + coreViewsByObjectMetadataIdFamilySelector(objectMetadataId), + ) + .getValue(); + + if ( + isDefined(result.data?.getCoreViews) && + !isDeeplyEqual(coreViewsForObjectMetadataId, result.data.getCoreViews) + ) { + set( + coreViewsByObjectMetadataIdFamilySelector(objectMetadataId), + result.data.getCoreViews, + ); + } + }, + [findManyCoreViewsLazy], + ); + + return { + refreshCoreViews, + }; +}; diff --git a/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFields.ts b/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFields.ts index cad4fc41efe..12df40f2c05 100644 --- a/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFields.ts +++ b/packages/twenty-front/src/modules/views/hooks/useSaveCurrentViewFields.ts @@ -33,7 +33,7 @@ export const useSaveCurrentViewFields = () => { set(isPersistingViewFieldsState, true); - const view = await getViewFromPrefetchState(currentViewId); + const view = getViewFromPrefetchState(currentViewId); if (isUndefinedOrNull(view)) { return; diff --git a/packages/twenty-front/src/modules/views/hooks/useSaveRecordFilterGroupsToViewFilterGroups.ts b/packages/twenty-front/src/modules/views/hooks/useSaveRecordFilterGroupsToViewFilterGroups.ts index acd33cce138..85369fa1114 100644 --- a/packages/twenty-front/src/modules/views/hooks/useSaveRecordFilterGroupsToViewFilterGroups.ts +++ b/packages/twenty-front/src/modules/views/hooks/useSaveRecordFilterGroupsToViewFilterGroups.ts @@ -71,11 +71,11 @@ export const useSaveRecordFilterGroupsToViewFilterGroups = () => { await deleteViewFilterGroupRecords(viewFilterGroupIdsToDelete); }, [ - createViewFilterGroupRecords, - deleteViewFilterGroupRecords, - updateViewFilterGroupRecords, - currentRecordFilterGroupsCallbackState, currentView, + currentRecordFilterGroupsCallbackState, + createViewFilterGroupRecords, + updateViewFilterGroupRecords, + deleteViewFilterGroupRecords, ], ); diff --git a/packages/twenty-front/src/modules/views/hooks/useSaveRecordFiltersToViewFilters.ts b/packages/twenty-front/src/modules/views/hooks/useSaveRecordFiltersToViewFilters.ts index 95c7468c3aa..66e26831a7d 100644 --- a/packages/twenty-front/src/modules/views/hooks/useSaveRecordFiltersToViewFilters.ts +++ b/packages/twenty-front/src/modules/views/hooks/useSaveRecordFiltersToViewFilters.ts @@ -65,11 +65,11 @@ export const useSaveRecordFiltersToViewFilters = () => { await deleteViewFilterRecords(viewFilterIdsToDelete); }, [ - createViewFilterRecords, - deleteViewFilterRecords, - updateViewFilterRecords, - currentRecordFiltersCallbackState, currentView, + currentRecordFiltersCallbackState, + createViewFilterRecords, + updateViewFilterRecords, + deleteViewFilterRecords, ], ); diff --git a/packages/twenty-front/src/modules/views/hooks/useSaveRecordSortsToViewSorts.ts b/packages/twenty-front/src/modules/views/hooks/useSaveRecordSortsToViewSorts.ts index ace00c68ba2..ca0f33af92f 100644 --- a/packages/twenty-front/src/modules/views/hooks/useSaveRecordSortsToViewSorts.ts +++ b/packages/twenty-front/src/modules/views/hooks/useSaveRecordSortsToViewSorts.ts @@ -63,11 +63,11 @@ export const useSaveRecordSortsToViewSorts = () => { await deleteViewSortRecords(viewSortIdsToDelete); }, [ - createViewSortRecords, - deleteViewSortRecords, - updateViewSortRecords, - currentRecordSortsCallbackState, currentView, + currentRecordSortsCallbackState, + createViewSortRecords, + updateViewSortRecords, + deleteViewSortRecords, ], ); diff --git a/packages/twenty-front/src/modules/views/hooks/useUpdateView.ts b/packages/twenty-front/src/modules/views/hooks/useUpdateView.ts index 501e7959b1c..33c90806fb1 100644 --- a/packages/twenty-front/src/modules/views/hooks/useUpdateView.ts +++ b/packages/twenty-front/src/modules/views/hooks/useUpdateView.ts @@ -1,11 +1,13 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular'; import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord'; +import { useRecordIndexContextOrThrow } from '@/object-record/record-index/contexts/RecordIndexContext'; import { type GraphQLView } from '@/views/types/GraphQLView'; import { convertUpdateViewInputToCore } from '@/views/utils/convertUpdateViewInputToCore'; import { useFeatureFlagsMap } from '@/workspace/hooks/useFeatureFlagsMap'; import { useRecoilCallback } from 'recoil'; import { isDefined } from 'twenty-shared/utils'; import { FeatureFlagKey, useUpdateCoreViewMutation } from '~/generated/graphql'; +import { useRefreshCoreViews } from './useRefreshCoreViews'; export const useUpdateView = () => { const featureFlagMap = useFeatureFlagsMap(); @@ -17,25 +19,39 @@ export const useUpdateView = () => { const [updateOneCoreView] = useUpdateCoreViewMutation(); + const { refreshCoreViews } = useRefreshCoreViews(); + + const { objectMetadataItem } = useRecordIndexContextOrThrow(); + const updateView = useRecoilCallback( () => async (view: Partial) => { - if (isDefined(view.id)) { - if (isCoreViewEnabled) { - await updateOneCoreView({ - variables: { - id: view.id, - input: convertUpdateViewInputToCore(view), - }, - }); - } else { - await updateOneRecord({ - idToUpdate: view.id, - updateOneRecordInput: view, - }); - } + if (!isDefined(view.id)) { + return; + } + + if (isCoreViewEnabled) { + await updateOneCoreView({ + variables: { + id: view.id, + input: convertUpdateViewInputToCore(view), + }, + }); + + await refreshCoreViews(objectMetadataItem.id); + } else { + await updateOneRecord({ + idToUpdate: view.id, + updateOneRecordInput: view, + }); } }, - [isCoreViewEnabled, updateOneCoreView, updateOneRecord], + [ + isCoreViewEnabled, + objectMetadataItem.id, + refreshCoreViews, + updateOneCoreView, + updateOneRecord, + ], ); return { diff --git a/packages/twenty-front/src/modules/views/states/coreViewsByObjectMetadataIdFamilySelector.ts b/packages/twenty-front/src/modules/views/states/coreViewsByObjectMetadataIdFamilySelector.ts new file mode 100644 index 00000000000..15b59b0cf7c --- /dev/null +++ b/packages/twenty-front/src/modules/views/states/coreViewsByObjectMetadataIdFamilySelector.ts @@ -0,0 +1,41 @@ +import { selectorFamily } from 'recoil'; + +import { coreViewsState } from '@/views/states/coreViewState'; +import { type CoreViewWithRelations } from '@/views/types/CoreViewWithRelations'; + +export const coreViewsByObjectMetadataIdFamilySelector = selectorFamily< + CoreViewWithRelations[], + string +>({ + key: 'coreViewsByObjectMetadataIdFamilySelector', + get: + (objectMetadataId: string) => + ({ get }) => { + const coreViews = get(coreViewsState); + + return coreViews.filter( + (view) => view.objectMetadataId === objectMetadataId, + ); + }, + set: + (objectMetadataId: string) => + ({ get, set }, newViewsForObject) => { + const currentCoreViews = get(coreViewsState); + + const viewsFromOtherObjects = currentCoreViews.filter( + (view) => view.objectMetadataId !== objectMetadataId, + ); + + let updatedViewsForObject: CoreViewWithRelations[]; + + if (Array.isArray(newViewsForObject)) { + updatedViewsForObject = newViewsForObject; + } else { + updatedViewsForObject = []; + } + + const newCoreViews = [...viewsFromOtherObjects, ...updatedViewsForObject]; + + set(coreViewsState, newCoreViews); + }, +}); diff --git a/packages/twenty-front/src/modules/views/types/CoreViewWithRelations.ts b/packages/twenty-front/src/modules/views/types/CoreViewWithRelations.ts index 3d5a2bc75e0..585a19d89f3 100644 --- a/packages/twenty-front/src/modules/views/types/CoreViewWithRelations.ts +++ b/packages/twenty-front/src/modules/views/types/CoreViewWithRelations.ts @@ -17,11 +17,17 @@ export type CoreViewWithRelations = { key?: ViewKey | null; objectMetadataId: string; isCompact: boolean; - viewFields: Omit[]; - viewGroups: Omit[]; - viewFilters: Omit[]; - viewFilterGroups?: Omit[]; - viewSorts: Omit[]; + viewFields: Omit[]; + viewGroups: Omit[]; + viewFilters: Omit< + CoreViewFilter, + 'workspaceId' | 'createdAt' | 'updatedAt' + >[]; + viewFilterGroups?: Omit< + CoreViewFilterGroup, + 'workspaceId' | 'createdAt' | 'updatedAt' + >[]; + viewSorts: Omit[]; kanbanAggregateOperation?: AggregateOperations | null; kanbanAggregateOperationFieldMetadataId?: string | null; position: number; diff --git a/packages/twenty-front/src/modules/views/utils/convertCoreViewFieldToViewField.ts b/packages/twenty-front/src/modules/views/utils/convertCoreViewFieldToViewField.ts index bc235ca7837..4c3b1fe5520 100644 --- a/packages/twenty-front/src/modules/views/utils/convertCoreViewFieldToViewField.ts +++ b/packages/twenty-front/src/modules/views/utils/convertCoreViewFieldToViewField.ts @@ -4,7 +4,15 @@ import { type ViewField } from '@/views/types/ViewField'; import { type CoreViewField } from '~/generated/graphql'; export const convertCoreViewFieldToViewField = ( - coreViewField: Omit, + coreViewField: Pick< + CoreViewField, + | 'id' + | 'fieldMetadataId' + | 'position' + | 'isVisible' + | 'size' + | 'aggregateOperation' + >, ): ViewField => { const viewField: ViewField = { __typename: 'ViewField', diff --git a/packages/twenty-front/src/modules/views/utils/convertCoreViewFilterGroupToViewFilterGroup.ts b/packages/twenty-front/src/modules/views/utils/convertCoreViewFilterGroupToViewFilterGroup.ts index de4c38f3505..ce9d9fe8380 100644 --- a/packages/twenty-front/src/modules/views/utils/convertCoreViewFilterGroupToViewFilterGroup.ts +++ b/packages/twenty-front/src/modules/views/utils/convertCoreViewFilterGroupToViewFilterGroup.ts @@ -3,7 +3,14 @@ import { ViewFilterGroupLogicalOperator } from '@/views/types/ViewFilterGroupLog import { type CoreViewFilterGroup } from '~/generated/graphql'; export const convertCoreViewFilterGroupToViewFilterGroup = ( - coreViewFilterGroup: Omit, + coreViewFilterGroup: Pick< + CoreViewFilterGroup, + | 'id' + | 'viewId' + | 'parentViewFilterGroupId' + | 'logicalOperator' + | 'positionInViewFilterGroup' + >, ): ViewFilterGroup => { return { __typename: 'ViewFilterGroup', diff --git a/packages/twenty-front/src/modules/views/utils/convertCoreViewFilterToViewFilter.ts b/packages/twenty-front/src/modules/views/utils/convertCoreViewFilterToViewFilter.ts index fa663d72246..b11ca649462 100644 --- a/packages/twenty-front/src/modules/views/utils/convertCoreViewFilterToViewFilter.ts +++ b/packages/twenty-front/src/modules/views/utils/convertCoreViewFilterToViewFilter.ts @@ -1,9 +1,19 @@ +import { type CompositeFieldSubFieldName } from '@/settings/data-model/types/CompositeFieldSubFieldName'; import { type ViewFilter } from '@/views/types/ViewFilter'; import { type CoreViewFilter } from '~/generated/graphql'; import { convertViewFilterOperandFromCore } from '../utils/convertViewFilterOperandFromCore'; export const convertCoreViewFilterToViewFilter = ( - coreViewFilter: Omit, + coreViewFilter: Pick< + CoreViewFilter, + | 'id' + | 'fieldMetadataId' + | 'operand' + | 'value' + | 'viewFilterGroupId' + | 'positionInViewFilterGroup' + | 'subFieldName' + >, ): ViewFilter => { return { __typename: 'ViewFilter', @@ -18,11 +28,8 @@ export const convertCoreViewFilterToViewFilter = ( typeof coreViewFilter.value === 'string' ? coreViewFilter.value : JSON.stringify(coreViewFilter.value ?? ''), - createdAt: coreViewFilter.createdAt, - updatedAt: coreViewFilter.updatedAt, - viewId: coreViewFilter.viewId, - viewFilterGroupId: coreViewFilter.viewFilterGroupId ?? undefined, - positionInViewFilterGroup: coreViewFilter.positionInViewFilterGroup ?? null, - subFieldName: (coreViewFilter.subFieldName as any) ?? null, + viewFilterGroupId: coreViewFilter.viewFilterGroupId, + positionInViewFilterGroup: coreViewFilter.positionInViewFilterGroup, + subFieldName: coreViewFilter.subFieldName as CompositeFieldSubFieldName, }; }; diff --git a/packages/twenty-front/src/modules/views/utils/convertCoreViewGroupToViewGroup.ts b/packages/twenty-front/src/modules/views/utils/convertCoreViewGroupToViewGroup.ts index 154fae0a01c..fe14f48125c 100644 --- a/packages/twenty-front/src/modules/views/utils/convertCoreViewGroupToViewGroup.ts +++ b/packages/twenty-front/src/modules/views/utils/convertCoreViewGroupToViewGroup.ts @@ -2,7 +2,10 @@ import { type ViewGroup } from '@/views/types/ViewGroup'; import { type CoreViewGroup } from '~/generated/graphql'; export const convertCoreViewGroupToViewGroup = ( - coreViewGroup: Omit, + coreViewGroup: Pick< + CoreViewGroup, + 'id' | 'fieldMetadataId' | 'isVisible' | 'fieldValue' | 'position' + >, ): ViewGroup => { return { __typename: 'ViewGroup', diff --git a/packages/twenty-front/src/modules/views/utils/convertCoreViewSortToViewSort.ts b/packages/twenty-front/src/modules/views/utils/convertCoreViewSortToViewSort.ts index 139ce7fa98e..6d82f7c6620 100644 --- a/packages/twenty-front/src/modules/views/utils/convertCoreViewSortToViewSort.ts +++ b/packages/twenty-front/src/modules/views/utils/convertCoreViewSortToViewSort.ts @@ -2,7 +2,7 @@ import { type ViewSort } from '@/views/types/ViewSort'; import { type CoreViewSort, ViewSortDirection } from '~/generated/graphql'; export const convertCoreViewSortToViewSort = ( - coreViewSort: Omit, + coreViewSort: Pick, ): ViewSort => { return { __typename: 'ViewSort', diff --git a/packages/twenty-front/src/modules/views/utils/convertUpdateViewInputToCore.ts b/packages/twenty-front/src/modules/views/utils/convertUpdateViewInputToCore.ts index 2e07675536f..2ea6d924be6 100644 --- a/packages/twenty-front/src/modules/views/utils/convertUpdateViewInputToCore.ts +++ b/packages/twenty-front/src/modules/views/utils/convertUpdateViewInputToCore.ts @@ -6,7 +6,7 @@ import { isDefined } from 'twenty-shared/utils'; import { type UpdateViewInput } from '~/generated-metadata/graphql'; export const convertUpdateViewInputToCore = ( - view: Partial, + view: Partial, ): UpdateViewInput => { const { key, @@ -17,6 +17,9 @@ export const convertUpdateViewInputToCore = ( viewFilterGroups: _viewFilterGroups, viewGroups: _viewGroups, viewSorts: _viewSorts, + kanbanFieldMetadataId: _kanbanFieldMetadataId, + id: _id, + __typename: _typename, ...rest } = view; diff --git a/packages/twenty-front/src/modules/views/utils/getViewFiltersToCreate.ts b/packages/twenty-front/src/modules/views/utils/getViewFiltersToCreate.ts index 715a5ee9974..44df5868ca1 100644 --- a/packages/twenty-front/src/modules/views/utils/getViewFiltersToCreate.ts +++ b/packages/twenty-front/src/modules/views/utils/getViewFiltersToCreate.ts @@ -1,6 +1,6 @@ import { type ViewFilter } from '@/views/types/ViewFilter'; -import { compareStrictlyExceptForNullAndUndefined } from '~/utils/compareStrictlyExceptForNullAndUndefined'; import { isDefined } from 'twenty-shared/utils'; +import { compareStrictlyExceptForNullAndUndefined } from '~/utils/compareStrictlyExceptForNullAndUndefined'; export const getViewFiltersToCreate = ( currentViewFilters: ViewFilter[], diff --git a/packages/twenty-front/src/modules/views/utils/getViewFiltersToUpdate.ts b/packages/twenty-front/src/modules/views/utils/getViewFiltersToUpdate.ts index c67ab7514c1..9337f5ba157 100644 --- a/packages/twenty-front/src/modules/views/utils/getViewFiltersToUpdate.ts +++ b/packages/twenty-front/src/modules/views/utils/getViewFiltersToUpdate.ts @@ -1,7 +1,7 @@ import { type ViewFilter } from '@/views/types/ViewFilter'; import { areViewFiltersEqual } from '@/views/utils/areViewFiltersEqual'; -import { compareStrictlyExceptForNullAndUndefined } from '~/utils/compareStrictlyExceptForNullAndUndefined'; import { isDefined } from 'twenty-shared/utils'; +import { compareStrictlyExceptForNullAndUndefined } from '~/utils/compareStrictlyExceptForNullAndUndefined'; export const getViewFiltersToUpdate = ( currentViewFilters: ViewFilter[], diff --git a/packages/twenty-server/src/engine/core-modules/file/dtos/file.dto.ts b/packages/twenty-server/src/engine/core-modules/file/dtos/file.dto.ts index 83b14259b64..ef3e1ee2a5f 100644 --- a/packages/twenty-server/src/engine/core-modules/file/dtos/file.dto.ts +++ b/packages/twenty-server/src/engine/core-modules/file/dtos/file.dto.ts @@ -22,6 +22,6 @@ export class FileDTO { @Field(() => UUIDScalarType, { nullable: true }) messageId?: string; - @Field() + @Field(() => Date, { nullable: false }) createdAt: Date; } diff --git a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-field.input.ts b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-field.input.ts index 37e43e608b5..55977e8ae56 100644 --- a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-field.input.ts +++ b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-field.input.ts @@ -5,6 +5,9 @@ import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/ @InputType() export class CreateViewFieldInput { + @Field(() => UUIDScalarType, { nullable: true }) + id?: string; + @Field(() => UUIDScalarType, { nullable: false }) fieldMetadataId: string; diff --git a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-filter-group.input.ts b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-filter-group.input.ts index cd69486f5d8..1807c3b8209 100644 --- a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-filter-group.input.ts +++ b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-filter-group.input.ts @@ -5,6 +5,9 @@ import { ViewFilterGroupLogicalOperator } from 'src/engine/core-modules/view/enu @InputType() export class CreateViewFilterGroupInput { + @Field(() => UUIDScalarType, { nullable: true }) + id?: string; + @Field(() => UUIDScalarType, { nullable: true }) parentViewFilterGroupId?: string; diff --git a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-filter.input.ts b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-filter.input.ts index 99d8f61692c..ee8716a52ca 100644 --- a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-filter.input.ts +++ b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-filter.input.ts @@ -8,6 +8,9 @@ import { ViewFilterValue } from 'src/engine/core-modules/view/types/view-filter- @InputType() export class CreateViewFilterInput { + @Field(() => UUIDScalarType, { nullable: true }) + id?: string; + @Field(() => UUIDScalarType, { nullable: false }) fieldMetadataId: string; diff --git a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-group.input.ts b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-group.input.ts index 304a8d4cb41..f0362675a49 100644 --- a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-group.input.ts +++ b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-group.input.ts @@ -1,9 +1,12 @@ -import { InputType, Field } from '@nestjs/graphql'; +import { Field, InputType } from '@nestjs/graphql'; import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars'; @InputType() export class CreateViewGroupInput { + @Field(() => UUIDScalarType, { nullable: true }) + id?: string; + @Field(() => UUIDScalarType, { nullable: false }) fieldMetadataId: string; diff --git a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-sort.input.ts b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-sort.input.ts index 65a33eceb41..c84560e8774 100644 --- a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-sort.input.ts +++ b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view-sort.input.ts @@ -5,6 +5,9 @@ import { ViewSortDirection } from 'src/engine/core-modules/view/enums/view-sort- @InputType() export class CreateViewSortInput { + @Field(() => UUIDScalarType, { nullable: true }) + id?: string; + @Field(() => UUIDScalarType, { nullable: false }) fieldMetadataId: string; diff --git a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view.input.ts b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view.input.ts index 036e6ed3e07..0dcd1baec0d 100644 --- a/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view.input.ts +++ b/packages/twenty-server/src/engine/core-modules/view/dtos/inputs/create-view.input.ts @@ -8,6 +8,9 @@ import { ViewType } from 'src/engine/core-modules/view/enums/view-type.enum'; @InputType() export class CreateViewInput { + @Field(() => UUIDScalarType, { nullable: true }) + id?: string; + @Field({ nullable: false }) name: string; diff --git a/packages/twenty-server/src/engine/workspace-manager/__tests__/workspace-manager.service.spec.ts b/packages/twenty-server/src/engine/workspace-manager/__tests__/workspace-manager.service.spec.ts index 77de1c29614..5123ebadbd7 100644 --- a/packages/twenty-server/src/engine/workspace-manager/__tests__/workspace-manager.service.spec.ts +++ b/packages/twenty-server/src/engine/workspace-manager/__tests__/workspace-manager.service.spec.ts @@ -1,7 +1,7 @@ import { Test, type TestingModule } from '@nestjs/testing'; -import { getRepositoryToken } from '@nestjs/typeorm'; +import { getDataSourceToken, getRepositoryToken } from '@nestjs/typeorm'; -import { type Repository } from 'typeorm'; +import { type DataSource, type Repository } from 'typeorm'; import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service'; import { UserWorkspace } from 'src/engine/core-modules/user-workspace/user-workspace.entity'; @@ -33,13 +33,22 @@ describe('WorkspaceManagerService', () => { let workspaceDataSourceService: WorkspaceDataSourceService; let roleTargetsRepository: Repository; let roleRepository: Repository; + let mockDataSource: jest.Mocked; beforeEach(async () => { + mockDataSource = { + transaction: jest.fn(), + } as any; + const module: TestingModule = await Test.createTestingModule({ providers: [ WorkspaceManagerService, WorkspaceMigrationService, DataSourceService, + { + provide: getDataSourceToken(), + useValue: mockDataSource, + }, { provide: getRepositoryToken(Workspace), useValue: {}, diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/data/services/dev-seeder-data.service.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/data/services/dev-seeder-data.service.ts index 086106d0143..6058ed645fd 100644 --- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/data/services/dev-seeder-data.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/data/services/dev-seeder-data.service.ts @@ -6,7 +6,6 @@ import { DataSource } from 'typeorm'; import { ObjectMetadataService } from 'src/engine/metadata-modules/object-metadata/object-metadata.service'; import { type WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/workspace-entity-manager'; import { computeTableName } from 'src/engine/utils/compute-table-name.util'; -import { shouldSeedWorkspaceFavorite } from 'src/engine/utils/should-seed-workspace-favorite'; import { CALENDAR_CHANNEL_DATA_SEED_COLUMNS, CALENDAR_CHANNEL_DATA_SEEDS, @@ -88,9 +87,7 @@ import { WORKSPACE_MEMBER_DATA_SEEDS, } from 'src/engine/workspace-manager/dev-seeder/data/constants/workspace-member-data-seeds.constant'; import { TimelineActivitySeederService } from 'src/engine/workspace-manager/dev-seeder/data/services/timeline-activity-seeder.service'; -import { prefillViews } from 'src/engine/workspace-manager/standard-objects-prefill-data/prefill-views'; import { prefillWorkflows } from 'src/engine/workspace-manager/standard-objects-prefill-data/prefill-workflows'; -import { prefillWorkspaceFavorites } from 'src/engine/workspace-manager/standard-objects-prefill-data/prefill-workspace-favorites'; const RECORD_SEEDS_CONFIGS = [ { @@ -242,28 +239,7 @@ export class DevSeederDataService { workspaceId, }); - const viewDefinitionsWithId = await prefillViews( - entityManager, - schemaName, - objectMetadataItems.filter((item) => !item.isCustom), - ); - await prefillWorkflows(entityManager, schemaName, objectMetadataItems); - - await prefillWorkspaceFavorites( - viewDefinitionsWithId - .filter( - (view) => - view.key === 'INDEX' && - shouldSeedWorkspaceFavorite( - view.objectMetadataId, - objectMetadataItems, - ), - ) - .map((view) => view.id), - entityManager, - schemaName, - ); }, ); } diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/services/dev-seeder-metadata.service.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/services/dev-seeder-metadata.service.ts index 461eeab92b6..fd30b4dfa08 100644 --- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/services/dev-seeder-metadata.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/services/dev-seeder-metadata.service.ts @@ -104,7 +104,7 @@ export class DevSeederMetadataService { }); } - await this.seedCoreViews(workspaceId); + await this.seedCoreViews({ workspaceId, dataSourceMetadata }); } private async seedCustomObject({ @@ -152,14 +152,21 @@ export class DevSeederMetadataService { ); } - private async seedCoreViews(workspaceId: string): Promise { + private async seedCoreViews({ + workspaceId, + dataSourceMetadata, + }: { + workspaceId: string; + dataSourceMetadata: DataSourceEntity; + }): Promise { const createdObjectMetadata = await this.objectMetadataService.findManyWithinWorkspace(workspaceId); - await prefillCoreViews( - this.coreDataSource, + await prefillCoreViews({ + coreDataSource: this.coreDataSource, workspaceId, - createdObjectMetadata, - ); + objectMetadataItems: createdObjectMetadata, + schemaName: dataSourceMetadata.schema, + }); } } diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-companies.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-companies.ts index 78c519958ea..c11776b6002 100644 --- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-companies.ts +++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-companies.ts @@ -1,5 +1,6 @@ +import { type EntityManager } from 'typeorm'; + import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; -import { type WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/workspace-entity-manager'; export const AIRBNB_ID = 'c776ee49-f608-4a77-8cc8-6fe96ae1e43f'; export const ANTHROPIC_ID = 'f45ee421-8a3e-4aa5-a1cf-7207cc6754e1'; @@ -8,13 +9,11 @@ export const FIGMA_ID = '9d5bcf43-7d38-4e88-82cb-d6d4ce638bf0'; export const NOTION_ID = '06290608-8bf0-4806-99ae-a715a6a93fad'; export const prefillCompanies = async ( - entityManager: WorkspaceEntityManager, + entityManager: EntityManager, schemaName: string, ) => { await entityManager - .createQueryBuilder(undefined, undefined, undefined, { - shouldBypassPermissionChecks: true, - }) + .createQueryBuilder() .insert() .into(`${schemaName}.company`, [ 'id', diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-core-views.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-core-views.ts index 90b712c8983..17409464c46 100644 --- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-core-views.ts +++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-core-views.ts @@ -12,12 +12,15 @@ import { ViewKey } from 'src/engine/core-modules/view/enums/view-key.enum'; import { ViewOpenRecordIn } from 'src/engine/core-modules/view/enums/view-open-record-in'; import { ViewType } from 'src/engine/core-modules/view/enums/view-type.enum'; import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; +import { type WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/workspace-entity-manager'; +import { shouldSeedWorkspaceFavorite } from 'src/engine/utils/should-seed-workspace-favorite'; +import { prefillWorkspaceFavorites } from 'src/engine/workspace-manager/standard-objects-prefill-data/prefill-workspace-favorites'; import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface'; import { companiesAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/companies-all.view'; import { dashboardsAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/dashboards-all.view'; import { notesAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/notes-all.view'; import { opportunitiesAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/opportunities-all.view'; -import { opportunitiesTableByStageView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/opportunity-table-by-stage.view'; +import { opportunitiesByStageView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/opportunity-by-stage.view'; import { peopleAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/people-all.view'; import { tasksAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/tasks-all.view'; import { tasksAssignedToMeView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/tasks-assigned-to-me'; @@ -28,17 +31,26 @@ import { workflowsAllView } from 'src/engine/workspace-manager/standard-objects- import { ViewOpenRecordInType } from 'src/modules/view/standard-objects/view.workspace-entity'; import { convertViewFilterOperandToCoreOperand } from 'src/modules/view/utils/convert-view-filter-operand-to-core-operand.util'; -export const prefillCoreViews = async ( - coreDataSource: DataSource, - workspaceId: string, - objectMetadataItems: ObjectMetadataEntity[], - featureFlags?: Record, -): Promise => { +type PrefillCoreViewsArgs = { + coreDataSource: DataSource; + workspaceId: string; + objectMetadataItems: ObjectMetadataEntity[]; + schemaName: string; + featureFlags?: Record; +}; + +export const prefillCoreViews = async ({ + coreDataSource, + workspaceId, + objectMetadataItems, + schemaName, + featureFlags, +}: PrefillCoreViewsArgs): Promise => { const views = [ companiesAllView(objectMetadataItems, true), peopleAllView(objectMetadataItems, true), opportunitiesAllView(objectMetadataItems, true), - opportunitiesTableByStageView(objectMetadataItems, true), + opportunitiesByStageView(objectMetadataItems, true), notesAllView(objectMetadataItems, true), tasksAllView(objectMetadataItems, true), tasksAssignedToMeView(objectMetadataItems, true), @@ -61,6 +73,21 @@ export const prefillCoreViews = async ( const createdViews = await createCoreViews(queryRunner, workspaceId, views); + await prefillWorkspaceFavorites( + createdViews + .filter( + (view) => + view.key === 'INDEX' && + shouldSeedWorkspaceFavorite( + view.objectMetadataId, + objectMetadataItems, + ), + ) + .map((view) => view.id), + queryRunner.manager as WorkspaceEntityManager, + schemaName, + ); + await queryRunner.commitTransaction(); return createdViews; diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-people.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-people.ts index e1dbc9199e0..fe065c0f86c 100644 --- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-people.ts +++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-people.ts @@ -1,5 +1,6 @@ +import { type EntityManager } from 'typeorm'; + import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; -import { type WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/workspace-entity-manager'; import { AIRBNB_ID, ANTHROPIC_ID, @@ -9,13 +10,11 @@ import { } from 'src/engine/workspace-manager/standard-objects-prefill-data/prefill-companies'; export const prefillPeople = async ( - entityManager: WorkspaceEntityManager, + entityManager: EntityManager, schemaName: string, ) => { await entityManager - .createQueryBuilder(undefined, undefined, undefined, { - shouldBypassPermissionChecks: true, - }) + .createQueryBuilder() .insert() .into(`${schemaName}.person`, [ 'nameFirstName', diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-views.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-views.ts index 8e556cba54b..0f86a6eb61e 100644 --- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-views.ts +++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-views.ts @@ -1,8 +1,8 @@ +import { type EntityManager } from 'typeorm'; import { v4 } from 'uuid'; import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum'; import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; -import { type WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/workspace-entity-manager'; import { type ViewDefinition } from 'src/engine/workspace-manager/standard-objects-prefill-data/types/view-definition.interface'; import { companiesAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/companies-all.view'; import { customAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/custom-all.view'; @@ -19,7 +19,7 @@ import { workflowVersionsAllView } from 'src/engine/workspace-manager/standard-o import { workflowsAllView } from 'src/engine/workspace-manager/standard-objects-prefill-data/views/workflows-all.view'; export const prefillViews = async ( - entityManager: WorkspaceEntityManager, + entityManager: EntityManager, schemaName: string, objectMetadataItems: ObjectMetadataEntity[], featureFlags?: Record, @@ -55,7 +55,7 @@ export const prefillViews = async ( }; const createWorkspaceViews = async ( - entityManager: WorkspaceEntityManager, + entityManager: EntityManager, schemaName: string, viewDefinitions: ViewDefinition[], ) => { @@ -65,9 +65,7 @@ const createWorkspaceViews = async ( })); await entityManager - .createQueryBuilder(undefined, undefined, undefined, { - shouldBypassPermissionChecks: true, - }) + .createQueryBuilder() .insert() .into(`${schemaName}.view`, [ 'id', @@ -117,9 +115,7 @@ const createWorkspaceViews = async ( for (const viewDefinition of viewDefinitionsWithId) { if (viewDefinition.fields && viewDefinition.fields.length > 0) { await entityManager - .createQueryBuilder(undefined, undefined, undefined, { - shouldBypassPermissionChecks: true, - }) + .createQueryBuilder() .insert() .into(`${schemaName}.viewField`, [ 'fieldMetadataId', @@ -144,9 +140,7 @@ const createWorkspaceViews = async ( if (viewDefinition.filters && viewDefinition.filters.length > 0) { await entityManager - .createQueryBuilder(undefined, undefined, undefined, { - shouldBypassPermissionChecks: true, - }) + .createQueryBuilder() .insert() .into(`${schemaName}.viewFilter`, [ 'fieldMetadataId', @@ -174,9 +168,7 @@ const createWorkspaceViews = async ( viewDefinition.groups.length > 0 ) { await entityManager - .createQueryBuilder(undefined, undefined, undefined, { - shouldBypassPermissionChecks: true, - }) + .createQueryBuilder() .insert() .into(`${schemaName}.viewGroup`, [ 'fieldMetadataId', diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-workflows.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-workflows.ts index 6101b9fcf72..faa727b7ba3 100644 --- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-workflows.ts +++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-workflows.ts @@ -1,16 +1,16 @@ import { isDefined } from 'twenty-shared/utils'; +import { type EntityManager } from 'typeorm'; import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; import { generateObjectMetadataMaps } from 'src/engine/metadata-modules/utils/generate-object-metadata-maps.util'; -import { type WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/workspace-entity-manager'; import { generateObjectRecordFields } from 'src/modules/workflow/workflow-builder/workflow-schema/utils/generate-object-record-fields'; const QUICK_LEAD_WORKFLOW_ID = '8b213cac-a68b-4ffe-817a-3ec994e9932d'; const QUICK_LEAD_WORKFLOW_VERSION_ID = 'ac67974f-c524-4288-9d88-af8515400b68'; export const prefillWorkflows = async ( - entityManager: WorkspaceEntityManager, + entityManager: EntityManager, schemaName: string, objectMetadataItems: ObjectMetadataEntity[], ) => { @@ -37,9 +37,7 @@ export const prefillWorkflows = async ( } await entityManager - .createQueryBuilder(undefined, undefined, undefined, { - shouldBypassPermissionChecks: true, - }) + .createQueryBuilder() .insert() .into(`${schemaName}.workflow`, [ 'id', @@ -70,9 +68,7 @@ export const prefillWorkflows = async ( .execute(); await entityManager - .createQueryBuilder(undefined, undefined, undefined, { - shouldBypassPermissionChecks: true, - }) + .createQueryBuilder() .insert() .into(`${schemaName}.workflowVersion`, [ 'id', diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-workspace-favorites.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-workspace-favorites.ts index 7e4e4bf35f9..ffe5f39f0a4 100644 --- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-workspace-favorites.ts +++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/prefill-workspace-favorites.ts @@ -1,18 +1,15 @@ +import { type EntityManager } from 'typeorm'; import { v4 } from 'uuid'; -import { type WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/workspace-entity-manager'; - const tableName = 'favorite'; export const prefillWorkspaceFavorites = async ( viewIds: string[], - entityManager: WorkspaceEntityManager, + entityManager: EntityManager, schemaName: string, ) => { await entityManager - .createQueryBuilder(undefined, undefined, undefined, { - shouldBypassPermissionChecks: true, - }) + .createQueryBuilder() .insert() .into(`${schemaName}.${tableName}`, ['id', 'viewId', 'position']) .values( diff --git a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/standard-objects-prefill-data.ts b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/standard-objects-prefill-data.ts index e04208f1e2b..11f8b0c075b 100644 --- a/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/standard-objects-prefill-data.ts +++ b/packages/twenty-server/src/engine/workspace-manager/standard-objects-prefill-data/standard-objects-prefill-data.ts @@ -1,6 +1,6 @@ +import { type DataSource, type EntityManager } from 'typeorm'; + import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity'; -import { type WorkspaceDataSource } from 'src/engine/twenty-orm/datasource/workspace.datasource'; -import { type WorkspaceEntityManager } from 'src/engine/twenty-orm/entity-manager/workspace-entity-manager'; import { shouldSeedWorkspaceFavorite } from 'src/engine/utils/should-seed-workspace-favorite'; import { prefillCompanies } from 'src/engine/workspace-manager/standard-objects-prefill-data/prefill-companies'; import { prefillPeople } from 'src/engine/workspace-manager/standard-objects-prefill-data/prefill-people'; @@ -9,40 +9,38 @@ import { prefillWorkflows } from 'src/engine/workspace-manager/standard-objects- import { prefillWorkspaceFavorites } from 'src/engine/workspace-manager/standard-objects-prefill-data/prefill-workspace-favorites'; export const standardObjectsPrefillData = async ( - workspaceDataSource: WorkspaceDataSource, + dataSource: DataSource, schemaName: string, objectMetadataItems: ObjectMetadataEntity[], featureFlags?: Record, ) => { - workspaceDataSource.transaction( - async (entityManager: WorkspaceEntityManager) => { - await prefillCompanies(entityManager, schemaName); + dataSource.transaction(async (entityManager: EntityManager) => { + await prefillCompanies(entityManager, schemaName); - await prefillPeople(entityManager, schemaName); + await prefillPeople(entityManager, schemaName); - await prefillWorkflows(entityManager, schemaName, objectMetadataItems); + await prefillWorkflows(entityManager, schemaName, objectMetadataItems); - const viewDefinitionsWithId = await prefillViews( - entityManager, - schemaName, - objectMetadataItems, - featureFlags, - ); + const viewDefinitionsWithId = await prefillViews( + entityManager, + schemaName, + objectMetadataItems, + featureFlags, + ); - await prefillWorkspaceFavorites( - viewDefinitionsWithId - .filter( - (view) => - view.key === 'INDEX' && - shouldSeedWorkspaceFavorite( - view.objectMetadataId, - objectMetadataItems, - ), - ) - .map((view) => view.id), - entityManager, - schemaName, - ); - }, - ); + await prefillWorkspaceFavorites( + viewDefinitionsWithId + .filter( + (view) => + view.key === 'INDEX' && + shouldSeedWorkspaceFavorite( + view.objectMetadataId, + objectMetadataItems, + ), + ) + .map((view) => view.id), + entityManager, + schemaName, + ); + }); }; diff --git a/packages/twenty-server/src/engine/workspace-manager/workspace-manager.service.ts b/packages/twenty-server/src/engine/workspace-manager/workspace-manager.service.ts index cbc3020f02f..5969348c7ec 100644 --- a/packages/twenty-server/src/engine/workspace-manager/workspace-manager.service.ts +++ b/packages/twenty-server/src/engine/workspace-manager/workspace-manager.service.ts @@ -1,7 +1,7 @@ import { Injectable, Logger } from '@nestjs/common'; -import { InjectRepository } from '@nestjs/typeorm'; +import { InjectDataSource, InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; +import { DataSource, Repository } from 'typeorm'; import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum'; import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service'; @@ -29,6 +29,8 @@ export class WorkspaceManagerService { private readonly logger = new Logger(WorkspaceManagerService.name); constructor( + @InjectDataSource() + private readonly coreDataSource: DataSource, private readonly workspaceDataSourceService: WorkspaceDataSourceService, private readonly workspaceMigrationService: WorkspaceMigrationService, private readonly objectMetadataService: ObjectMetadataService, @@ -125,16 +127,11 @@ export class WorkspaceManagerService { workspaceId: string, featureFlags: Record, ) { - const workspaceDataSource = - await this.twentyORMGlobalManager.getDataSourceForWorkspace({ - workspaceId, - }); - const createdObjectMetadata = await this.objectMetadataService.findManyWithinWorkspace(workspaceId); await standardObjectsPrefillData( - workspaceDataSource, + this.coreDataSource, dataSourceMetadata.schema, createdObjectMetadata, featureFlags, @@ -143,12 +140,13 @@ export class WorkspaceManagerService { if (featureFlags[FeatureFlagKey.IS_CORE_VIEW_SYNCING_ENABLED]) { this.logger.log(`Prefilling core views for workspace ${workspaceId}`); - await prefillCoreViews( - workspaceDataSource, + await prefillCoreViews({ + coreDataSource: this.coreDataSource, workspaceId, - createdObjectMetadata, + objectMetadataItems: createdObjectMetadata, + schemaName: dataSourceMetadata.schema, featureFlags, - ); + }); } }