Bug 22206

Summary: Add routes to enable suspension or resumption of holds
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: new feature    
Priority: P5 - low CC: david, josef.moravec, kyle, lari.taskula, lucas, martin.renvoize, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
URL: https://wiki.koha-community.org/wiki/Holds_suspension_endpoint_RFC
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This new feature adds a REST API that allows suspending a hold and resuming a suspended hold.
Version(s) released in:
Circulation function:
Bug Depends on: 19816, 20006, 21478, 22132    
Bug Blocks: 24813, 28377    
Attachments: Bug 22206: OpenAPI spec
Bug 22206: Unit tests
Bug 22206: Add routes to suspend/resume holds
Bug 22206: OpenAPI spec
Bug 22206: Unit tests
Bug 22206: Add routes to suspend/resume holds
Bug 22206: OpenAPI spec
Bug 22206: Unit tests
Bug 22206: Add routes to suspend/resume holds
Bug 22206: (QA follow-up) Fix tests for hold suspension api
Bug 22206: (follow-up) Voted RFC changes
Bug 22206: OpenAPI spec
Bug 22206: Unit tests
Bug 22206: Add routes to suspend/resume holds
Bug 22206: (QA follow-up) Fix tests for hold suspension api
Bug 22206: (follow-up) Voted RFC changes

Description Tomás Cohen Arazi (tcohen) 2019-01-24 19:18:58 UTC

    
Comment 1 Tomás Cohen Arazi (tcohen) 2019-01-28 10:44:23 UTC
Created attachment 84473 [details] [review]
Bug 22206: OpenAPI spec
Comment 2 Tomás Cohen Arazi (tcohen) 2019-01-28 10:44:28 UTC
Created attachment 84474 [details] [review]
Bug 22206: Unit tests
Comment 3 Tomás Cohen Arazi (tcohen) 2019-01-28 10:44:32 UTC
Created attachment 84475 [details] [review]
Bug 22206: Add routes to suspend/resume holds

This patch introduces:

- POST   /holds/{hold_id}/suspension { "expiration_date": "2019-01-30" }
- DELETE /holds/{hold_id}/suspension

to suspend a hold or resume a suspended hold, respectively.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
- Sign off :-D
Comment 4 Martin Renvoize (ashimema) 2019-02-13 11:05:11 UTC
Created attachment 85056 [details] [review]
Bug 22206: OpenAPI spec

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize (ashimema) 2019-02-13 11:05:14 UTC
Created attachment 85057 [details] [review]
Bug 22206: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize (ashimema) 2019-02-13 11:05:17 UTC
Created attachment 85058 [details] [review]
Bug 22206: Add routes to suspend/resume holds

This patch introduces:

- POST   /holds/{hold_id}/suspension { "expiration_date": "2019-01-30" }
- DELETE /holds/{hold_id}/suspension

to suspend a hold or resume a suspended hold, respectively.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize (ashimema) 2019-02-13 11:06:07 UTC
Seems solid work to me.. tested and working, signing off.
Comment 8 Josef Moravec 2019-02-21 17:15:21 UTC
Created attachment 85468 [details] [review]
Bug 22206: OpenAPI spec

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Josef Moravec 2019-02-21 17:15:54 UTC
Created attachment 85469 [details] [review]
Bug 22206: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Josef Moravec 2019-02-21 17:15:59 UTC
Created attachment 85470 [details] [review]
Bug 22206: Add routes to suspend/resume holds

This patch introduces:

- POST   /holds/{hold_id}/suspension { "expiration_date": "2019-01-30" }
- DELETE /holds/{hold_id}/suspension

to suspend a hold or resume a suspended hold, respectively.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Josef Moravec 2019-02-21 17:16:04 UTC
Created attachment 85471 [details] [review]
Bug 22206: (QA follow-up) Fix tests for hold suspension api

Test plan:

prove t/db_dependent/api/v1/holds.t
Comment 12 Josef Moravec 2019-02-21 17:23:30 UTC
Looks good, I think it is ready, but we should wait for voting on development meeting. So setting BLOCKED (was Passed QA)
Comment 13 Tomás Cohen Arazi (tcohen) 2019-02-28 13:02:17 UTC
Created attachment 85862 [details] [review]
Bug 22206: (follow-up) Voted RFC changes

This patch changes expiration_date for end_date as voted when the RFC
was approved.

It also adds a test for the Location header being added correctly when
suspending a hold (SWAGGER3.4.1)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 14 Josef Moravec 2019-02-28 13:21:33 UTC
Created attachment 85864 [details] [review]
Bug 22206: OpenAPI spec

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 15 Josef Moravec 2019-02-28 13:21:36 UTC
Created attachment 85865 [details] [review]
Bug 22206: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 16 Josef Moravec 2019-02-28 13:21:41 UTC
Created attachment 85866 [details] [review]
Bug 22206: Add routes to suspend/resume holds

This patch introduces:

- POST   /holds/{hold_id}/suspension { "expiration_date": "2019-01-30" }
- DELETE /holds/{hold_id}/suspension

to suspend a hold or resume a suspended hold, respectively.

To test:
- Apply this patches
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/holds.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 17 Josef Moravec 2019-02-28 13:21:45 UTC
Created attachment 85867 [details] [review]
Bug 22206: (QA follow-up) Fix tests for hold suspension api

Test plan:

prove t/db_dependent/api/v1/holds.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 18 Josef Moravec 2019-02-28 13:21:48 UTC
Created attachment 85868 [details] [review]
Bug 22206: (follow-up) Voted RFC changes

This patch changes expiration_date for end_date as voted when the RFC
was approved.

It also adds a test for the Location header being added correctly when
suspending a hold (SWAGGER3.4.1)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 19 Josef Moravec 2019-02-28 13:22:44 UTC
More testing is always fine, and I even forget to add my sign-off line last time, fixed now ;) 

Thanks for quick follow-up Tomas
Comment 20 Nick Clemens (kidclamp) 2019-03-15 19:59:42 UTC
Awesome work all!

Pushed to master for 19.05
Comment 21 Martin Renvoize (ashimema) 2019-03-19 10:55:11 UTC
As per my policy of backporting new API routes, Pushed to 18.11.x for 18.11.04
Comment 22 Lucas Gass (lukeg) 2019-03-26 23:37:51 UTC
not backporting to 18.05.x
Comment 23 Josef Moravec 2019-04-01 12:50:17 UTC
*** Bug 19072 has been marked as a duplicate of this bug. ***