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

Add columnId entity references for all relations #3127

Open
mschipperheyn opened this issue Oct 10, 2024 · 1 comment
Open

Add columnId entity references for all relations #3127

mschipperheyn opened this issue Oct 10, 2024 · 1 comment
Labels
P4: low Non-critical, workarounds exist type: feature ✨

Comments

@mschipperheyn
Copy link
Collaborator

mschipperheyn commented Oct 10, 2024

Is your feature request related to a problem? Please describe.
One of things I often find annoying in Vendure is that many entity many to one relations don't expose the columnId. This often requires you to execute an additional query to retrieve the entity in services and generally leads to more query overhead and processing.

Vendure does this in some places but it's more an exception than a rule.

This would also be a great to have within the context of customFields

Describe the solution you'd like
Any entity in Vendure should expose a Many to One relation as both a reference and a column

  @Column()
  customerId: ID

  @Index()
  @ManyToOne(() => Customer, { nullable: false, onDelete: 'CASCADE' })
  customer: Customer

Describe alternatives you've considered
The alternative in most scenario's where this is an issue, is to retrieve the entity relation through a query.

@mschipperheyn mschipperheyn added type: feature ✨ P4: low Non-critical, workarounds exist labels Oct 10, 2024
@mschipperheyn
Copy link
Collaborator Author

This should also be combined with an optimizer for customFields entity relations. If you are just querying for the entity.id and no other field, the automatic entity resulution should not query for the relation and just return the { id }.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4: low Non-critical, workarounds exist type: feature ✨
Projects
Status: 📅 Planned
Development

No branches or pull requests

1 participant