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

chore(content-releases): releases migration to v5 #20259

Open
wants to merge 31 commits into
base: v5/main
Choose a base branch
from

Conversation

Feranchz
Copy link
Contributor

@Feranchz Feranchz commented May 3, 2024

What does it do?

Migrates and apply new changes on the Content Releases plugin for v5.

Work to do

  • Fix test cases
  • Validate releases with entries with multiple relations and if validation is still working
  • Validate db lifecycles and how affected are releases (entry is deleted, discarded, etc)

* chore: migrate bulkDelete to v5

* chore: change findLocales type to accept strings array

* fix: docs prettier styles

* chore: remove console.log
@Feranchz Feranchz added pr: chore This PR contains chore tasks (cleanups, configs, tooling...) source: core:content-releases labels May 3, 2024
@Feranchz Feranchz self-assigned this May 3, 2024

This comment was marked as spam.

Copy link

vercel bot commented May 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
contributor-docs ❌ Failed (Inspect) May 29, 2024 2:42pm

Comment on lines +66 to +92
const relatedReleases = await releaseService.findMany({
where: {
releasedAt: null,
releasedAt: {
$null: true,
},
actions: {
target_type: contentTypeUid,
target_id: entryId,
},
},
});

const releases = await releaseService.findMany({
where: {
$or: [
{
id: {
$notIn: relatedReleases.map((release: any) => release.id),
},
},
{
actions: null,
},
],
releasedAt: {
$null: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe these queries could be inside the service itself.

releases.findEntryReleases({id, populate...})
releases.findNotInEntryReleases({id, ...))

You could also reduce logic here if you do something like:
releases.findDocumentReleases({documentId, locale, populate...})
releases.findNotInDocumentReleases({documentId, locale, ...))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not 100% sure about this but we can discuss it when you're back

It's true that we reduce the controller complexity but we increase the service complexity and we need to maintain and look up for breaking changes in the service but not in the controller. What I mean is: Users can use the releases service in plugins or other places so in my opinion service's API should be as simple as possible and all these functions are just different way of using the findMany that already exists in the service

@Marc-Roig
Copy link
Contributor

Don't know if it's something already fixed in the v5 branch , but it's a bit difficult for me to test strapi using multiple users atm. It's not possible for me to refresh the page when I have two tabs (one in incognito) with two different users.

* feat: releases settings

* feat: test nulling default timezone

* chore: refactor tests

* fix: remove async from describe

* chore: OneOf type for response

* chore: move OneOf utility to types package

---------

Co-authored-by: Fernando Chavez <fernando.chavez@strapi.io>
* feat: releases settings

* feat: test nulling default timezone

* chore: refactor tests

* fix: remove async from describe

* feat: content releases settings permissions

* chore: test for unauthorized role

---------

Co-authored-by: Fernando Chavez <fernando.chavez@strapi.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: chore This PR contains chore tasks (cleanups, configs, tooling...) source: core:content-releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants