-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
base: v5/main
Are you sure you want to change the base?
Conversation
* chore: migrate bulkDelete to v5 * chore: change findLocales type to accept strings array * fix: docs prettier styles * chore: remove console.log
…into v5/bulk-publish-unpublish
packages/core/content-releases/server/src/controllers/release.ts
Outdated
Show resolved
Hide resolved
This comment was marked as spam.
This comment was marked as spam.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
await strapi.db.query(RELEASE_ACTION_MODEL_UID).deleteMany({ | ||
where: { | ||
target_type: model.uid, | ||
target_id: { | ||
$in: (entriesToDelete as Array<{ id: Data.ID }>).map((entry) => entry.id), | ||
}, | ||
contentType: model.uid, | ||
locale: where.locale ?? null, | ||
...(where.documentId && { entryDocumentId: where.documentId }), |
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.
could this create a recursive infinite loop? (deleteMany triggering this same lifecycle)
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's a good point, honestly never thought about that. But you can see at line 15 that this subscriber is added only for D&P ContentTypes, and ReleaseAction doesn't has D&P, so the subscriber is not registered for it
const query: GetReleases.Request['query'] = await permissionsManager.sanitizeQuery(ctx.query); | ||
const { results, pagination } = await releaseService.findPage(query); |
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.
shoulndt this endpoint also need a yup validation?
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.
I don't think is necessary because this query doesn't handle any custom logic and the ctx.query is already sanitized with the permissionsManager, I tried some basis cases and it's working
packages/core/content-releases/server/src/middlewares/documents.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.
overall approach lgtm ! :) only added minor comments
…ny lifecycle async
What does it do?
Migrates and apply new changes on the Content Releases plugin for v5.
Work to do