-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
RelationsModel relations (has many, etc.)Model relations (has many, etc.)RepositoryIssues related to @loopback/repository packageIssues related to @loopback/repository packagefeaturestale
Description
The PoC implementation of belongsTo relation in #1618 proposed to modify the way how keyTo metadata of hasMany relation is inferred. Instead of creating keyTo from the source model name (Customer -> customerId), we can look for @belongsTo decorator to find the property used as the foreign key.
This issue has two goals:
- Discuss whether it's a good idea to infer
keyTofrombelongsTometadata. Such change would require thathasManycomes always withbelongsTo, while at the moment it's possible to usehasManywith no matchingbelongsTo. - Implement the necessary changes. Either drop the current algorithm building
keyTofrom source model name, or use it as a fallback if nobelongsTowas found.
Important: making belongsTo required for all hasMany relations is a breaking change.
Acceptance criteria
TBD
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
RelationsModel relations (has many, etc.)Model relations (has many, etc.)RepositoryIssues related to @loopback/repository packageIssues related to @loopback/repository packagefeaturestale