loopback-next
loopback-next copied to clipboard
[Relation] Supports HasOne relation
Description / Steps to reproduce / Feature proposal
Add support for HasOne relation between two models.
Acceptance Criteria
- [x] Update factory method to handle this relation
- [x] create interface for CRUD methods available for the relation. See this as an example.
- [x] create default class which implements the interface
- [x] Implement the
hasOnedecorator- [x] model decorator: infers the metadata
- [x] create test cases
- [x] update docs
- [x] create a follow up issue to demonstrate using multiple relations in a new/existing example
Cross posting in https://github.com/strongloop/loopback-next/issues/1449#issuecomment-425139538 from @elv1s:
We have a requirement for hasOne in addition to hasMany and belongsTo
Currently hasOne is not part of our Q1 roadmap. So I have 2 questions:
- @elv1s, what is the timeline you're thinking in terms of having
hasOnesupport? - @strongloop/sq-lb-apex @raymondfeng @bajtos, after we have the 2 model relations, do you think it's a relatively small effort for us to get
hasOnein? EDIT: I realized that we've estimated this task already. Given what we know now (esp when implementingBelongsTo, are we still good with this estimate?
We are developing a POC with LB3 right now. If we move to LB4 we would need hasOne relationships early 2019.
Closing as done.