@strapi/content-releases 5.0.0-rc.21 → 5.0.0-rc.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -914,6 +914,14 @@ const createReleaseActionService = ({ strapi: strapi2 }) => {
914
914
  validateEntryData(action.contentType, action.entryDocumentId),
915
915
  validateUniqueEntry(releaseId, action)
916
916
  ]);
917
+ const model = strapi2.contentType(action.contentType);
918
+ if (model.kind === "singleType") {
919
+ const document = await strapi2.db.query(model.uid).findOne({ select: ["documentId"] });
920
+ if (!document) {
921
+ throw new errors.NotFoundError(`No entry found for contentType ${action.contentType}`);
922
+ }
923
+ action.entryDocumentId = document.documentId;
924
+ }
917
925
  const release2 = await strapi2.db.query(RELEASE_MODEL_UID).findOne({ where: { id: releaseId } });
918
926
  if (!release2) {
919
927
  throw new errors.NotFoundError(`No release found for id ${releaseId}`);
@@ -1285,7 +1293,15 @@ const releaseController = {
1285
1293
  const releaseService = getService("release", { strapi });
1286
1294
  const query = await permissionsManager.sanitizeQuery(ctx.query);
1287
1295
  await validatefindByDocumentAttachedParams(query);
1288
- const { contentType, entryDocumentId, hasEntryAttached, locale } = query;
1296
+ const model = strapi.getModel(query.contentType);
1297
+ if (model.kind && model.kind === "singleType") {
1298
+ const document = await strapi.db.query(model.uid).findOne({ select: ["documentId"] });
1299
+ if (!document) {
1300
+ throw new errors.NotFoundError(`No entry found for contentType ${query.contentType}`);
1301
+ }
1302
+ query.entryDocumentId = document.documentId;
1303
+ }
1304
+ const { contentType, hasEntryAttached, entryDocumentId, locale } = query;
1289
1305
  const isEntryAttached = typeof hasEntryAttached === "string" ? Boolean(JSON.parse(hasEntryAttached)) : false;
1290
1306
  if (isEntryAttached) {
1291
1307
  const releases = await releaseService.findMany({