-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MODORDER-1087]-Delete received pieces in bulk #952
base: master
Are you sure you want to change the base?
Conversation
@@ -79,4 +85,26 @@ protected Future<Void> updatePoLine(PieceDeletionHolder holder, RequestContext r | |||
: pieceDeleteFlowPoLineService.updatePoLine(holder, requestContext); | |||
} | |||
|
|||
public Future<List<Void>> batchDeletePiece (PieceCollection entity, RequestContext requestContext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is some formatting issue, also we need to accept list of ids to delete instead of full PieceCollection object
public Future<List<Void>> batchDeletePiece (PieceCollection entity, RequestContext requestContext) { | |
public Future<List<Void>> batchDeletePieces(List<String> pieceIds, RequestContext requestContext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example how you can define the an endpoint:
DELETE /<endpoint_name>>
Content-Type: application/json
{
"ids": [1, 2, 3]
}
@@ -79,4 +85,26 @@ protected Future<Void> updatePoLine(PieceDeletionHolder holder, RequestContext r | |||
: pieceDeleteFlowPoLineService.updatePoLine(holder, requestContext); | |||
} | |||
|
|||
public Future<List<Void>> batchDeletePiece (PieceCollection entity, RequestContext requestContext) { | |||
List <String> ids = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should keep an existing logic that Delete by Id endpoint uses with many existing checks.
In the simplest way you can invoke this method in cycle:
Future deletePiece(String pieceId, boolean deleteHolding, RequestContext requestContext)
It is not optimezed solution of course, but can be as starting point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, thank you for pointing it out, will do! :)
entity.getPieces().stream().forEach(v -> ids.add(v.getId())); | ||
List<Future<PieceDeletionHolder>> deletionHolders = ids.stream() | ||
.map(pieceId -> { | ||
PieceDeletionHolder holder = new PieceDeletionHolder().withDeleteHolding(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could not hardcode deleteHolding to true, it should be fetched from request param as doing in Delete By Id endpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for pointing it out, I will correct.
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
}).when(basePieceFlowHolderBuilder).updateHolderWithTitleInformation(PieceDeletionHolderCapture.capture(), eq(requestContext)); | ||
|
||
final ArgumentCaptor<PieceDeletionHolder> pieceDeletionHolderCapture = ArgumentCaptor.forClass(PieceDeletionHolder.class); | ||
doReturn(succeededFuture(null)).when(pieceDeleteFlowPoLineService).updatePoLine(pieceDeletionHolderCapture.capture(), eq(requestContext)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also separate declaration doReturn and action and verification part to be easy to read
|
||
|
||
// Mock response setup for deletion | ||
//MockServer.addMockEntry(PIECES_STORAGE, JsonObject.mapFrom(jsonObject).encode()); // Simplified mock data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also remove commentds, if it is not helpful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for pointing it out ! will do
} | ||
responses: | ||
204: | ||
description: "Pieces records successfully deleted" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Piece records
or Pieces
more correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also refactor Sentences in other places to be gramatically correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you, sure will.
Description
Purpose: Libraries that use the Receiving app for receipt of print serials may wish to delete pieces that precede a specific date. Currently, FOLIO supports the deletion of pieces, but one at a time. When a library wishes to purge receiving records for multiple years on an ongoing workflow, the ability to delete pieces in bulk will streamline this workflow.
Weeding old journal issues; receiving records no longer necessary since items have been withdrawn
User story statement(s):
As a serials librarian,
I want to delete multiple pieces at one time
so that the continuous addition of pieces does not eventually impact performance of the Receiving app.
Scenarios:
Bulk edit received/expected pieces:
Given user has received multiple piece records for a given receiving title
When expanding received/expected pieces accordion
Then user has option in action menu for Bulk edit
Select one or more pieces:
Given user clicks Bulk edit
When toggles appear in table
Then user can select one or more pieces
Edit pieces:
Given user has selected one or more pieces
When user clicks edit piece button
Then Bulk edit piece form is displayed
Delete all pieces
Given user clicks edit piece button
When Bulk edit piece form is displayed
Then "Delete all" button is active
Delete all pieces confirmation
Given user is viewing Bulk edit piece form
When user clicks "Delete all"
Then confirmation modal is shown
Message: "This will permanently remove all the pieces you have selected. Any related items with a status of "On order" will also be deleted. Would you like to proceed?
AND user can confirm or cancel
Library enhancement suggested by Lafayette College (May 2022 adopter)
Environment
None