Coalesce
Coalesce copied to clipboard
Support soft deletes
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.
Doable now through custom behaviors: http://coalesce.readthedocs.io/en/latest/pages/modeling/model-components/behaviors/
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 aDateTimeOffset?
). - 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=)?
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)