## Context All objects have '...duplicates' resolver but only companies and people have duplicate criteria (hard coded constant). Gql schema and resolver should be created only if duplicate criteria exist. ## Solution - Add a new @WorkspaceDuplicateCriteria decorator at object level, defining duplicate criteria for given object. - Add a new duplicate criteria field in ObjectMetadata table - Update schema and resolver building logic - Update front requests for duplicate check (only for object with criteria defined) closes https://github.com/twentyhq/twenty/issues/9828
76 lines
1.4 KiB
TypeScript
76 lines
1.4 KiB
TypeScript
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
|
|
|
|
import { WorkspaceEntityDuplicateCriteria } from 'src/engine/api/graphql/workspace-query-builder/types/workspace-entity-duplicate-criteria.type';
|
|
|
|
export interface WorkspaceEntityMetadataArgs {
|
|
/**
|
|
* Standard id.
|
|
*/
|
|
readonly standardId: string;
|
|
|
|
/**
|
|
* Class to which table is applied.
|
|
* Function target is a table defined in the class.
|
|
* String target is a table defined in a json schema.
|
|
*/
|
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
readonly target: Function;
|
|
|
|
/**
|
|
* Entity name.
|
|
*/
|
|
readonly nameSingular: string;
|
|
readonly namePlural: string;
|
|
|
|
/**
|
|
* Entity label.
|
|
*/
|
|
readonly labelSingular: string;
|
|
readonly labelPlural: string;
|
|
|
|
/**
|
|
* Entity description.
|
|
*/
|
|
readonly description?: string;
|
|
|
|
/**
|
|
* Entity icon.
|
|
*/
|
|
readonly icon?: string;
|
|
|
|
/**
|
|
* Entity shortcut.
|
|
*/
|
|
readonly shortcut?: string;
|
|
|
|
/**
|
|
* Is audit logged.
|
|
*/
|
|
readonly isAuditLogged: boolean;
|
|
|
|
/**
|
|
* Is system object.
|
|
*/
|
|
readonly isSystem: boolean;
|
|
|
|
/**
|
|
* Entity gate.
|
|
*/
|
|
readonly gate?: Gate;
|
|
|
|
/**
|
|
* Label identifier.
|
|
*/
|
|
readonly labelIdentifierStandardId: string | null;
|
|
|
|
/**
|
|
* Image identifier.
|
|
*/
|
|
readonly imageIdentifierStandardId: string | null;
|
|
|
|
/**
|
|
* Duplicate criteria.
|
|
*/
|
|
readonly duplicateCriteria?: WorkspaceEntityDuplicateCriteria[];
|
|
}
|