Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api-headless-cms): add crud operation to restore entry from trash bin #4064

Merged
merged 22 commits into from
Apr 12, 2024

Conversation

leopuleo
Copy link
Contributor

@leopuleo leopuleo commented Mar 28, 2024

Changes

With this PR, developers can restore an entry previously moved to the trash bin.

When an entry has been restored, we add the following fields:

  • deleted: changed from true to false (boolean)
  • restoredOn: the datetime when the entry has been restored (string)
  • restoredBy: the user that restored the entry (identity object)

Similar types have been added for the revisionRestoredOn and revisionRestoredBy fields.

Folder verification while restoring an entry

In the restoration process, we verify if the folder referenced by the folderId inside wby_location still exists. If not, we relocate the entry to the ROOT_FOLDER.

This aspect of the business logic is handled by subscribing to restoreEntry event topics and managed in a separate package called api-headless-cms-aco.

Related PR

webiny/webiny-upgrades#29

How Has This Been Tested?

Manually + Jest

@leopuleo leopuleo added this to the 5.40.0 milestone Mar 28, 2024
@leopuleo leopuleo self-assigned this Mar 28, 2024
Copy link
Member

@adrians5j adrians5j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments, mostly just nit picking. :)

scripts/listPackagesWithTests.js Show resolved Hide resolved
packages/api-headless-cms/src/types/types.ts Outdated Show resolved Hide resolved
packages/api-headless-cms/src/types/types.ts Outdated Show resolved Hide resolved
[PROJECT_PACKAGE_FEATURE_NAME.APW]: {
enabled: false
},
[PROJECT_PACKAGE_FEATURE_NAME.AUDIT_LOGS]: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just add RECORD_LOCKING here too?
https://github.com/webiny/webiny-js/pull/4073/files#diff-28a27b0014482b8d1670cb2977ad2020082b4c703210cfce6bcd27c6adcd3635R35-R37

This was merged into next like yday, so it's new. But note that only after merging next you should be able to add it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be there already; I merged next into this branch...can you have a look to see if everything is ok?

Copy link
Member

@adrians5j adrians5j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor things.

@leopuleo leopuleo merged commit 705277f into next Apr 12, 2024
87 checks passed
@leopuleo leopuleo deleted the leo/feat/hcms-restore-item branch June 5, 2024 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants