Coalesce icon indicating copy to clipboard operation
Coalesce copied to clipboard

Support soft deletes

Open GrantErickson opened this issue 7 years ago • 3 comments

Soft deletes are commonplace in many data scenarios. This can be done with Coalesce, but the build in functionality for deletes does an actual delete. It would be nice to be able to mark a class as using soft deletes which might expose functionality for this automatically. This could either replace the existing delete functionality or replace it and add a permanent delete as well.

GrantErickson avatar Jun 19 '17 16:06 GrantErickson

Doable now through custom behaviors: http://coalesce.readthedocs.io/en/latest/pages/modeling/model-components/behaviors/

ascott18 avatar Jan 08 '18 22:01 ascott18

Reopening now as it would be real cool to have this as a more built in feature.

Idea:

  • [Delete] attribute has a new property that can be set to the name of field on the entity. This field is the entity's soft delete flag (can be a boolean, or any nullable like a DateTimeOffset?).
  • A filter is applied against this field automatically
    • Is this done client-side, or server side?
    • What about security - do we role-restrict who can see soft-deleted items?
    • Is this filter only applied to /list, or is it also applied to /get?
    • Is this a new API parameter, or an existing one (filter.propName=)?

ascott18 avatar Dec 13 '22 00:12 ascott18

Spitballing more ideas

  • new attribute: [SoftDelete]
    • Property - name of prop that is the soft delete flag
    • PermissionLevel, Roles - control who can directly read soft-deleted items (default to open - no more restricted than read permissions)
  • API parameter is a new parameter
    • /list, /count endpoint defaults to non-deleted items only if no filter specified
    • /get endpoint defaults to ????? (TODO) - should it allow all items by default so that pulling up a "details" page of an old item automatically works (assuming that viewing soft delete items isn't restricted for the user).
  • Special UI features in admin table:
    • Filter dropdown for soft delete state (Non-deleted, deleted, all)

ascott18 avatar Aug 26 '24 21:08 ascott18