Centralize metadata relations constant + simplification (#16901)
# Introduction As we introduced a new grain on relation extraction thanks to low level `SyncableEntity` and `WorkspaceRelatedEntity` we're able to strictly typesafe extract metadata entity The new constant centralizes both many to one and one to many constants metadata entity constants in a more strictly typesafe way. Remains only the flatEntityForeignKey aggregator which has to be chosen manually across all available targeted flat entity ids properties
This commit is contained in:
+2
-4
@@ -1,6 +1,6 @@
|
||||
import { removePropertiesFromRecord } from 'twenty-shared/utils';
|
||||
|
||||
import { ALL_METADATA_RELATION_PROPERTIES } from 'src/engine/metadata-modules/flat-entity/constant/all-metadata-relations-properties.constant';
|
||||
import { getMetadataEntityRelationProperties } from 'src/engine/metadata-modules/flat-entity/utils/get-metadata-entity-relation-properties.util';
|
||||
import { type FlatObjectMetadata } from 'src/engine/metadata-modules/flat-object-metadata/types/flat-object-metadata.type';
|
||||
import { type ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||
|
||||
@@ -9,9 +9,7 @@ export const fromObjectMetadataEntityToFlatObjectMetadata = (
|
||||
): FlatObjectMetadata => {
|
||||
const objectMetadataEntityWithoutRelations = removePropertiesFromRecord(
|
||||
objectMetadataEntity,
|
||||
Object.keys(
|
||||
ALL_METADATA_RELATION_PROPERTIES.objectMetadata,
|
||||
) as (keyof typeof ALL_METADATA_RELATION_PROPERTIES.objectMetadata)[],
|
||||
getMetadataEntityRelationProperties('objectMetadata'),
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user