]> git.koha-community.org Git - koha.git/commit
Bug 14697: (follow-up) Rely on the UNIQUE constraint and return 409 for issue_id
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 28 Oct 2019 19:18:52 +0000 (16:18 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 31 Oct 2019 12:04:55 +0000 (12:04 +0000)
commit40e841da984f0aeb13a4632ce83a638cee47a434
tree660dfd2251119c09ccd157978ac6aa178238a862
parenta670f9068d982d3f905967255006faf871cdaf4f
Bug 14697: (follow-up) Rely on the UNIQUE constraint and return 409 for issue_id

This patch avoids querying the DB for an already existing
Koha::Checkouts::ReturnClaim with the same issue_id, now that there's a
UNIQUE constraint on it.

Also, 409 should be returned instead. Tests added for this changes.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/return_claims.t
=> SUCCESS: tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/V1/ReturnClaims.pm
api/v1/swagger/paths/return_claims.json
t/db_dependent/api/v1/return_claims.t