We'd like to have a consistent and safe way for study designers (almost always the implementers, so people with the DEVELOPER role) to delete and remove things as they set up a study. Often out deletes actually remove things from the database, and so those calls are only accessible to administrators for test clean-up.
...
- If item is already logically deleted, throw 404throw an EntityNotFoundException
- If item is not marked deleted, mark it as deleted
...
- If item is not in database, return 404throw an EntityNotFoundException
Physically deleting an entity that's marked as deleted should work, rather than returning a 404. Updating a logically deleted entity to undelete it should work. Updating a logically deleted entity, when you're not also undeleting it, should return 404. In other cases, we continue to return 404 when updating or deleting something that doesn't exist in the database.
...