@strapi/review-workflows 0.0.0-experimental.abc → 0.0.0-experimental.afa3b513b8f95459043f33fb94f4bac03af1474f

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.
@@ -7321,23 +7321,17 @@ const stages$1 = ({ strapi: strapi2 }) => {
7321
7321
  },
7322
7322
  /**
7323
7323
  * Update the stage of an entity
7324
- *
7325
- * @param {object} entityInfo
7326
- * @param {number} entityInfo.id - Entity id
7327
- * @param {string} entityInfo.modelUID - the content-type of the entity
7328
- * @param {number} stageId - The id of the stage to assign to the entity
7329
7324
  */
7330
- async updateEntity(entityInfo, stageId) {
7325
+ async updateEntity(documentId, locale, model, stageId) {
7331
7326
  const stage = await this.findById(stageId);
7332
7327
  await workflowValidator.validateWorkflowCount();
7333
7328
  if (!stage) {
7334
7329
  throw new ApplicationError$2(`Selected stage does not exist`);
7335
7330
  }
7336
- const entity = await strapi2.db.query(entityInfo.modelUID).update({
7337
- where: {
7338
- id: entityInfo.id
7339
- },
7340
- data: { [ENTITY_STAGE_ATTRIBUTE]: stageId },
7331
+ const entity = await strapi2.documents(model).update({
7332
+ documentId,
7333
+ locale,
7334
+ data: { [ENTITY_STAGE_ATTRIBUTE]: stage },
7341
7335
  populate: [ENTITY_STAGE_ATTRIBUTE]
7342
7336
  });
7343
7337
  metrics.sendDidChangeEntryStage();
@@ -7810,6 +7804,7 @@ const handleStageOnUpdate = async (ctx, next) => {
7810
7804
  strapi.eventHub.emit(WORKFLOW_UPDATE_STAGE, {
7811
7805
  model: model.modelName,
7812
7806
  uid: model.uid,
7807
+ // TODO v6: Rename to "entry", which is what is used for regular CRUD updates
7813
7808
  entity: {
7814
7809
  // @ts-expect-error
7815
7810
  id: result?.id,
@@ -8095,7 +8090,12 @@ const stages = {
8095
8090
  );
8096
8091
  const workflow2 = await workflowService.assertContentTypeBelongsToWorkflow(modelUID);
8097
8092
  workflowService.assertStageBelongsToWorkflow(stageId, workflow2);
8098
- const updatedEntity = await stagesService.updateEntity({ id: entity.id, modelUID }, stageId);
8093
+ const updatedEntity = await stagesService.updateEntity(
8094
+ entity.documentId,
8095
+ entity.locale,
8096
+ modelUID,
8097
+ stageId
8098
+ );
8099
8099
  ctx.body = { data: await sanitizeOutput(updatedEntity) };
8100
8100
  },
8101
8101
  /**