-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix: relation on self not working #2875
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have left comments!
@@ -168,16 +168,16 @@ export class RelationMetadataService extends TypeOrmQueryService<RelationMetadat | |||
|
|||
const createdFieldMap = createdFields.reduce((acc, fieldMetadata) => { | |||
if (fieldMetadata.type === FieldMetadataType.RELATION) { | |||
acc[fieldMetadata.objectMetadataId] = fieldMetadata; | |||
acc[fieldMetadata.name] = fieldMetadata; | |||
} | |||
|
|||
return acc; | |||
}, {}); | |||
|
|||
const createdRelationMetadata = await super.createOne({ | |||
...record, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprise about the usage of "record" here!?
it should be relation or relationMetadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't really have preference on that as it's referencing the user input
, in fact it should be something like relationInput
but name record
is used in other places in the code for inputs.
I can take a quick look and rename them ? Or maybe we can create a small ticket for that ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's create a small ticket for that! But yes record should be only used to describe the data itself.
The full naming on the project is: an object record is an instance of an object metadata (class)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Relation on self was not working, this PR fix the ticket #2599.
You can now create relation like this one
Person <-> Person
.