Open-source serverless enterprise CMS. Includes a headless CMS, page builder, form builder, and file manager. Easy to customize and expand. Deploys to AWS.
With this PR, we handle the deletion of HCMS entries found in the trash bin that were moved there before a specific date.
This is the overall process description:
Every day at 3:00 am UTC, an EventBridge event triggers our main api-graphql lambda.
a new hcmsEntriesEmptyTrashBins background task is triggered for each tenant registered.
hcmsEntriesEmptyTrashBins
The hcmsEntriesEmptyTrashBins task triggers a hcmsEntriesEmptyTrashBinByModel background task for each public model registered.
hcmsEntriesEmptyTrashBinByModel
This background task receives as input:
modelId: the model ID that we want to target
where: the query condition; for this use case, we are passing deletedOn_lt s calculated using the WEBINY_TRASH_BIN_RETENTION_PERIOD_DAYS env variable (default value 90).
The task lists the entries to delete according to the query received and triggers hcmsEntriesDeleteTrashBinEntries tasks.
hcmsEntriesDeleteTrashBinEntries
This background task receives as input:
modelId: the model ID that we want to target
entryIds is the list of entry IDs we want to delete.
Changes
With this PR, we handle the deletion of HCMS entries found in the trash bin that were moved there before a specific date.
This is the overall process description:
hcmsEntriesEmptyTrashBins
background task is triggered for each tenant registered.hcmsEntriesEmptyTrashBins
The
hcmsEntriesEmptyTrashBins
task triggers ahcmsEntriesEmptyTrashBinByModel
background task for each public model registered.hcmsEntriesEmptyTrashBinByModel
This background task receives as input:
modelId
: the model ID that we want to targetwhere
: the query condition; for this use case, we are passingdeletedOn_lt
s calculated using theWEBINY_TRASH_BIN_RETENTION_PERIOD_DAYS
env variable (default value 90).The task lists the entries to delete according to the query received and triggers
hcmsEntriesDeleteTrashBinEntries
tasks.hcmsEntriesDeleteTrashBinEntries
This background task receives as input:
modelId
: the model ID that we want to targetentryIds
is the list of entry IDs we want to delete.Related PR
https://github.com/webiny/webiny-upgrades/pull/29
How Has This Been Tested?
Jest + manually
Documentation
We must document how to set the trash bin retention period using the env variable (
WEBINY_TRASH_BIN_RETENTION_PERIOD_DAYS
).