-
Notifications
You must be signed in to change notification settings - Fork 618
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
Conversation
… leo/feat/hcms-restore-item
# Conflicts: # packages/api-headless-cms/src/types/types.ts
There was a problem hiding this 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. :)
packages/api-headless-cms/src/graphql/schema/resolvers/manage/resolveRestore.ts
Outdated
Show resolved
Hide resolved
[PROJECT_PACKAGE_FEATURE_NAME.APW]: { | ||
enabled: false | ||
}, | ||
[PROJECT_PACKAGE_FEATURE_NAME.AUDIT_LOGS]: { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
packages/api-headless-cms/__tests__/contentAPI/contentEntry.restore.test.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
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 fromtrue
tofalse
(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
andrevisionRestoredBy
fields.Folder verification while restoring an entry
In the restoration process, we verify if the folder referenced by the
folderId
insidewby_location
still exists. If not, we relocate the entry to theROOT_FOLDER
.This aspect of the business logic is handled by subscribing to
restoreEntry
event topics and managed in a separate package calledapi-headless-cms-aco
.Related PR
webiny/webiny-upgrades#29
How Has This Been Tested?
Manually + Jest