Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new relation resolver #9794

Merged
merged 7 commits into from
Jan 24, 2025
Merged

feat: new relation resolver #9794

merged 7 commits into from
Jan 24, 2025

Conversation

magrinj
Copy link
Member

@magrinj magrinj commented Jan 22, 2025

Fix #240

@magrinj magrinj changed the title Feat/new relation resolver feat: new relation resolver Jan 22, 2025
@magrinj magrinj force-pushed the feat/new-relation-resolver branch from 200d488 to 056df8b Compare January 22, 2025 14:27
@magrinj magrinj force-pushed the feat/new-relation-resolver branch from 056df8b to dbc5bb8 Compare January 22, 2025 15:53
@magrinj magrinj force-pushed the feat/new-relation-resolver branch from 822b226 to 80398b9 Compare January 23, 2025 10:03
@magrinj magrinj force-pushed the feat/new-relation-resolver branch from 0771d0b to d733570 Compare January 23, 2025 10:18
@magrinj magrinj marked this pull request as ready for review January 23, 2025 11:07
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR introduces a new relation resolver feature for managing workspace users, with a feature-flag controlled implementation for field metadata relations.

  • Added new FieldMetadataRelationService in /packages/twenty-server/src/engine/metadata-modules/field-metadata/relation/field-metadata-relation.service.ts for cached field metadata relation handling
  • Introduced RelationDTO in /dtos/relation.dto.ts to define relation metadata structure with proper validation
  • Extended IDataloaders interface with new relationLoader in dataloader.interface.ts for efficient relation data loading
  • Added IsNewRelationEnabled feature flag (defaulting to false) for controlled rollout
  • Enhanced FieldMetadataInterface with new relation-specific properties for defining field and object relationships

11 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings | Greptile

return {
sourceObjectMetadata: cleanObjectMetadata(
sourceObjectMetadata,
) as ObjectMetadataEntity,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid these as ? maybe use Pick to defined the type of sourceObjectMetadata

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried many things and we don't really have an easy way for now, I think a big refactor should be made to drop ObjectMetadataInterface and FieldMetadataInterface, as they were created at first to create "fake/standard" object from typescript file.


import { ObjectMetadataItemWithFieldMaps } from 'src/engine/metadata-modules/types/object-metadata-item-with-field-maps';

export const cleanObjectMetadata = (
Copy link
Member

@charlesBochet charlesBochet Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big fan of this util!
Initial naming is: ObjectMetadataItem (the one we know). ObjectMetadataItemWithFieldMaps (the one with fieldsById, fieldByName...). So could we add it next to the tooling to generate the maps and name it: parseObjectMetadataFromObjectMetadataWithFieldMaps(objectMetadataItemWithFieldMaps: ...)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not seem to be fixed!

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still a comment to be fixed! (can be done in another PR). Also, shouldn't we also put the dataloader behind feature flag?

@charlesBochet charlesBochet merged commit 8d79437 into main Jan 24, 2025
35 checks passed
@charlesBochet charlesBochet deleted the feat/new-relation-resolver branch January 24, 2025 09:38
DeepaPrasanna pushed a commit to DeepaPrasanna/twenty that referenced this pull request Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RelationMetadata] - Edit FieldMetadata resolver in order to compute the relation metadata
3 participants