1536ed3434
# Introduction Following `FieldMetadataInterface` deprecation in https://github.com/twentyhq/twenty/pull/13264 As for the previous PR will rename and remove all the file in a secondary PR to avoid conflicts and over loading this one ## Improvements Removed optional properties from the `objectMetadataEntity` model and added utils to retrieve test data ## Notes By touching to `ObjectMetadataDTO` I would have expected a twenty-front codegenerated types mutation, but it does not seem to be granular enough to null/undefined coercion
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { faker } from '@faker-js/faker';
|
|
|
|
import { DataSourceEntity } from 'src/engine/metadata-modules/data-source/data-source.entity';
|
|
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
|
|
|
export type GetMockObjectMetadataEntityOverride =
|
|
Partial<ObjectMetadataEntity> &
|
|
Required<
|
|
Pick<
|
|
ObjectMetadataEntity,
|
|
'nameSingular' | 'namePlural' | 'id' | 'workspaceId'
|
|
>
|
|
>;
|
|
|
|
export const getMockObjectMetadataEntity = (
|
|
overrides: GetMockObjectMetadataEntityOverride,
|
|
): ObjectMetadataEntity => {
|
|
return {
|
|
createdAt: new Date(),
|
|
updatedAt: new Date(),
|
|
dataSource: {} as DataSourceEntity,
|
|
dataSourceId: faker.string.uuid(),
|
|
description: 'default object metadata description',
|
|
duplicateCriteria: [],
|
|
fieldPermissions: [],
|
|
fields: [],
|
|
icon: null,
|
|
imageIdentifierFieldMetadataId: null,
|
|
labelIdentifierFieldMetadataId: null,
|
|
indexMetadatas: [],
|
|
isActive: true,
|
|
isAuditLogged: true,
|
|
isCustom: true,
|
|
isLabelSyncedWithName: false,
|
|
isRemote: false,
|
|
isSearchable: true,
|
|
isSystem: false,
|
|
labelPlural: 'Default mock plural label',
|
|
labelSingular: 'Default mock plural singular',
|
|
objectPermissions: [],
|
|
shortcut: null,
|
|
standardId: null,
|
|
targetRelationFields: [],
|
|
standardOverrides: null,
|
|
targetTableName: faker.string.uuid(),
|
|
...overrides,
|
|
};
|
|
};
|