9e81618773
# Introduction Storing morph relation field names directly in database, using morphId to aggregate them Removing dynamic morph field metadata computation in schemas and data loader Will add integration tests on morph data loader entry closes https://github.com/twentyhq/core-team-issues/issues/1425 closes https://github.com/twentyhq/core-team-issues/issues/1424 closes https://github.com/twentyhq/core-team-issues/issues/1423
60 lines
1.4 KiB
TypeScript
60 lines
1.4 KiB
TypeScript
import {
|
|
type FlatObjectMetadataWithoutFields,
|
|
type FlatObjectMetadata,
|
|
} from 'src/engine/metadata-modules/flat-object-metadata/types/flat-object-metadata.type';
|
|
import { type ObjectMetadataDTO } from 'src/engine/metadata-modules/object-metadata/dtos/object-metadata.dto';
|
|
|
|
export const fromFlatObjectMetadataToObjectMetadataDto = (
|
|
flatObjectMetadata: FlatObjectMetadata | FlatObjectMetadataWithoutFields,
|
|
): ObjectMetadataDTO => {
|
|
const {
|
|
createdAt,
|
|
updatedAt,
|
|
description,
|
|
icon,
|
|
standardOverrides,
|
|
shortcut,
|
|
duplicateCriteria,
|
|
id,
|
|
isActive,
|
|
isCustom,
|
|
isLabelSyncedWithName,
|
|
isRemote,
|
|
isSearchable,
|
|
isSystem,
|
|
isUIReadOnly,
|
|
labelPlural,
|
|
labelSingular,
|
|
namePlural,
|
|
nameSingular,
|
|
workspaceId,
|
|
imageIdentifierFieldMetadataId,
|
|
labelIdentifierFieldMetadataId,
|
|
} = flatObjectMetadata;
|
|
|
|
return {
|
|
id,
|
|
isActive,
|
|
isCustom,
|
|
isLabelSyncedWithName,
|
|
isRemote,
|
|
isSearchable,
|
|
isSystem,
|
|
isUIReadOnly,
|
|
labelPlural,
|
|
labelSingular,
|
|
namePlural,
|
|
nameSingular,
|
|
workspaceId,
|
|
imageIdentifierFieldMetadataId,
|
|
labelIdentifierFieldMetadataId,
|
|
createdAt: new Date(createdAt),
|
|
updatedAt: new Date(updatedAt),
|
|
description: description ?? undefined,
|
|
icon: icon ?? undefined,
|
|
standardOverrides: standardOverrides ?? undefined,
|
|
shortcut: shortcut ?? undefined,
|
|
duplicateCriteria: duplicateCriteria ?? undefined,
|
|
};
|
|
};
|