gavinvaske / the_recipe_book

0 stars 0 forks source link

Deletion of a `Material` Object Causes Inventory Management Issues #111

Open gavinvaske opened 2 years ago

gavinvaske commented 2 years ago

The Problem

If one or more purchase orders have been created which use material A.

Then a user can track the amount of material on those purchase orders via the /material-inventory page.

However, if an admin deletes material A, then the /material-inventory page will not list any information from the purchase orders which were created with that material.

Requirements to Close this Issue

To close this issue, investigate what the desired solution to this issue is and document that investigation as comments on this issue.

Then implement the required solution and then you may close this issue.

gavinvaske commented 2 years ago

Idea 1:

When a user attempts to delete a material, before allowing this deletion to occur, check to make sure that the material is not connected to any tickets, and if it is, block the deletion and display a helpful error message saying: "must remove material from all existing tickets before it can be deleted"

Idea 2:

When a user attempts to delete a material, check if that material is attached to any existing TIckets and if so, then perform a "soft delete" on that material.

"soft deleted" materials will not be displayed on the Material page, and will thus appear deleted.

"soft deleted" materials will be marked as such via a new database attribute.