The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { type FlatIndexMetadata } from 'src/engine/metadata-modules/flat-index-metadata/types/flat-index-metadata.type';
import { IndexType } from 'twenty-shared/types';
import { type AllStandardObjectIndexName } from 'src/engine/workspace-manager/twenty-standard-application/types/all-standard-object-index-name.type';
import {
type CreateStandardIndexArgs,
createStandardIndexFlatMetadata,
} from 'src/engine/workspace-manager/twenty-standard-application/utils/index/create-standard-index-flat-metadata.util';
export const buildMessageCampaignStandardFlatIndexMetadatas = ({
now,
objectName,
workspaceId,
standardObjectMetadataRelatedEntityIds,
dependencyFlatEntityMaps,
twentyStandardApplicationId,
}: Omit<CreateStandardIndexArgs<'messageCampaign'>, 'context'>): Record<
AllStandardObjectIndexName<'messageCampaign'>,
FlatIndexMetadata
> => ({
unsubscribeTopicIdIndex: createStandardIndexFlatMetadata({
objectName,
workspaceId,
context: {
indexName: 'unsubscribeTopicIdIndex',
relatedFieldNames: ['unsubscribeTopicId'],
},
standardObjectMetadataRelatedEntityIds,
dependencyFlatEntityMaps,
twentyStandardApplicationId,
now,
}),
listIdIndex: createStandardIndexFlatMetadata({
objectName,
workspaceId,
context: {
indexName: 'listIdIndex',
relatedFieldNames: ['list'],
},
standardObjectMetadataRelatedEntityIds,
dependencyFlatEntityMaps,
twentyStandardApplicationId,
now,
}),
searchVectorGinIndex: createStandardIndexFlatMetadata({
objectName,
workspaceId,
context: {
indexName: 'searchVectorGinIndex',
relatedFieldNames: ['searchVector'],
indexType: IndexType.GIN,
hasDeterministicUniversalIdentifier: true,
},
standardObjectMetadataRelatedEntityIds,
dependencyFlatEntityMaps,
twentyStandardApplicationId,
now,
}),
});