[Bug 42405] New: Add single cover image upload path
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Bug ID: 42405 Summary: Add single cover image upload path Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42643 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42643 [Bug 42643] [OMNIBUS] Assorted performance and stability work -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |dcook@prosentient.com.au, | |martin.renvoize@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |42404 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42404 [Bug 42404] Add a batch cover images upload endpoint -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Comma delimited| |ByWater Solutions list of Sponsors| | Sponsorship status|--- |Sponsored Status|ASSIGNED |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 200147 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200147&action=edit Bug 42405: Add Koha::Biblio->add_cover_image and Koha::Item->add_cover_image This patch adds add_cover_image methods to Koha::Biblio and Koha::Item. Each method takes a GD::Image object, creates the scaled versions via Koha::CoverImage, and stores the result linked to the corresponding biblio or item. A MissingParameter exception is thrown if src_image is not provided. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/cover_images_single.t => SUCCESS: Tests pass! 3. Tests cover: - MissingParameter thrown when src_image is undef (biblio) - MissingParameter thrown when src_image is undef (item) 4. Sign off :-D Sponsored-by: ByWater Solutions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 --- Comment #2 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 200148 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200148&action=edit Bug 42405: Add REST API endpoints for single cover image operations This patch adds three REST API endpoints: POST /api/v1/biblios/{biblio_id}/cover_images POST /api/v1/items/{item_id}/cover_images DELETE /api/v1/cover_images/{image_id} These replace the svc/cover_images CGI script with proper REST endpoints. Upload endpoints accept an image via multipart/form-data and an optional replace query parameter. Test plan: 1. Apply patch 2. Regenerate the API bundle: $ ktd --shell k$ cd /kohadevbox/koha && yarn api:bundle 3. Run: k$ prove t/db_dependent/api/v1/cover_images_single.t => SUCCESS: Tests pass! 4. Tests cover: - Successful biblio image upload (201) - Multiple images without replace - Replace mode deletes existing images - Biblio not found (404) - Successful item image upload (201) - Item not found (404) - Delete image (204) - Delete non-existent image (404) 5. Sign off :-D Sponsored-by: ByWater Solutions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42804 Attachment #200147|0 |1 is obsolete| | Attachment #200148|0 |1 is obsolete| | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42804 [Bug 42804] Replace svc/cover_images and tools/upload-cover-image.pl with REST API -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 --- Comment #3 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 200153 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200153&action=edit Bug 42405: Add Koha::Biblio->add_cover_image and Koha::Item->add_cover_image This patch adds add_cover_image methods to Koha::Biblio and Koha::Item. Each method takes a GD::Image object, creates the scaled versions via Koha::CoverImage, and stores the result linked to the corresponding biblio or item. A MissingParameter exception is thrown if src_image is not provided. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/cover_images_single.t => SUCCESS: Tests pass! 3. Tests cover: - MissingParameter thrown when src_image is undef (biblio) - MissingParameter thrown when src_image is undef (item) 4. Sign off :-D Sponsored-by: ByWater Solutions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 --- Comment #4 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 200154 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200154&action=edit Bug 42405: Add REST API endpoints for single cover image operations This patch adds three REST API endpoints: POST /api/v1/biblios/{biblio_id}/cover_images POST /api/v1/items/{item_id}/cover_images DELETE /api/v1/cover_images/{image_id} These replace the svc/cover_images CGI script with proper REST endpoints. Upload endpoints accept an image via multipart/form-data and an optional replace query parameter. Test plan: 1. Apply patch 2. Regenerate the API bundle: $ ktd --shell k$ cd /kohadevbox/koha && yarn api:bundle 3. Run: k$ prove t/db_dependent/api/v1/cover_images_single.t => SUCCESS: Tests pass! 4. Tests cover: - Successful biblio image upload (201) - Multiple images without replace - Replace mode deletes existing images - Biblio not found (404) - Successful item image upload (201) - Item not found (404) - Delete image (204) - Delete non-existent image (404) 5. Sign off :-D Sponsored-by: ByWater Solutions -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|42643 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42643 [Bug 42643] [OMNIBUS] Assorted performance and stability work -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@openfifth.c |y.org |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #200153|0 |1 is obsolete| | Attachment #200154|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 201135 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201135&action=edit Bug 42405: Add Koha::Biblio->add_cover_image and Koha::Item->add_cover_image This patch adds add_cover_image methods to Koha::Biblio and Koha::Item. Each method takes a GD::Image object, creates the scaled versions via Koha::CoverImage, and stores the result linked to the corresponding biblio or item. A MissingParameter exception is thrown if src_image is not provided. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/cover_images_single.t => SUCCESS: Tests pass! 3. Tests cover: - MissingParameter thrown when src_image is undef (biblio) - MissingParameter thrown when src_image is undef (item) 4. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 --- Comment #6 from David Nind <david@davidnind.com> --- Created attachment 201136 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201136&action=edit Bug 42405: Add REST API endpoints for single cover image operations This patch adds three REST API endpoints: POST /api/v1/biblios/{biblio_id}/cover_images POST /api/v1/items/{item_id}/cover_images DELETE /api/v1/cover_images/{image_id} These replace the svc/cover_images CGI script with proper REST endpoints. Upload endpoints accept an image via multipart/form-data and an optional replace query parameter. Test plan: 1. Apply patch 2. Regenerate the API bundle: $ ktd --shell k$ cd /kohadevbox/koha && yarn api:bundle 3. Run: k$ prove t/db_dependent/api/v1/cover_images_single.t => SUCCESS: Tests pass! 4. Tests cover: - Successful biblio image upload (201) - Multiple images without replace - Replace mode deletes existing images - Biblio not found (404) - Successful item image upload (201) - Item not found (404) - Delete image (204) - Delete non-existent image (404) 5. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #7 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. I did not manually test uploading cover images, I just ran the tests. 2. The qa script complains about tidyness: ... [FAIL] Koha/REST/V1/CoverImages.pm FAIL tidiness File is not tidy, please run `perl misc/devel/tidy.pl Koha/REST/V1/CoverImages.pm` ... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #201135|0 |1 is obsolete| | Attachment #201136|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 --- Comment #8 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 201317 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201317&action=edit Bug 42405: Add Koha::Biblio->add_cover_image and Koha::Item->add_cover_image This patch adds add_cover_image methods to Koha::Biblio and Koha::Item. Each method takes a GD::Image object, creates the scaled versions via Koha::CoverImage, and stores the result linked to the corresponding biblio or item. A MissingParameter exception is thrown if gd_image is not provided. A WrongParameter exception is thrown if gd_image is not a GD::Image. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblio.t t/db_dependent/Koha/Item.t => SUCCESS: Tests pass! 3. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 --- Comment #9 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 201318 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201318&action=edit Bug 42405: Add REST API endpoints for single cover image operations This patch adds three REST API endpoints: POST /api/v1/biblios/{biblio_id}/cover_images POST /api/v1/items/{item_id}/cover_images DELETE /api/v1/cover_images/{image_id} These replace the svc/cover_images CGI script with proper REST endpoints. Upload endpoints accept an image via multipart/form-data and an optional replace query parameter. Test plan: 1. Apply patch 2. Regenerate the API bundle: $ ktd --shell k$ cd /kohadevbox/koha && yarn api:bundle 3. Run: k$ prove t/db_dependent/api/v1/cover_images_single.t => SUCCESS: Tests pass! 4. Tests cover: - Successful biblio image upload (201) - Multiple images without replace - Replace mode deletes existing images - Biblio not found (404) - Successful item image upload (201) - Item not found (404) - Delete image (204) - Delete non-existent image (404) 5. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 --- Comment #10 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- (In reply to David Nind from comment #7)
Testing notes (using KTD): 1. I did not manually test uploading cover images, I just ran the tests. 2. The qa script complains about tidyness: ... [FAIL] Koha/REST/V1/CoverImages.pm FAIL tidiness File is not tidy, please run `perl misc/devel/tidy.pl Koha/REST/V1/CoverImages.pm` ...
Please retest! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 --- Comment #11 from David Nind <david@davidnind.com> --- (In reply to Tomás Cohen Arazi (tcohen) from comment #10)
(In reply to David Nind from comment #7)
Testing notes (using KTD): 1. I did not manually test uploading cover images, I just ran the tests. 2. The qa script complains about tidyness: ... [FAIL] Koha/REST/V1/CoverImages.pm FAIL tidiness File is not tidy, please run `perl misc/devel/tidy.pl Koha/REST/V1/CoverImages.pm` ...
Please retest!
The qa script is happy now 8-) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42405 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43016 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43016 [Bug 43016] [OMNIBUS] Server resource protection -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org