DataONEorg / bookkeeper

Bookkeeper keeps track of DataONE product subscriptions and quotas for researchers using the extended services.
Other
1 stars 2 forks source link

UsagesResource.update() error #38

Closed gothub closed 4 years ago

gothub commented 4 years ago

Calling PUT /usages/<id> produces this error:

{"code":417,"message":"Couldn't update the usage: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint \"usages_quotaid_instanceid_idx\"\n  Detail: Key (quotaid, instanceid)=(17, urn:urn:9abc-defj) already exists.

Here is the script making the request:

curl -v -H "Authorization: Bearer ${token}" -X PUT \
     --data @${data} \
     -H "Content-Type: application/json" \
     -H "Accept: application/json"  \
     "http://localhost:8080/bookkeeper/v1/usages/55"

... and the data:

{
   "id":55,
   "object":"usage",
   "quotaId":17,
   "instanceId":"urn:uuid:9abc-defj",
   "quantity":2.0,
   "status":"archived",
   "nodeId":"urn:node:SASAP"
}
gothub commented 4 years ago

Fixed in commit d445d75a81dd9ed628d6d6473bca7653d65c9efb