FYI, most of the time enterprise clients are paying for a feature to be added to open source Apostrophe, for the benefit of everyone. It is a model that works well for everyone because typically they don’t want to “own” or have sole responsibility for a CMS (not even as the sole customer), but have the resources to make that solution better for themselves and others.
So, to answer your question: thanks for looking into making this contribution! Here are the challenges.
For docs (the apos.docs.db
mongodb collection), it’s easy. If it has the trash
property, you remove it from mongodb. The end.
For attachments, i.e. your uploads, it is a little trickier. These are in the apos.attachments.db
collection. If they have the trash
flag, you want to remove that item from the collection, but only after using uploadfs to remove it from storage. Note that rm
-ing it from public/uploads/attachments
will not cut it, you need to use the uploadfs APIs properly and remove all cropped and scaled versions as well. There is some code for this in the apostrophe-multisite module, which does something similar when copying a site.