It's not possible to create a new commodityTypes

Description

When I tried to create a new commodityTypes, I got 404 not found. I tested that via Postman. I tried to use PUT /api/commodityTypes and PUT /api/CommodityTypes endpoints, but without any luck. The first option was found in controller, the second one on swagger.

{ "timestamp": "2017-02-21T12:24:27.923+0000", "status": 404, "error": "Not Found", "message": "No message available", "path": "/api/CommodityTypes" }

Example json:

{ "productCode": "C1", "name": "ibuprofen", "description": "test", "packSize": 11, "packRoundingThreshold": "1", "roundToZero": true }

Acceptance criteria:

  • creating the commodityTypes should be possible

  • raml is updated

  • the Body field to the api/commodityTypes endpoint is added on swagger

  • right: ORDERABLES_MANAGE should be required

Environment

None

QAlity Plus - Test Management

Checklists

Activity

Show:
Paulina Borowa
March 8, 2017 at 11:50 AM

I was able to create a new commodityType and I got status 200 OK

Brandon Bowersox-Johnson
March 1, 2017 at 1:49 AM
(edited)

CORRECTION: We can just leave this ticket as it is in TODO status, and it can contain the remaining part of the problem that will be fixed in a future release. Thanks for investigating. Since this ticket is not in the sprint and not marked fixVersion=3.0, it is okay. Yes, please open a new issue for the remaining problem (we can fix it in our next release). Please add a link to this issue and details and examples of the server error.

Jakub Kondrat
February 28, 2017 at 4:24 PM

I noticed that changing one line in RAML fixes this issue, the endpoint is now accessible and it's possible to create new commodityTypes: https://github.com/OpenLMIS/openlmis-referencedata/commit/cc4e298b5b5fd2890b7e6512bb532c3e7c323d61
However it seems that updating existing ones from demo data results in Internal server error, so this will probably have to be fixed in future releases:

{ "timestamp": "2017-02-28T16:17:55.286+0000", "status": 500, "error": "Internal Server Error", "exception": "org.springframework.dao.DataIntegrityViolationException", "message": "A different object with the same identifier value was already associated with the session : [org.openlmis.referencedata.domain.CommodityType#2400e410-b8dd-4954-b1c0-80d8a8e785fc]; nested exception is javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [org.openlmis.referencedata.domain.CommodityType#2400e410-b8dd-4954-b1c0-80d8a8e785fc]", "path": "/api/commodityTypes" }
Done
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Story Points

Original estimate

Time tracking

1d 4h 30m logged

Components

Sprint

None

Fix versions

Priority

Time Assistant

Created February 21, 2017 at 12:49 PM
Updated March 14, 2017 at 2:38 PM
Resolved March 8, 2017 at 11:50 AM