How to create a trash for a module

Hi everyone,

I’m trying to keep deleted records stored somewhere so that we can restore them
I know corteza does soft delete, so how can I capture the deleted records on the record-list page and restore them back?

any ideas on how to implement such functionality?

1 Like

@tjerman regarding the discussion at this Delete all records from inside Corteza - #4 by tjerman

I just don’t want to go out of scope, so I asked here
if I did soft delete and the record still exists how to restore them?
can I create a trash can for it?

Corteza does soft delete for most resources, so you can restore them… from the database that is.
We did have a discussion a few weeks back on the fact that we managed to not implement a proper UI support for it but I am not sure when we would get around on doing that (\cc @darh, @mia.arh).

For the time being, if you need a list of deleted modules, add a status field (or similar) that indicates if the record is deleted or not.
You could then, instead of deleting, change that flag; have a button that sets the record as deleted; or have a beforeDelete trigger that does it.

If you’re building your own web applications you can add a temproray support for it on your own until we handle it on our end.
Alternativelly, if you are able, you can open up a PR for it – if you do decide on this one, we would need to align on how it would look/function lke.

1 Like