law-common 10.68.3 → 10.68.4

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.
@@ -1,4 +1,4 @@
1
- import { EntityEnum, IEntityUpdateDto, Nullable } from "../interface/entity.utils.interface";
1
+ import { EntityEnum, Nullable } from "../interface/entity.utils.interface";
2
2
  import { RelationConfigs } from "../interface/relation-config.interface";
3
3
  import { BaseEntityModel } from "./base.entity.model";
4
4
  import { IVendorActionDataDto } from "../../api";
@@ -65,9 +65,7 @@ export declare class VendorEntityModel extends BaseEntityModel<EntityEnum.VENDOR
65
65
  static relationConfigs: RelationConfigs<[EntityEnum.STATE], EntityEnum.VENDOR>;
66
66
  static fromEntity(entity: IVendorEntity): VendorEntityModel;
67
67
  getRelationConfigs(): any[];
68
- getNextStatus(currentUser: IUserEntity, dto: IEntityUpdateDto<IVendorEntity> & {
69
- actionData: IVendorActionDataDto;
70
- }): VendorStatusEnum;
68
+ getNextStatus(currentUser: IUserEntity, actionData: IVendorActionDataDto): VendorStatusEnum;
71
69
  getAvailableActions(currentUser: UserEntityModel, config?: {
72
70
  combinedActions?: Record<string, {
73
71
  combineActions: VendorActionEnum[];
@@ -57,7 +57,7 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
57
57
  getRelationConfigs() {
58
58
  return this.constructor.prototype.constructor.relationConfigs || [];
59
59
  }
60
- getNextStatus(currentUser, dto) {
60
+ getNextStatus(currentUser, actionData) {
61
61
  if (!this.status) {
62
62
  throw new exceptions_1.AppBadRequestException({
63
63
  key: error_key_enum_1.ErrorKeyEnum.STATUS,
@@ -71,17 +71,17 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
71
71
  message: [`No flow configuration found for status: ${this.status}`],
72
72
  });
73
73
  }
74
- if (!(dto === null || dto === void 0 ? void 0 : dto.actionData)) {
74
+ if (!actionData) {
75
75
  throw new exceptions_1.AppBadRequestException({
76
76
  key: error_key_enum_1.ErrorKeyEnum.ACTION_DATA,
77
- message: ["dto.actionData is required"],
77
+ message: ["actionData is required"],
78
78
  });
79
79
  }
80
- const matchingPermissionConfig = flowForStatus.actions[dto.actionData.action];
80
+ const matchingPermissionConfig = flowForStatus.actions[actionData.action];
81
81
  if (!matchingPermissionConfig) {
82
82
  throw new exceptions_1.AppBadRequestException({
83
83
  key: error_key_enum_1.ErrorKeyEnum.ACTION,
84
- message: [`Action '${dto.actionData.action}' is not valid for the current status.`],
84
+ message: [`Action '${actionData.action}' is not valid for the current status.`],
85
85
  });
86
86
  }
87
87
  if (!currentUser.permissions || currentUser.permissions.length === 0) {
@@ -94,7 +94,7 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
94
94
  if (!hasPermission) {
95
95
  throw new exceptions_1.AppBadRequestException({
96
96
  key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
97
- message: [`Current user does not have permission to ${dto.actionData.action} vendor`],
97
+ message: [`Current user does not have permission to ${actionData.action} vendor`],
98
98
  });
99
99
  }
100
100
  const nextStatus = matchingPermissionConfig.next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "10.68.3",
3
+ "version": "10.68.4",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [