Files
twenty/packages/twenty-server/src/engine/metadata-modules/flat-object-metadata/utils/from-flat-object-metadata-to-object-metadata-dto.util.ts
T
Paul Rastoin 6aa43b68f7 Identification cleanup (#17301)
# Introduction

following https://github.com/twentyhq/twenty/pull/17279
As we've finally identified all the syncable metadata entities, which
means they're expected to have non nullable applicationId and
universalIdentifier at pg_level we can remove previous retro comp
universalIdentifier fallbacking and update the dto too

~~This needs IdentifyRemainingEntitiesMetadataCommand and
MakeRemainingEntitiesUniversalIdentifierAndApplicationIdNotNullableMigrationCommand
to be run~~
```ts
[Nest] 197  - 01/21/2026, 3:08:35 PM     LOG [MakeRemainingEntitiesUniversalIdentifierAndApplicationIdNotNullableMigrationCommand] Successfully run MakeRemainingEntitiesUniversalIdentifierAndApplicationIdNotNullableMigrationCommand
```
2026-01-21 16:00:23 +00:00

59 lines
1.4 KiB
TypeScript

import { 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,
): ObjectMetadataDTO => {
const {
createdAt,
updatedAt,
description,
icon,
standardOverrides,
shortcut,
duplicateCriteria,
id,
isActive,
isCustom,
isLabelSyncedWithName,
isRemote,
isSearchable,
isSystem,
isUIReadOnly,
labelPlural,
labelSingular,
namePlural,
nameSingular,
workspaceId,
imageIdentifierFieldMetadataId,
labelIdentifierFieldMetadataId,
applicationId,
} = 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,
applicationId,
};
};