loopback-next icon indicating copy to clipboard operation
loopback-next copied to clipboard

[Relation] Supports HasOne relation

Open dhmlau opened this issue 8 years ago • 3 comments

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 hasOne decorator
    • [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

dhmlau avatar Jun 12 '18 19:06 dhmlau

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:

  1. @elv1s, what is the timeline you're thinking in terms of having hasOne support?
  2. @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 hasOne in? EDIT: I realized that we've estimated this task already. Given what we know now (esp when implementing BelongsTo, are we still good with this estimate?

dhmlau avatar Oct 01 '18 20:10 dhmlau

We are developing a POC with LB3 right now. If we move to LB4 we would need hasOne relationships early 2019.

elv1s avatar Oct 03 '18 18:10 elv1s

Closing as done.

b-admike avatar Dec 19 '18 18:12 b-admike