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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悰 Bug Report: Wrong request body on create update and delete m2m nested entity #2628
Comments
After the discussion it was decided that the behavior is correct. Resource in header that used for permissions should stay a parent entity, action is supposed to be 'update' for 'connect', 'disconnect' and 'update' methods. Names of methods were adjusted accordingly to expected behavior. |
@EugeneTseitlin @mshidlov @yuval-hazaz something doesn't make sense. |
This is not true. These properties only accept an ID so it will not |
@yuval-hazaz |
what is your claim? what do you expect? |
why do we need 3 different endpoints that do: set, connect, disconnect, and one endpoint that do set+connect+disconnect (the one in the screenshot) |
what is your claim? what do you expect? |
that those 3 endpoints, mentioned on the issue would actually also create, update and delete and not just set connect and disconnect or - remove them |
Got it, thanks! The endpoint /api/order/{id}/product endpoint exists since day 1 - so :
|
What happened?
The data-service-generation package generates the wrong endpoints for m2m nested relation (for example Order and Product).
This bug includes few things that we need to discuss on:
createProduct
, while the action in the UseRole isupdate'
UPDATE /api/:id/product`This happen also for
updateProduct
anddeleteProduct
on the order.controller.base.tsWhat you expected to happen
It doesn't make sense that the request param and the request body are the same entity, the request body should be a dto to create a product on an order / connect an existing product to an order
After we decided on how to implement this (create/connect), according to our decision we would have to change the action and the resource on the UseRoles decorator.
How to reproduce
generate a sample app with amplication and make order and product to be m2m relation
Amplication version
0.12.4
Environment
node v16.3.0
npm 7.15.1
macOS
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered: