@strapi/review-workflows 5.2.0 → 5.4.0

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.
Files changed (65) hide show
  1. package/dist/_chunks/{Layout-C9m07iTY.mjs → Layout-BIIxkAtf.mjs} +3 -3
  2. package/dist/_chunks/Layout-BIIxkAtf.mjs.map +1 -0
  3. package/dist/_chunks/{Layout-8i0EXRRs.js → Layout-BWNbQOes.js} +3 -3
  4. package/dist/_chunks/Layout-BWNbQOes.js.map +1 -0
  5. package/dist/_chunks/{en-xcewH2pC.js → en-CYgjfSep.js} +5 -2
  6. package/dist/_chunks/en-CYgjfSep.js.map +1 -0
  7. package/dist/_chunks/{en-D9ZrQAV6.mjs → en-D9dxziEb.mjs} +5 -2
  8. package/dist/_chunks/en-D9dxziEb.mjs.map +1 -0
  9. package/dist/_chunks/{id-CmtaTf1x.js → id-CaHzMdxL.js} +72 -12
  10. package/dist/_chunks/id-CaHzMdxL.js.map +1 -0
  11. package/dist/_chunks/{id-DV0Ndeav.mjs → id-CtcCl3zh.mjs} +72 -12
  12. package/dist/_chunks/id-CtcCl3zh.mjs.map +1 -0
  13. package/dist/_chunks/{index-BCUO98DV.js → index-BX5MyocW.js} +3 -3
  14. package/dist/_chunks/{index-BCUO98DV.js.map → index-BX5MyocW.js.map} +1 -1
  15. package/dist/_chunks/{index-CqYVkW3E.mjs → index-ByTEmYbc.mjs} +3 -3
  16. package/dist/_chunks/{index-CqYVkW3E.mjs.map → index-ByTEmYbc.mjs.map} +1 -1
  17. package/dist/_chunks/{index-CA5Axcoc.mjs → index-CGmh3cED.mjs} +3 -3
  18. package/dist/_chunks/{index-CA5Axcoc.mjs.map → index-CGmh3cED.mjs.map} +1 -1
  19. package/dist/_chunks/{index-B8WmHbCU.js → index-DKLk-Z5E.js} +3 -3
  20. package/dist/_chunks/{index-B8WmHbCU.js.map → index-DKLk-Z5E.js.map} +1 -1
  21. package/dist/_chunks/{router-BOXlNnrU.js → router-Bt6JHY-e.js} +3 -3
  22. package/dist/_chunks/{router-BOXlNnrU.js.map → router-Bt6JHY-e.js.map} +1 -1
  23. package/dist/_chunks/{router-Jdt6SbIA.mjs → router-Cr3nulh9.mjs} +3 -3
  24. package/dist/_chunks/{router-Jdt6SbIA.mjs.map → router-Cr3nulh9.mjs.map} +1 -1
  25. package/dist/admin/index.js +1 -1
  26. package/dist/admin/index.mjs +1 -1
  27. package/dist/admin/src/services/settings.d.ts +7 -3
  28. package/dist/server/index.js +139 -48
  29. package/dist/server/index.js.map +1 -1
  30. package/dist/server/index.mjs +139 -48
  31. package/dist/server/index.mjs.map +1 -1
  32. package/dist/server/src/bootstrap.d.ts.map +1 -1
  33. package/dist/server/src/constants/workflows.d.ts +1 -0
  34. package/dist/server/src/constants/workflows.d.ts.map +1 -1
  35. package/dist/server/src/content-types/index.d.ts +6 -0
  36. package/dist/server/src/content-types/index.d.ts.map +1 -1
  37. package/dist/server/src/content-types/workflow/index.d.ts +6 -0
  38. package/dist/server/src/content-types/workflow/index.d.ts.map +1 -1
  39. package/dist/server/src/controllers/assignees.d.ts.map +1 -1
  40. package/dist/server/src/controllers/stages.d.ts.map +1 -1
  41. package/dist/server/src/index.d.ts +28 -6
  42. package/dist/server/src/index.d.ts.map +1 -1
  43. package/dist/server/src/register.d.ts.map +1 -1
  44. package/dist/server/src/services/assignees.d.ts +8 -4
  45. package/dist/server/src/services/assignees.d.ts.map +1 -1
  46. package/dist/server/src/services/document-service-middleware.d.ts +1 -0
  47. package/dist/server/src/services/document-service-middleware.d.ts.map +1 -1
  48. package/dist/server/src/services/index.d.ts +16 -6
  49. package/dist/server/src/services/index.d.ts.map +1 -1
  50. package/dist/server/src/services/metrics/index.d.ts +4 -4
  51. package/dist/server/src/services/metrics/index.d.ts.map +1 -1
  52. package/dist/server/src/services/stages.d.ts +6 -1
  53. package/dist/server/src/services/stages.d.ts.map +1 -1
  54. package/dist/server/src/services/workflows.d.ts.map +1 -1
  55. package/dist/server/src/validation/review-workflows.d.ts +4 -0
  56. package/dist/server/src/validation/review-workflows.d.ts.map +1 -1
  57. package/dist/shared/contracts/review-workflows.d.ts +8 -3
  58. package/dist/shared/contracts/review-workflows.d.ts.map +1 -1
  59. package/package.json +10 -10
  60. package/dist/_chunks/Layout-8i0EXRRs.js.map +0 -1
  61. package/dist/_chunks/Layout-C9m07iTY.mjs.map +0 -1
  62. package/dist/_chunks/en-D9ZrQAV6.mjs.map +0 -1
  63. package/dist/_chunks/en-xcewH2pC.js.map +0 -1
  64. package/dist/_chunks/id-CmtaTf1x.js.map +0 -1
  65. package/dist/_chunks/id-DV0Ndeav.mjs.map +0 -1
@@ -6387,7 +6387,8 @@ const WORKFLOW_POPULATE = {
6387
6387
  }
6388
6388
  }
6389
6389
  }
6390
- }
6390
+ },
6391
+ stageRequiredToPublish: true
6391
6392
  };
6392
6393
  function checkVersionThreshold(startVersion, currentVersion, thresholdVersion) {
6393
6394
  return semver$1.gte(currentVersion, thresholdVersion) && semver$1.lt(startVersion, thresholdVersion);
@@ -6562,8 +6563,40 @@ function extendReviewWorkflowContentTypes({ strapi: strapi2 }) {
6562
6563
  });
6563
6564
  }
6564
6565
  }
6566
+ function persistRWOnDowngrade({ strapi: strapi2 }) {
6567
+ const { removePersistedTablesWithSuffix, persistTables } = getAdminService("persist-tables");
6568
+ return async ({ contentTypes: contentTypes2 }) => {
6569
+ const getStageTableToPersist = (contentTypeUID) => {
6570
+ const { attributes, tableName } = strapi2.db.metadata.get(contentTypeUID);
6571
+ const joinTableName = attributes[ENTITY_STAGE_ATTRIBUTE].joinTable.name;
6572
+ return {
6573
+ name: joinTableName,
6574
+ dependsOn: [{ name: tableName }]
6575
+ };
6576
+ };
6577
+ const getAssigneeTableToPersist = (contentTypeUID) => {
6578
+ const { attributes, tableName } = strapi2.db.metadata.get(contentTypeUID);
6579
+ const joinTableName = attributes[ENTITY_ASSIGNEE_ATTRIBUTE].joinTable.name;
6580
+ return {
6581
+ name: joinTableName,
6582
+ dependsOn: [{ name: tableName }]
6583
+ };
6584
+ };
6585
+ const enabledRWContentTypes = fp.pipe([
6586
+ getVisibleContentTypesUID,
6587
+ fp.filter((uid) => hasStageAttribute(contentTypes2[uid]))
6588
+ ])(contentTypes2);
6589
+ const stageJoinTablesToPersist = enabledRWContentTypes.map(getStageTableToPersist);
6590
+ await removePersistedTablesWithSuffix("_strapi_stage_lnk");
6591
+ await persistTables(stageJoinTablesToPersist);
6592
+ const assigneeJoinTablesToPersist = enabledRWContentTypes.map(getAssigneeTableToPersist);
6593
+ await removePersistedTablesWithSuffix("_strapi_assignee_lnk");
6594
+ await persistTables(assigneeJoinTablesToPersist);
6595
+ };
6596
+ }
6565
6597
  const register = async ({ strapi: strapi2 }) => {
6566
6598
  strapi2.hook("strapi::content-types.beforeSync").register(migrateStageAttribute);
6599
+ strapi2.hook("strapi::content-types.afterSync").register(persistRWOnDowngrade({ strapi: strapi2 }));
6567
6600
  strapi2.hook("strapi::content-types.afterSync").register(migrateReviewWorkflowStagesColor).register(migrateReviewWorkflowStagesRoles).register(migrateReviewWorkflowName).register(migrateWorkflowsContentTypes).register(migrateDeletedCTInWorkflows);
6568
6601
  reviewWorkflowsMiddlewares.contentTypeMiddleware(strapi2);
6569
6602
  extendReviewWorkflowContentTypes({ strapi: strapi2 });
@@ -6608,6 +6641,12 @@ const workflow = {
6608
6641
  relation: "oneToMany",
6609
6642
  mappedBy: "workflow"
6610
6643
  },
6644
+ stageRequiredToPublish: {
6645
+ type: "relation",
6646
+ target: "plugin::review-workflows.workflow-stage",
6647
+ relation: "oneToOne",
6648
+ required: false
6649
+ },
6611
6650
  contentTypes: {
6612
6651
  type: "json",
6613
6652
  required: true,
@@ -6757,6 +6796,7 @@ const bootstrap = async (args) => {
6757
6796
  const docsMiddlewares = getService("document-service-middlewares");
6758
6797
  strapi.documents.use(docsMiddlewares.assignStageOnCreate);
6759
6798
  strapi.documents.use(docsMiddlewares.handleStageOnUpdate);
6799
+ strapi.documents.use(docsMiddlewares.checkStageBeforePublish);
6760
6800
  };
6761
6801
  const destroy = async ({ strapi: strapi2 }) => {
6762
6802
  };
@@ -6989,9 +7029,9 @@ const processFilters = ({ strapi: strapi2 }, filters = {}) => {
6989
7029
  };
6990
7030
  const processPopulate = (populate) => {
6991
7031
  if (!populate) {
6992
- return populate;
7032
+ return WORKFLOW_POPULATE;
6993
7033
  }
6994
- return WORKFLOW_POPULATE;
7034
+ return populate;
6995
7035
  };
6996
7036
  const workflows$1 = ({ strapi: strapi2 }) => {
6997
7037
  const workflowsContentTypes = workflowsContentTypesFactory({ strapi: strapi2 });
@@ -7042,14 +7082,27 @@ const workflows$1 = ({ strapi: strapi2 }) => {
7042
7082
  const stages2 = await getService("stages", { strapi: strapi2 }).createMany(opts.data.stages);
7043
7083
  const mapIds = fp.map(fp.get("id"));
7044
7084
  createOpts = fp.set("data.stages", mapIds(stages2), createOpts);
7085
+ if (opts.data.stageRequiredToPublishName) {
7086
+ const stageRequiredToPublish = stages2.find(
7087
+ (stage) => stage.name === opts.data.stageRequiredToPublishName
7088
+ );
7089
+ if (!stageRequiredToPublish) {
7090
+ throw new utils.errors.ApplicationError("Stage required to publish does not exist");
7091
+ }
7092
+ createOpts = fp.set("data.stageRequiredToPublish", stageRequiredToPublish.id, createOpts);
7093
+ }
7045
7094
  if (opts.data.contentTypes) {
7046
7095
  await workflowsContentTypes.migrate({
7047
7096
  destContentTypes: opts.data.contentTypes,
7048
7097
  stageId: stages2[0].id
7049
7098
  });
7050
7099
  }
7051
- metrics.sendDidCreateWorkflow();
7052
- return strapi2.db.query(WORKFLOW_MODEL_UID).create(strapi2.get("query-params").transform(WORKFLOW_MODEL_UID, createOpts));
7100
+ const createdWorkflow = await strapi2.db.query(WORKFLOW_MODEL_UID).create(strapi2.get("query-params").transform(WORKFLOW_MODEL_UID, createOpts));
7101
+ metrics.sendDidCreateWorkflow(createdWorkflow.id, !!opts.data.stageRequiredToPublishName);
7102
+ if (opts.data.stageRequiredToPublishName) {
7103
+ await strapi2.plugin("content-releases").service("release-action").validateActionsByContentTypes(opts.data.contentTypes);
7104
+ }
7105
+ return createdWorkflow;
7053
7106
  });
7054
7107
  },
7055
7108
  /**
@@ -7062,6 +7115,7 @@ const workflows$1 = ({ strapi: strapi2 }) => {
7062
7115
  async update(workflow2, opts) {
7063
7116
  const stageService = getService("stages", { strapi: strapi2 });
7064
7117
  let updateOpts = { ...opts, populate: { ...WORKFLOW_POPULATE } };
7118
+ let updatedStages = [];
7065
7119
  let updatedStageIds;
7066
7120
  await workflowValidator.validateWorkflowCount();
7067
7121
  return strapi2.db.transaction(async () => {
@@ -7070,9 +7124,28 @@ const workflows$1 = ({ strapi: strapi2 }) => {
7070
7124
  opts.data.stages.forEach(
7071
7125
  (stage) => this.assertStageBelongsToWorkflow(stage.id, workflow2)
7072
7126
  );
7073
- updatedStageIds = await stageService.replaceStages(workflow2.stages, opts.data.stages, workflow2.contentTypes).then((stages2) => stages2.map((stage) => stage.id));
7127
+ updatedStages = await stageService.replaceStages(
7128
+ workflow2.stages,
7129
+ opts.data.stages,
7130
+ workflow2.contentTypes
7131
+ );
7132
+ updatedStageIds = updatedStages.map((stage) => stage.id);
7074
7133
  updateOpts = fp.set("data.stages", updatedStageIds, updateOpts);
7075
7134
  }
7135
+ if (opts.data.stageRequiredToPublishName !== void 0) {
7136
+ const stages2 = updatedStages ?? workflow2.stages;
7137
+ if (opts.data.stageRequiredToPublishName === null) {
7138
+ updateOpts = fp.set("data.stageRequiredToPublish", null, updateOpts);
7139
+ } else {
7140
+ const stageRequiredToPublish = stages2.find(
7141
+ (stage) => stage.name === opts.data.stageRequiredToPublishName
7142
+ );
7143
+ if (!stageRequiredToPublish) {
7144
+ throw new utils.errors.ApplicationError("Stage required to publish does not exist");
7145
+ }
7146
+ updateOpts = fp.set("data.stageRequiredToPublish", stageRequiredToPublish.id, updateOpts);
7147
+ }
7148
+ }
7076
7149
  if (opts.data.contentTypes) {
7077
7150
  await workflowsContentTypes.migrate({
7078
7151
  srcContentTypes: workflow2.contentTypes,
@@ -7080,12 +7153,17 @@ const workflows$1 = ({ strapi: strapi2 }) => {
7080
7153
  stageId: updatedStageIds ? updatedStageIds[0] : workflow2.stages[0].id
7081
7154
  });
7082
7155
  }
7083
- metrics.sendDidEditWorkflow();
7156
+ metrics.sendDidEditWorkflow(workflow2.id, !!opts.data.stageRequiredToPublishName);
7084
7157
  const query = strapi2.get("query-params").transform(WORKFLOW_MODEL_UID, updateOpts);
7085
- return strapi2.db.query(WORKFLOW_MODEL_UID).update({
7158
+ const updatedWorkflow = await strapi2.db.query(WORKFLOW_MODEL_UID).update({
7086
7159
  ...query,
7087
7160
  where: { id: workflow2.id }
7088
7161
  });
7162
+ await strapi2.plugin("content-releases").service("release-action").validateActionsByContentTypes([
7163
+ ...workflow2.contentTypes,
7164
+ ...opts.data.contentTypes || []
7165
+ ]);
7166
+ return updatedWorkflow;
7089
7167
  });
7090
7168
  },
7091
7169
  /**
@@ -7108,10 +7186,12 @@ const workflows$1 = ({ strapi: strapi2 }) => {
7108
7186
  destContentTypes: []
7109
7187
  });
7110
7188
  const query = strapi2.get("query-params").transform(WORKFLOW_MODEL_UID, opts);
7111
- return strapi2.db.query(WORKFLOW_MODEL_UID).delete({
7189
+ const deletedWorkflow = await strapi2.db.query(WORKFLOW_MODEL_UID).delete({
7112
7190
  ...query,
7113
7191
  where: { id: workflow2.id }
7114
7192
  });
7193
+ await strapi2.plugin("content-releases").service("release-action").validateActionsByContentTypes(workflow2.contentTypes);
7194
+ return deletedWorkflow;
7115
7195
  });
7116
7196
  },
7117
7197
  /**
@@ -7323,8 +7403,9 @@ const stages$1 = ({ strapi: strapi2 }) => {
7323
7403
  /**
7324
7404
  * Update the stage of an entity
7325
7405
  */
7326
- async updateEntity(documentId, locale, model, stageId) {
7406
+ async updateEntity(entityToUpdate, model, stageId) {
7327
7407
  const stage = await this.findById(stageId);
7408
+ const { documentId, locale } = entityToUpdate;
7328
7409
  await workflowValidator.validateWorkflowCount();
7329
7410
  if (!stage) {
7330
7411
  throw new ApplicationError$2(`Selected stage does not exist`);
@@ -7337,6 +7418,10 @@ const stages$1 = ({ strapi: strapi2 }) => {
7337
7418
  data: { [ENTITY_STAGE_ATTRIBUTE]: fp.pick(["id"], stage) },
7338
7419
  populate: [ENTITY_STAGE_ATTRIBUTE]
7339
7420
  });
7421
+ const { tableName } = strapi2.db.metadata.get(model);
7422
+ await strapi2.db.connection(tableName).where({ id: entityToUpdate.id }).update({
7423
+ updated_at: new Date(entityToUpdate.updatedAt)
7424
+ });
7340
7425
  metrics.sendDidChangeEntryStage();
7341
7426
  return entity;
7342
7427
  },
@@ -7483,32 +7568,28 @@ const assignees$1 = ({ strapi: strapi2 }) => {
7483
7568
  /**
7484
7569
  * Update the assignee of an entity
7485
7570
  */
7486
- async updateEntityAssignee(documentId, locale, model, assigneeId) {
7487
- if (fp.isNil(assigneeId)) {
7488
- return this.deleteEntityAssignee(documentId, locale, model);
7489
- }
7490
- const userExists = await getAdminService("user", { strapi: strapi2 }).exists({ id: assigneeId });
7491
- if (!userExists) {
7492
- throw new ApplicationError(`Selected user does not exist`);
7571
+ async updateEntityAssignee(entityToUpdate, model, assigneeId) {
7572
+ const { documentId, locale } = entityToUpdate;
7573
+ if (!fp.isNil(assigneeId)) {
7574
+ const userExists = await getAdminService("user", { strapi: strapi2 }).exists({ id: assigneeId });
7575
+ if (!userExists) {
7576
+ throw new ApplicationError(`Selected user does not exist`);
7577
+ }
7493
7578
  }
7494
- metrics.sendDidEditAssignee(await this.findEntityAssigneeId(documentId, model), assigneeId);
7495
- return strapi2.documents(model).update({
7579
+ const oldAssigneeId = await this.findEntityAssigneeId(entityToUpdate.id, model);
7580
+ metrics.sendDidEditAssignee(oldAssigneeId, assigneeId || null);
7581
+ const entity = await strapi2.documents(model).update({
7496
7582
  documentId,
7497
7583
  locale,
7498
- data: { [ENTITY_ASSIGNEE_ATTRIBUTE]: assigneeId },
7584
+ data: { [ENTITY_ASSIGNEE_ATTRIBUTE]: assigneeId || null },
7499
7585
  populate: [ENTITY_ASSIGNEE_ATTRIBUTE],
7500
7586
  fields: []
7501
7587
  });
7502
- },
7503
- async deleteEntityAssignee(documentId, locale, model) {
7504
- metrics.sendDidEditAssignee(await this.findEntityAssigneeId(documentId, model), null);
7505
- return strapi2.documents(model).update({
7506
- documentId,
7507
- locale,
7508
- data: { [ENTITY_ASSIGNEE_ATTRIBUTE]: null },
7509
- populate: [ENTITY_ASSIGNEE_ATTRIBUTE],
7510
- fields: []
7588
+ const { tableName } = strapi2.db.metadata.get(model);
7589
+ await strapi2.db.connection(tableName).where({ id: entityToUpdate.id }).update({
7590
+ updated_at: new Date(entityToUpdate.updatedAt)
7511
7591
  });
7592
+ return entity;
7512
7593
  }
7513
7594
  };
7514
7595
  };
@@ -7581,11 +7662,11 @@ const sendDidDeleteStage = async () => {
7581
7662
  const sendDidChangeEntryStage = async () => {
7582
7663
  strapi.telemetry.send("didChangeEntryStage", {});
7583
7664
  };
7584
- const sendDidCreateWorkflow = async () => {
7585
- strapi.telemetry.send("didCreateWorkflow", {});
7665
+ const sendDidCreateWorkflow = async (workflowId, hasRequiredStageToPublish) => {
7666
+ strapi.telemetry.send("didCreateWorkflow", { workflowId, hasRequiredStageToPublish });
7586
7667
  };
7587
- const sendDidEditWorkflow = async () => {
7588
- strapi.telemetry.send("didEditWorkflow", {});
7668
+ const sendDidEditWorkflow = async (workflowId, hasRequiredStageToPublish) => {
7669
+ strapi.telemetry.send("didEditWorkflow", { workflowId, hasRequiredStageToPublish });
7589
7670
  };
7590
7671
  const sendDidEditAssignee = async (fromId, toId) => {
7591
7672
  strapi.telemetry.send("didEditAssignee", { from: fromId, to: toId });
@@ -7838,9 +7919,27 @@ const handleStageOnUpdate = async (ctx, next) => {
7838
7919
  }
7839
7920
  return next();
7840
7921
  };
7922
+ const checkStageBeforePublish = async (ctx, next) => {
7923
+ if (ctx.action !== "publish") {
7924
+ return next();
7925
+ }
7926
+ const workflow2 = await getService("workflows").getAssignedWorkflow(ctx.contentType.uid, {
7927
+ populate: "stageRequiredToPublish"
7928
+ });
7929
+ if (!workflow2 || !workflow2.stageRequiredToPublish) {
7930
+ return next();
7931
+ }
7932
+ const { documentId } = ctx.params;
7933
+ const entryStage = await getEntityStage(ctx.contentType.uid, documentId, ctx.params);
7934
+ if (entryStage.id !== workflow2.stageRequiredToPublish.id) {
7935
+ throw new utils.errors.ValidationError("Entry is not at the required stage to publish");
7936
+ }
7937
+ return next();
7938
+ };
7841
7939
  const documentServiceMiddleware = () => ({
7842
7940
  assignStageOnCreate,
7843
- handleStageOnUpdate
7941
+ handleStageOnUpdate,
7942
+ checkStageBeforePublish
7844
7943
  });
7845
7944
  const services = {
7846
7945
  workflows: workflows$1,
@@ -7890,12 +7989,14 @@ const validateContentTypes = utils.yup.array().of(
7890
7989
  const validateWorkflowCreateSchema = utils.yup.object().shape({
7891
7990
  name: utils.yup.string().max(255).min(1, "Workflow name can not be empty").required(),
7892
7991
  stages: utils.yup.array().of(stageObject).uniqueProperty("name", "Stage name must be unique").min(1, "Can not create a workflow without stages").max(200, "Can not have more than 200 stages").required("Can not create a workflow without stages"),
7893
- contentTypes: validateContentTypes
7992
+ contentTypes: validateContentTypes,
7993
+ stageRequiredToPublishName: utils.yup.string().min(1).nullable()
7894
7994
  });
7895
7995
  const validateWorkflowUpdateSchema = utils.yup.object().shape({
7896
7996
  name: utils.yup.string().max(255).min(1, "Workflow name can not be empty"),
7897
7997
  stages: utils.yup.array().of(stageObject).uniqueProperty("name", "Stage name must be unique").min(1, "Can not update a workflow without stages").max(200, "Can not have more than 200 stages"),
7898
- contentTypes: validateContentTypes
7998
+ contentTypes: validateContentTypes,
7999
+ stageRequiredToPublishName: utils.yup.string().min(1).nullable()
7899
8000
  });
7900
8001
  const validateUpdateAssigneeOnEntitySchema = utils.yup.object().shape({
7901
8002
  id: utils.yup.number().integer().min(1).nullable()
@@ -8098,12 +8199,7 @@ const stages = {
8098
8199
  );
8099
8200
  const workflow2 = await workflowService.assertContentTypeBelongsToWorkflow(modelUID);
8100
8201
  workflowService.assertStageBelongsToWorkflow(stageId, workflow2);
8101
- const updatedEntity = await stagesService.updateEntity(
8102
- entity.documentId,
8103
- entity.locale,
8104
- modelUID,
8105
- stageId
8106
- );
8202
+ const updatedEntity = await stagesService.updateEntity(entity, modelUID, stageId);
8107
8203
  ctx.body = { data: await sanitizeOutput(updatedEntity) };
8108
8204
  },
8109
8205
  /**
@@ -8200,12 +8296,7 @@ const assignees = {
8200
8296
  "You should pass a valid id to the body of the put request."
8201
8297
  );
8202
8298
  await workflowService.assertContentTypeBelongsToWorkflow(model);
8203
- const updatedEntity = await assigneeService.updateEntityAssignee(
8204
- documentId,
8205
- locale || null,
8206
- model,
8207
- assigneeId
8208
- );
8299
+ const updatedEntity = await assigneeService.updateEntityAssignee(entity, model, assigneeId);
8209
8300
  ctx.body = { data: await sanitizeOutput(updatedEntity) };
8210
8301
  }
8211
8302
  };