-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
hasMany relation CRUD methods #1376
Comments
cc @b-admike @bajtos based on our discussion in PR #1403, I would suggest we implement So I am going to add
And we can discuss the other 3 batch operations
I temporarily add them in my PR, if we decide to drop them, I will delete them. |
Close as #1403 has merged. |
I picked up introducing I picked up the task thinking that |
I think the scope of DP3 is limited to methods that are reasonably easy to implement. If
Why do you need to access the target model constructor? Anyhow, inside I was reading through the discussion in #1403 and could not find why When you say |
We need access to the target model constructor to determine the id property of the model (for I think replace was left out precisely because of the fact that we have no way to get the id key from the model with the way That being said, I did it find it odd that we need to implement |
@shimks @bajtos Sorry for late reply, I see all your confusions here, let me elaborate it. First, please note the only replace method we have in the legacy juggler bridge file is Then let's discuss the implementation limit/blocker for each signature: customer.orders.replaceAllNOT POSSIBLE. Obviously, customer.orders.replaceById(idValue, obj)We could do it...but I agree with @bajtos 's concern:
And I would rather hold on having a customer.orders.replaceWithNewData({idProp: idValue, prop1: 'newVal1', prop2: ''newVal2})This is the one that requires access to the target model's id property name in the relation repository. We need to know which property in the new data is id, then call So my opinion is
|
Description / Steps to reproduce / Feature proposal
Follow up to #1372. Create the rest of the allowed CRUD methods on the target repository for a hasMany relation between two models to make sure the full set of allowed methods is exposed.
Acceptance Criteria:
Implement the following public CRUD methods APIs for
hasMany
relations:update
delete
save
createAll
deleteAll
updateAll
Use https://github.com/strongloop/loopback-next/blob/8acb28ca32433e6047d162d2e26097b7cefb6f51/packages/repository/src/repositories/relation.repository.ts, and the implemented
find
andcreate
methods from #1342 once it lands for inspiration.See Reporting Issues for more tips on writing good issues
The text was updated successfully, but these errors were encountered: