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: add history versions endpoint #19386

Merged
merged 7 commits into from Feb 2, 2024
Merged

Conversation

remidej
Copy link
Contributor

@remidej remidej commented Jan 31, 2024

What does it do?

Adds a route that lists the available history versions for a given set of query params.

Things that don't work yet:

  • field-level permissions are ignored for now
  • pagination: we just return a 10-item page for now
  • I can't open entries with i18n enabled in the admin, so I wasn't able to test the locale matching. I suspect it may be an issue with my document middleware, as I'm using an API not meant to be used directly, so I'm waiting to implement the solution from feat: overload document service middlewares #19377 before digging more into it.

Why is it needed?

To list history versions in the frontend.

How to test it?

  • Create history versions by creating and updating content a bunch of times
  • Make an API request to /content-manager/history-versions
  • If you don't authenticate it as an admin user via the JWT, you should get an error
  • If you don't give it both contentType and documentId params, you should get an error
  • If you don't have permissions to view the contentType you passed it, you should get an error
  • Otherwise you should see an array of relevant history versions in the data key, and a meta object with pagination
  • The createdBy author should be populated and sanitized (no password hash)

@remidej remidej self-assigned this Jan 31, 2024
@remidej remidej added source: core:content-manager Source is core/content-manager package pr: feature This PR adds a new feature labels Jan 31, 2024
@remidej remidej marked this pull request as ready for review January 31, 2024 09:25
@remidej remidej requested a review from Feranchz January 31, 2024 16:21
Copy link
Contributor

@markkaylor markkaylor left a comment

Choose a reason for hiding this comment

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

  • If you don't authenticate it as an admin user via the JWT, you should get an error: ✅
  • If you don't give it both contentType and documentId params, you should get an error: ✅
  • If you don't have permissions to view the contentType you passed it, you should get an error ✅
  • Otherwise you should see an array of relevant history versions in the data key, and a meta object with pagination ✅
  • The createdBy author should be populated and sanitized (no password hash) ✅

@remidej remidej merged commit 878a93d into v5/history Feb 2, 2024
37 of 76 checks passed
@remidej remidej deleted the history/list-versions branch February 2, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: feature This PR adds a new feature source: core:content-manager Source is core/content-manager package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants