BI-2476 Create Single and Batch Delete End Points for Germplasm #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Story: BI-2476
This pull request implements a "soft delete" functionality for germplasm data, meaning that instead of permanently deleting germplasm records, they are marked as deleted. This provides a mechanism for data recovery and avoids data loss. A hard delete option is also implemented. The pull request also fixes a typo in the PedigreeEdgeEntity related to connectedNode.
Key Changes:
Germplasm Deletion Endpoint: Adds a new API endpoint to delete germplasm records. The endpoint supports both hard deletes (permanent deletion) and soft deletes.
Soft Delete Implementation: Introduces a softDeleted boolean field to the GermplasmEntity to indicate whether a record has been soft deleted. The entity is also updated with a @where clause so that only non-deleted entities are returned by default.
Database Migration: Adds SQL migration scripts to add the soft_deleted column to the germplasm table.
Repository Updates: The GermplasmRepository is updated with new methods to perform the soft delete.
Controller Updates: The GermplasmApiController is updated to implement batch deletes.
Typo Fix: Corrects a typo in the PedigreeEdgeEntity class, replacing conncetedNode with connectedNode. This change is reflected in the corresponding database migration and JPQL queries.
Component Factory Updates: Updated the GermplasmComponent to use the correct service methods for batch soft and hard deletes.
The following associated entities will cascade delete when a germplasm record is soft- or hard-deleted:
Germplasm Children
Observation Unit Children
Image Children
Variant Children
Variant Set Children
Reference Children
Reference Set Children
Pedigree Node Child
Pedigree Edge Child
Reference Bases Child