We need to discuss about few endpoints that we need to use to edit Categories, Subcategories, Items. Since this is a basic requirement that we need in Academix Admin Dashboard we need to update current endpoints.
We need to be able to change the category when editing the subcategories
Apart from the above I have the following suggestions.
Create put requests for the Categories, Subcategories and the Items.
The post request of items has a query parameter to add subcategories. Move them to the body.
The post request of the subcategory contains the category Id as a path param. Currently it’s /academix/subcategories/{categoryId} the url pattern should be changed. Or better to have the category object in the body.
GET Subcategory payload should contain the category of that subcategory.
GET Item payload should contains the subcategories of that item.
On the “Add an item” view, the subcategory chooser should display the category of each subcategory.
1 : is already completed
2 ,3: Remove the query params and make requests accept data in the body
4,5,6 : Remove the data that needs to be returned from @JsonIgnoreProperties annotation in respective classes
On top of these changes, you will have to change sub-category and item PUT requests to make it possible to update their parents. For this, in the child classes, you will need to change the child-parent relationships to Cascade = Merge
If you face any issues regarding these changes please ping me
Actually we don’t need it. But it will be there with the default behavior. We need to add a projection to remove them.
One thing we can do is removing irrelevant details from the items (not single item) payload.