law-common 14.1.4-beta.0 → 14.1.4-beta.2

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 (27) hide show
  1. package/dist/src/api/index.d.ts +0 -2
  2. package/dist/src/api/index.js +0 -2
  3. package/dist/src/api/v1/index.d.ts +2 -0
  4. package/dist/src/api/v1/index.js +2 -0
  5. package/dist/src/api/{interface → v1/interface}/office_location.create.dto.interface.d.ts +1 -1
  6. package/dist/src/api/{interface → v1/interface}/office_location.update.dto.interface.d.ts +1 -1
  7. package/dist/src/api/v2/index.d.ts +2 -0
  8. package/dist/src/api/v2/index.js +2 -0
  9. package/dist/src/api/v2/interface/office_location.create.dto.interface.d.ts +15 -0
  10. package/dist/src/api/v2/interface/office_location.create.dto.interface.js +2 -0
  11. package/dist/src/api/v2/interface/office_location.update.dto.interface.d.ts +13 -0
  12. package/dist/src/api/v2/interface/office_location.update.dto.interface.js +2 -0
  13. package/dist/src/entities/flow-configs/office_location_flow.config.d.ts +33 -0
  14. package/dist/src/entities/flow-configs/office_location_flow.config.js +13 -3
  15. package/dist/src/entities/flow-configs/utils/flow-config.utils.d.ts +32 -0
  16. package/dist/src/entities/flow-configs/utils/flow-config.utils.js +2 -0
  17. package/dist/src/entities/index.d.ts +2 -1
  18. package/dist/src/entities/index.js +5 -2
  19. package/dist/src/entities/interface/field-constraint/office_location_address_field_constraints.interface.d.ts +13 -0
  20. package/dist/src/entities/interface/field-constraint/office_location_address_field_constraints.interface.js +17 -0
  21. package/dist/src/entities/interface/field-constraint/office_location_field_constraints.interface.d.ts +0 -9
  22. package/dist/src/entities/interface/field-constraint/office_location_field_constraints.interface.js +4 -13
  23. package/dist/src/entities/model/office_location.entity.model.d.ts +64 -8
  24. package/dist/src/entities/model/office_location.entity.model.js +393 -6
  25. package/package.json +1 -1
  26. /package/dist/src/api/{interface → v1/interface}/office_location.create.dto.interface.js +0 -0
  27. /package/dist/src/api/{interface → v1/interface}/office_location.update.dto.interface.js +0 -0
@@ -35,10 +35,8 @@ export * from "./interface/billing_timesheet.details.dto.interface";
35
35
  export * from "./interface/billing_timesheet.filter.dto.interface";
36
36
  export * from "./interface/billing_timesheet.update.dto.interface";
37
37
  export * from "./interface/billing.entity.response";
38
- export * from "./interface/office_location.create.dto.interface";
39
38
  export * from "./interface/office_location.entity.response";
40
39
  export * from "./interface/office_location.filter.dto.interface";
41
- export * from "./interface/office_location.update.dto.interface";
42
40
  export * from "./interface/organization.filter.dto.interface";
43
41
  export * from "./interface/billing.update.dto.interface";
44
42
  export * from "./interface/moving_timesheet.create.dto.interface";
@@ -74,10 +74,8 @@ __exportStar(require("./interface/billing_timesheet.details.dto.interface"), exp
74
74
  __exportStar(require("./interface/billing_timesheet.filter.dto.interface"), exports);
75
75
  __exportStar(require("./interface/billing_timesheet.update.dto.interface"), exports);
76
76
  __exportStar(require("./interface/billing.entity.response"), exports);
77
- __exportStar(require("./interface/office_location.create.dto.interface"), exports);
78
77
  __exportStar(require("./interface/office_location.entity.response"), exports);
79
78
  __exportStar(require("./interface/office_location.filter.dto.interface"), exports);
80
- __exportStar(require("./interface/office_location.update.dto.interface"), exports);
81
79
  __exportStar(require("./interface/organization.filter.dto.interface"), exports);
82
80
  __exportStar(require("./interface/billing.update.dto.interface"), exports);
83
81
  __exportStar(require("./interface/moving_timesheet.create.dto.interface"), exports);
@@ -7,5 +7,7 @@
7
7
  */
8
8
  export * from "./interface/expense_type.create.dto.interface";
9
9
  export * from "./interface/expense_type.update.dto.interface";
10
+ export * from "./interface/office_location.create.dto.interface";
11
+ export * from "./interface/office_location.update.dto.interface";
10
12
  export * from "./interface/to_do_list.create.dto.interface";
11
13
  export * from "./interface/to_do_list.update.dto.interface";
@@ -23,5 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  */
24
24
  __exportStar(require("./interface/expense_type.create.dto.interface"), exports);
25
25
  __exportStar(require("./interface/expense_type.update.dto.interface"), exports);
26
+ __exportStar(require("./interface/office_location.create.dto.interface"), exports);
27
+ __exportStar(require("./interface/office_location.update.dto.interface"), exports);
26
28
  __exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
27
29
  __exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
@@ -1,4 +1,4 @@
1
- import { IEntityCreateDto, IOfficeLocationEntity } from "../../entities";
1
+ import { IEntityCreateDto, IOfficeLocationEntity } from "../../../entities";
2
2
  /** status is set by the entity flow, never by the client */
3
3
  export type IOfficeLocationCreateExclude = "status";
4
4
  export interface IOfficeLocationCreateDto extends Omit<IEntityCreateDto<IOfficeLocationEntity>, IOfficeLocationCreateExclude> {
@@ -1,4 +1,4 @@
1
- import { IEntityUpdateDto, IOfficeLocationEntity } from "../../entities";
1
+ import { IEntityUpdateDto, IOfficeLocationEntity } from "../../../entities";
2
2
  import { IOfficeLocationCreateExclude } from "./office_location.create.dto.interface";
3
3
  export interface IOfficeLocationUpdateDto extends Omit<IEntityUpdateDto<IOfficeLocationEntity>, IOfficeLocationCreateExclude> {
4
4
  }
@@ -11,3 +11,5 @@ export * from "./interface/to_do_list.create.dto.interface";
11
11
  export * from "./interface/to_do_list.update.dto.interface";
12
12
  export * from "./interface/expense_type.create.dto.interface";
13
13
  export * from "./interface/expense_type.update.dto.interface";
14
+ export * from "./interface/office_location.create.dto.interface";
15
+ export * from "./interface/office_location.update.dto.interface";
@@ -29,3 +29,5 @@ __exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
29
29
  __exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
30
30
  __exportStar(require("./interface/expense_type.create.dto.interface"), exports);
31
31
  __exportStar(require("./interface/expense_type.update.dto.interface"), exports);
32
+ __exportStar(require("./interface/office_location.create.dto.interface"), exports);
33
+ __exportStar(require("./interface/office_location.update.dto.interface"), exports);
@@ -0,0 +1,15 @@
1
+ import { IEntityCreateDto, Nullable } from "../../../entities";
2
+ import { IOfficeLocationEntity } from "../../../entities/interface/office_location.entity.interface";
3
+ export interface IOfficeLocationAddress {
4
+ addressLine1: string;
5
+ addressLine2?: Nullable<string>;
6
+ city: string;
7
+ state: string;
8
+ }
9
+ export type IOfficeLocationAddressCreateExclude = never;
10
+ export interface IOfficeLocationAddressCreateDto extends Omit<IEntityCreateDto<IOfficeLocationAddress>, IOfficeLocationAddressCreateExclude> {
11
+ }
12
+ export type IOfficeLocationCreateExclude = "address" | "organizationId" | "status";
13
+ export interface IOfficeLocationCreateDto extends Omit<IEntityCreateDto<IOfficeLocationEntity>, IOfficeLocationCreateExclude> {
14
+ address: IOfficeLocationAddressCreateDto;
15
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { DeepPartialButRequired } from "../../interface/api.utils.interface";
2
+ import { OfficeLocationActionEnum } from "../../../entities";
3
+ import { IOfficeLocationAddressCreateDto, IOfficeLocationCreateDto } from "./office_location.create.dto.interface";
4
+ export type IOfficeLocationAddressUpdateDto = DeepPartialButRequired<IOfficeLocationAddressCreateDto, never>;
5
+ export type IOfficeLocationUpdateDto = DeepPartialButRequired<IOfficeLocationCreateDto, never> & {
6
+ actionData: IOfficeLocationActionDataDto;
7
+ } & {
8
+ id?: number;
9
+ };
10
+ export interface IOfficeLocationActionDataDto {
11
+ action: OfficeLocationActionEnum;
12
+ remark?: string;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,39 @@
1
1
  import { FlowConfig } from "./flow-config.type";
2
2
  import { OfficeLocationActionEnum } from "../enums/office_location_action_enum";
3
3
  import { OfficeLocationStatusEnum } from "../enums/office_location_status_enum";
4
+ import { PermissionGroupEnum } from "../enums/permission_group_enum";
4
5
  export interface IOfficeLocationFlowConfigContextData {
5
6
  }
7
+ export declare const ACTION_MAP: {
8
+ CREATE: {
9
+ reachableStatues: readonly [OfficeLocationStatusEnum.APPROVED];
10
+ permissions: string[];
11
+ group: PermissionGroupEnum.CREATE;
12
+ };
13
+ UPDATE: {
14
+ reachableStatues: readonly [OfficeLocationStatusEnum.APPROVED];
15
+ permissions: string[];
16
+ group: PermissionGroupEnum.UPDATE;
17
+ };
18
+ DELETE: {
19
+ reachableStatues: readonly [OfficeLocationStatusEnum.DELETED];
20
+ permissions: string[];
21
+ group: PermissionGroupEnum.DELETE;
22
+ };
23
+ DEACTIVATE: {
24
+ reachableStatues: readonly [OfficeLocationStatusEnum.DEACTIVATED];
25
+ permissions: string[];
26
+ group: PermissionGroupEnum.UPDATE;
27
+ };
28
+ ACTIVATE: {
29
+ reachableStatues: readonly [OfficeLocationStatusEnum.APPROVED];
30
+ permissions: string[];
31
+ group: PermissionGroupEnum.UPDATE;
32
+ };
33
+ RESTORE: {
34
+ reachableStatues: readonly [OfficeLocationStatusEnum.APPROVED];
35
+ permissions: string[];
36
+ group: PermissionGroupEnum.UPDATE;
37
+ };
38
+ };
6
39
  export declare const officeLocationFlowConfig: FlowConfig<OfficeLocationStatusEnum, OfficeLocationActionEnum, IOfficeLocationFlowConfigContextData>;
@@ -1,42 +1,52 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.officeLocationFlowConfig = void 0;
3
+ exports.officeLocationFlowConfig = exports.ACTION_MAP = void 0;
4
4
  const base_flow_config_factory_1 = require("./base-flow-config.factory");
5
5
  const office_location_action_enum_1 = require("../enums/office_location_action_enum");
6
6
  const office_location_status_enum_1 = require("../enums/office_location_status_enum");
7
+ const permission_group_enum_1 = require("../enums/permission_group_enum");
7
8
  const OFFICE_LOCATION_CREATE_PERMISSION = ["OFFICE_LOCATION_CREATE"];
8
9
  const OFFICE_LOCATION_UPDATE_PERMISSION = ["OFFICE_LOCATION_UPDATE"];
9
10
  const OFFICE_LOCATION_DELETE_PERMISSION = ["OFFICE_LOCATION_DELETE"];
10
11
  const OFFICE_LOCATION_DEACTIVATE_PERMISSION = ["OFFICE_LOCATION_DEACTIVATE"];
11
12
  const OFFICE_LOCATION_ACTIVATE_PERMISSION = ["OFFICE_LOCATION_ACTIVATE"];
12
13
  const OFFICE_LOCATION_RESTORE_PERMISSION = ["OFFICE_LOCATION_RESTORE"];
13
- const ACTION_MAP = {
14
+ // Every action declares its group; office_location_bulk_update.transaction.ts reads `group` to pick the
15
+ // permission a dto is authorised under. The three lifecycle actions share the UPDATE group because that
16
+ // is where `derivePermissionGroup` classifies them (see expense_type_flow.config.ts).
17
+ exports.ACTION_MAP = {
14
18
  [office_location_action_enum_1.OfficeLocationActionEnum.CREATE]: {
15
19
  reachableStatues: [office_location_status_enum_1.OfficeLocationStatusEnum.APPROVED],
16
20
  permissions: OFFICE_LOCATION_CREATE_PERMISSION,
21
+ group: permission_group_enum_1.PermissionGroupEnum.CREATE,
17
22
  },
18
23
  [office_location_action_enum_1.OfficeLocationActionEnum.UPDATE]: {
19
24
  reachableStatues: [office_location_status_enum_1.OfficeLocationStatusEnum.APPROVED],
20
25
  permissions: OFFICE_LOCATION_UPDATE_PERMISSION,
26
+ group: permission_group_enum_1.PermissionGroupEnum.UPDATE,
21
27
  },
22
28
  [office_location_action_enum_1.OfficeLocationActionEnum.DELETE]: {
23
29
  reachableStatues: [office_location_status_enum_1.OfficeLocationStatusEnum.DELETED],
24
30
  permissions: OFFICE_LOCATION_DELETE_PERMISSION,
31
+ group: permission_group_enum_1.PermissionGroupEnum.DELETE,
25
32
  },
26
33
  [office_location_action_enum_1.OfficeLocationActionEnum.DEACTIVATE]: {
27
34
  reachableStatues: [office_location_status_enum_1.OfficeLocationStatusEnum.DEACTIVATED],
28
35
  permissions: OFFICE_LOCATION_DEACTIVATE_PERMISSION,
36
+ group: permission_group_enum_1.PermissionGroupEnum.UPDATE,
29
37
  },
30
38
  [office_location_action_enum_1.OfficeLocationActionEnum.ACTIVATE]: {
31
39
  reachableStatues: [office_location_status_enum_1.OfficeLocationStatusEnum.APPROVED],
32
40
  permissions: OFFICE_LOCATION_ACTIVATE_PERMISSION,
41
+ group: permission_group_enum_1.PermissionGroupEnum.UPDATE,
33
42
  },
34
43
  [office_location_action_enum_1.OfficeLocationActionEnum.RESTORE]: {
35
44
  reachableStatues: [office_location_status_enum_1.OfficeLocationStatusEnum.APPROVED],
36
45
  permissions: OFFICE_LOCATION_RESTORE_PERMISSION,
46
+ group: permission_group_enum_1.PermissionGroupEnum.UPDATE,
37
47
  },
38
48
  };
39
- const { createActionConfig } = (0, base_flow_config_factory_1.createFlowConfigFactory)()(ACTION_MAP);
49
+ const { createActionConfig } = (0, base_flow_config_factory_1.createFlowConfigFactory)()(exports.ACTION_MAP);
40
50
  // APPROVED status transitions
41
51
  const transitionApprovedStatusUpdateAction = createActionConfig(office_location_action_enum_1.OfficeLocationActionEnum.UPDATE, office_location_status_enum_1.OfficeLocationStatusEnum.APPROVED);
42
52
  const transitionApprovedStatusDeleteAction = createActionConfig(office_location_action_enum_1.OfficeLocationActionEnum.DELETE, office_location_status_enum_1.OfficeLocationStatusEnum.DELETED);
@@ -37,6 +37,38 @@ export declare const enumToActionMap: {
37
37
  group: PermissionGroupEnum.UPDATE;
38
38
  };
39
39
  };
40
+ office_location: {
41
+ CREATE: {
42
+ reachableStatues: readonly [import("../..").OfficeLocationStatusEnum.APPROVED];
43
+ permissions: string[];
44
+ group: PermissionGroupEnum.CREATE;
45
+ };
46
+ UPDATE: {
47
+ reachableStatues: readonly [import("../..").OfficeLocationStatusEnum.APPROVED];
48
+ permissions: string[];
49
+ group: PermissionGroupEnum.UPDATE;
50
+ };
51
+ DELETE: {
52
+ reachableStatues: readonly [import("../..").OfficeLocationStatusEnum.DELETED];
53
+ permissions: string[];
54
+ group: PermissionGroupEnum.DELETE;
55
+ };
56
+ DEACTIVATE: {
57
+ reachableStatues: readonly [import("../..").OfficeLocationStatusEnum.DEACTIVATED];
58
+ permissions: string[];
59
+ group: PermissionGroupEnum.UPDATE;
60
+ };
61
+ ACTIVATE: {
62
+ reachableStatues: readonly [import("../..").OfficeLocationStatusEnum.APPROVED];
63
+ permissions: string[];
64
+ group: PermissionGroupEnum.UPDATE;
65
+ };
66
+ RESTORE: {
67
+ reachableStatues: readonly [import("../..").OfficeLocationStatusEnum.APPROVED];
68
+ permissions: string[];
69
+ group: PermissionGroupEnum.UPDATE;
70
+ };
71
+ };
40
72
  work_from_home: {
41
73
  CREATE: {
42
74
  reachableStatues: readonly [import("../..").WorkFromHomeStatusEnum.CREATE_APPROVAL_PENDING];
@@ -5,6 +5,7 @@ const error_key_enum_1 = require("../../../enums/error.key.enum");
5
5
  const exceptions_1 = require("../../../exceptions");
6
6
  const entity_utils_interface_1 = require("../../interface/entity.utils.interface");
7
7
  const expense_type_flow_config_1 = require("../expense_type_flow.config");
8
+ const office_location_flow_config_1 = require("../office_location_flow.config");
8
9
  const work_from_home_flow_config_1 = require("../work_from_home_flow.config");
9
10
  /**
10
11
  * Registry of per-entity action maps; each value is the whole ACTION_MAP that entity's flow config exports
@@ -13,6 +14,7 @@ const work_from_home_flow_config_1 = require("../work_from_home_flow.config");
13
14
  */
14
15
  exports.enumToActionMap = {
15
16
  [entity_utils_interface_1.EntityEnum.EXPENSE_TYPE]: expense_type_flow_config_1.ACTION_MAP,
17
+ [entity_utils_interface_1.EntityEnum.OFFICE_LOCATION]: office_location_flow_config_1.ACTION_MAP,
16
18
  [entity_utils_interface_1.EntityEnum.WORK_FROM_HOME]: work_from_home_flow_config_1.ACTION_MAP,
17
19
  };
18
20
  class FlowConfigUtils {
@@ -62,7 +62,7 @@ export * from "./enums/billing_status_enum";
62
62
  export * from "./enums/billing_timesheet_change_status_enum";
63
63
  export * from "./enums/office_location_action_enum";
64
64
  export * from "./enums/office_location_status_enum";
65
- export * from "./flow-configs/office_location_flow.config";
65
+ export { IOfficeLocationFlowConfigContextData, ACTION_MAP as OFFICE_LOCATION_ACTION_MAP, officeLocationFlowConfig } from "./flow-configs/office_location_flow.config";
66
66
  export * from "./interface/office_location.entity.interface";
67
67
  export * from "./interface/field-constraint/office_location_field_constraints.interface";
68
68
  export * from "./interface/bank.entity.interface";
@@ -411,3 +411,4 @@ export * from "./enums/user_gender_enum";
411
411
  export * from "./enums/user_role_enum";
412
412
  export * from "./enums/user_status_enum";
413
413
  export * from "./flow-configs/utils/flow-config.utils";
414
+ export * from "./interface/field-constraint/office_location_address_field_constraints.interface";
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.workFromHomeFlowConfig = exports.WORK_FROM_HOME_ACTION_MAP = void 0;
17
+ exports.workFromHomeFlowConfig = exports.WORK_FROM_HOME_ACTION_MAP = exports.officeLocationFlowConfig = exports.OFFICE_LOCATION_ACTION_MAP = void 0;
18
18
  __exportStar(require("./enums/organization_action_enum"), exports);
19
19
  __exportStar(require("./enums/organization_status_enum"), exports);
20
20
  __exportStar(require("./flow-configs/organization_flow.config"), exports);
@@ -79,7 +79,9 @@ __exportStar(require("./enums/billing_status_enum"), exports);
79
79
  __exportStar(require("./enums/billing_timesheet_change_status_enum"), exports);
80
80
  __exportStar(require("./enums/office_location_action_enum"), exports);
81
81
  __exportStar(require("./enums/office_location_status_enum"), exports);
82
- __exportStar(require("./flow-configs/office_location_flow.config"), exports);
82
+ var office_location_flow_config_1 = require("./flow-configs/office_location_flow.config");
83
+ Object.defineProperty(exports, "OFFICE_LOCATION_ACTION_MAP", { enumerable: true, get: function () { return office_location_flow_config_1.ACTION_MAP; } });
84
+ Object.defineProperty(exports, "officeLocationFlowConfig", { enumerable: true, get: function () { return office_location_flow_config_1.officeLocationFlowConfig; } });
83
85
  __exportStar(require("./interface/office_location.entity.interface"), exports);
84
86
  __exportStar(require("./interface/field-constraint/office_location_field_constraints.interface"), exports);
85
87
  __exportStar(require("./interface/bank.entity.interface"), exports);
@@ -431,3 +433,4 @@ __exportStar(require("./enums/user_gender_enum"), exports);
431
433
  __exportStar(require("./enums/user_role_enum"), exports);
432
434
  __exportStar(require("./enums/user_status_enum"), exports);
433
435
  __exportStar(require("./flow-configs/utils/flow-config.utils"), exports);
436
+ __exportStar(require("./interface/field-constraint/office_location_address_field_constraints.interface"), exports);
@@ -0,0 +1,13 @@
1
+ import { IOfficeLocationAddress } from "../../../api/v2";
2
+ import { IEntityAuditColumn } from "../entity-audit-columns.interface";
3
+ import { IFieldMinMaxConstraint } from "./utils";
4
+ export type IOfficeLocationAddressFieldLengthConstraintsExclude = keyof IEntityAuditColumn;
5
+ /**
6
+ * since some fields are optional, but we still need their
7
+ * min & max length constraints, we need to make them required in this type
8
+ * hence we are using -? to make all properties required in this type
9
+ */
10
+ export type IOfficeLocationAddressFieldMinMaxConstraints = {
11
+ [K in keyof Omit<IOfficeLocationAddress, IOfficeLocationAddressFieldLengthConstraintsExclude>]-?: IFieldMinMaxConstraint;
12
+ };
13
+ export declare const officeLocationAddressFieldMinMaxConstraints: IOfficeLocationAddressFieldMinMaxConstraints;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.officeLocationAddressFieldMinMaxConstraints = void 0;
4
+ exports.officeLocationAddressFieldMinMaxConstraints = {
5
+ addressLine1: {
6
+ max: 64,
7
+ },
8
+ addressLine2: {
9
+ max: 64,
10
+ },
11
+ city: {
12
+ max: 32,
13
+ },
14
+ state: {
15
+ max: 64,
16
+ },
17
+ };
@@ -1,15 +1,6 @@
1
1
  import { IEntityAuditColumn } from "../entity-audit-columns.interface";
2
2
  import { IOfficeLocationEntity } from "../office_location.entity.interface";
3
3
  import { IFieldMinMaxConstraint } from "./utils";
4
- /**
5
- * excluded, and why:
6
- * - "id", keyof IEntityAuditColumn generated columns
7
- * - "status" enum column driven by the entity flow — bounded by its allowed
8
- * values, not by a character length
9
- *
10
- * OfficeLocationUpdateDto is a standalone class rather than a PartialType of the create DTO, so the
11
- * two can and do disagree — see the note on `address` below
12
- */
13
4
  export type IOfficeLocationFieldLengthConstraintsExclude = "status" | "id" | keyof IEntityAuditColumn;
14
5
  /**
15
6
  * since some fields are optional, but we still need their
@@ -6,23 +6,14 @@ exports.officeLocationFieldMinMaxConstraints = {
6
6
  min: 3,
7
7
  max: 128,
8
8
  },
9
- /**
10
- * the column is varchar(1024) and the update DTO agrees, but the create DTO caps it at
11
- * @MaxLength(255) — the create bound stays as a literal, reconciling the two is step-4 material
12
- */
9
+ country: {
10
+ max: 128,
11
+ },
13
12
  address: {
14
13
  max: 1024,
15
14
  },
16
- /**
17
- * NOT a numeric bound: the property is typed `number` but the column is varchar(64), so 64 is the
18
- * stored string length. Neither DTO bounds it, and it is deliberately left unwired there —
19
- * the number/varchar mismatch is step-4 material
20
- */
21
15
  zipCode: {
22
- max: 64,
23
- },
24
- country: {
25
- max: 128,
16
+ max: 9999999,
26
17
  },
27
18
  organizationId: {
28
19
  max: 9999999,
@@ -1,29 +1,85 @@
1
- import { OfficeLocationActionEnum } from "../enums/office_location_action_enum";
2
- import { IOfficeLocationFlowConfigContextData } from "../flow-configs/office_location_flow.config";
1
+ import { EntityEnum } from "../interface/entity.utils.interface";
2
+ import { RelationConfigs } from "../interface/relation-config.interface";
3
3
  import { IUserEntity } from "../interface/user.entity.interface";
4
+ import { BaseEntityModel } from "./base.entity.model";
4
5
  import { IRowActions } from "./interface/row-actions.interface";
5
6
  import { UserEntityModel } from "./user.entity.model";
7
+ import { OfficeLocationActionEnum } from "../../entities";
6
8
  import { OfficeLocationStatusEnum } from "../enums/office_location_status_enum";
7
- import { EntityEnum } from "../interface/entity.utils.interface";
9
+ import { IOfficeLocationFlowConfigContextData } from "../flow-configs/office_location_flow.config";
8
10
  import { IOfficeLocationEntity } from "../interface/office_location.entity.interface";
9
- import { RelationConfigs } from "../interface/relation-config.interface";
10
- import { BaseEntityModel } from "./base.entity.model";
11
+ import { BankEntityModel } from "./bank.entity.model";
12
+ import { BillingEntityModel } from "./billing.entity.model";
13
+ import { ClientEntityModel } from "./client.entity.model";
14
+ import { ClientAffiliateEntityModel } from "./client_affiliate.entity.model";
15
+ import { ClientDebitNoteEntityModel } from "./client_debit_note.entity.model";
16
+ import { ClientDebitNoteParticularsEntityModel } from "./client_debit_note_particulars.entity.model";
17
+ import { CountryEntityModel } from "./country.entity.model";
18
+ import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
19
+ import { GstRateEntityModel } from "./gst_rate.entity.model";
20
+ import { IntermediaryBankEntityModel } from "./intermediary_bank.entity.model";
21
+ import { LeaveEntityModel } from "./leave.entity.model";
22
+ import { LeaveApprovalEntityModel } from "./leave_approval.entity.model";
23
+ import { OrganizationEntityModel } from "./organization.entity.model";
24
+ import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
25
+ import { ProjectEntityModel } from "./project.entity.model";
26
+ import { StateEntityModel } from "./state.entity.model";
27
+ import { TdsRateEntityModel } from "./tds_rate.entity.model";
28
+ import { ToDoListEntityModel } from "./to_do_list.entity.model";
29
+ import { VendorEntityModel } from "./vendor.entity.model";
30
+ import { VendorAdvanceEntityModel } from "./vendor_advance.entity.model";
31
+ import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
32
+ import { VendorInvoiceAdvanceEntityModel } from "./vendor_invoice_advance.entity.model";
33
+ import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
34
+ import { VendorInvoicePaymentEntityModel } from "./vendor_invoice_payment.entity.model";
35
+ import { VendorTdsChallanEntityModel } from "./vendor_tds_challan.entity.model";
36
+ import { VendorTdsLiabilityEntityModel } from "./vendor_tds_liability.entity.model";
37
+ import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
38
+ import { WorkFromHomeEntityModel } from "./work_from_home.entity.model";
11
39
  export declare class OfficeLocationEntityModel extends BaseEntityModel<EntityEnum.OFFICE_LOCATION> implements IOfficeLocationEntity {
12
40
  id: number;
13
41
  name: string;
14
42
  country: string;
15
- state: string;
16
- address: string;
17
43
  zipCode: number;
44
+ address: string;
18
45
  organizationId: number;
19
46
  status: OfficeLocationStatusEnum;
20
47
  createdOn: number;
21
48
  updatedOn: number;
22
49
  createdBy: number;
23
50
  updatedBy: number;
24
- static relationConfigs: RelationConfigs<[], EntityEnum.OFFICE_LOCATION>;
51
+ organization?: OrganizationEntityModel;
52
+ countryModel?: CountryEntityModel;
53
+ vendorInvoices?: VendorInvoiceEntityModel[];
54
+ static relationConfigs: RelationConfigs<[EntityEnum.ORGANIZATION, EntityEnum.COUNTRY, EntityEnum.VENDOR_INVOICE], EntityEnum.OFFICE_LOCATION>;
25
55
  static fromEntity(entity: IOfficeLocationEntity): OfficeLocationEntityModel;
26
56
  getRelationConfigs(): any[];
57
+ get vendors(): VendorEntityModel[] | undefined;
58
+ get states(): StateEntityModel[] | undefined;
59
+ get organizationTypes(): OrganizationTypeEntityModel[] | undefined;
60
+ get tdsRates(): TdsRateEntityModel[] | undefined;
61
+ get voucherTypes(): VoucherTypeEntityModel[] | undefined;
62
+ get expenseHeads(): ExpenseHeadEntityModel[] | undefined;
63
+ get vendorInvoiceItems(): VendorInvoiceItemEntityModel[] | undefined;
64
+ get gstRates(): GstRateEntityModel[] | undefined;
65
+ get vendorAdvances(): VendorAdvanceEntityModel[] | undefined;
66
+ get vendorInvoiceAdvances(): VendorInvoiceAdvanceEntityModel[] | undefined;
67
+ get vendorTdsLiabilitys(): VendorTdsLiabilityEntityModel[] | undefined;
68
+ get vendorTdsChallans(): VendorTdsChallanEntityModel[] | undefined;
69
+ get banks(): BankEntityModel[] | undefined;
70
+ get clientDebitNotes(): ClientDebitNoteEntityModel[] | undefined;
71
+ get clients(): ClientEntityModel[] | undefined;
72
+ get users(): UserEntityModel[] | undefined;
73
+ get leaveApprovals(): LeaveApprovalEntityModel[] | undefined;
74
+ get leaves(): LeaveEntityModel[] | undefined;
75
+ get workFromHomes(): WorkFromHomeEntityModel[] | undefined;
76
+ get toDoLists(): ToDoListEntityModel[] | undefined;
77
+ get projects(): ProjectEntityModel[] | undefined;
78
+ get clientAffiliates(): ClientAffiliateEntityModel[] | undefined;
79
+ get clientDebitNoteParticularss(): ClientDebitNoteParticularsEntityModel[] | undefined;
80
+ get intermediaryBanks(): IntermediaryBankEntityModel[] | undefined;
81
+ get billings(): BillingEntityModel[] | undefined;
82
+ get vendorInvoicePayments(): VendorInvoicePaymentEntityModel[] | undefined;
27
83
  getNextStatus(currentUser: IUserEntity, action: OfficeLocationActionEnum, officeLocationFlowConfigContextData: IOfficeLocationFlowConfigContextData): OfficeLocationStatusEnum;
28
84
  getAvailableActions(currentUser: UserEntityModel, config?: {
29
85
  combinedActions?: Record<string, {
@@ -4,19 +4,19 @@ exports.OfficeLocationEntityModel = void 0;
4
4
  const error_key_enum_1 = require("../../enums/error.key.enum");
5
5
  const exceptions_1 = require("../../exceptions");
6
6
  const utils_1 = require("../../utils");
7
- const office_location_flow_config_1 = require("../flow-configs/office_location_flow.config");
8
- const office_location_status_enum_1 = require("../enums/office_location_status_enum");
9
7
  const entity_utils_interface_1 = require("../interface/entity.utils.interface");
10
8
  const base_entity_model_1 = require("./base.entity.model");
9
+ const entities_1 = require("../../entities");
10
+ const office_location_status_enum_1 = require("../enums/office_location_status_enum");
11
+ const office_location_flow_config_1 = require("../flow-configs/office_location_flow.config");
11
12
  class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
12
13
  constructor() {
13
14
  super(...arguments);
14
15
  this.id = 0;
15
16
  this.name = "";
16
17
  this.country = "";
17
- this.state = "";
18
- this.address = "";
19
18
  this.zipCode = 0;
19
+ this.address = "";
20
20
  this.organizationId = 0;
21
21
  this.status = office_location_status_enum_1.OfficeLocationStatusEnum.APPROVED;
22
22
  this.createdOn = 0;
@@ -32,6 +32,365 @@ class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
32
32
  getRelationConfigs() {
33
33
  return this.constructor.prototype.constructor.relationConfigs || [];
34
34
  }
35
+ get vendors() {
36
+ // many_to_many -> many_to_many verified
37
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one'}
38
+ // ['office_location', 'vendor_invoice'] -> one_to_many
39
+ // ['vendor_invoice', 'vendor'] -> many_to_one
40
+ var _a;
41
+ return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendor).filter((vendor) => !!vendor).reduce((accumulator, current) => {
42
+ if (!accumulator.some((vendor) => vendor.id === current.id)) {
43
+ accumulator.push(current);
44
+ }
45
+ return accumulator;
46
+ }, []);
47
+ }
48
+ get states() {
49
+ // many_to_one -> many_to_many mismatch
50
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->state': 'many_to_one'}
51
+ // ['vendor_invoice', 'vendor'] -> many_to_one
52
+ // ['vendor', 'state'] -> many_to_one
53
+ var _a;
54
+ return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.stateModel).filter((state) => !!state).reduce((accumulator, current) => {
55
+ if (!accumulator.some((state) => state.id === current.id)) {
56
+ accumulator.push(current);
57
+ }
58
+ return accumulator;
59
+ }, []);
60
+ }
61
+ get organizationTypes() {
62
+ // many_to_one -> many_to_many mismatch
63
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one'}
64
+ // ['vendor_invoice', 'vendor'] -> many_to_one
65
+ // ['vendor', 'organization_type'] -> many_to_one
66
+ var _a;
67
+ return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.organizationType).filter((organizationType) => !!organizationType).reduce((accumulator, current) => {
68
+ if (!accumulator.some((organizationType) => organizationType.id === current.id)) {
69
+ accumulator.push(current);
70
+ }
71
+ return accumulator;
72
+ }, []);
73
+ }
74
+ get tdsRates() {
75
+ // many_to_many -> many_to_many verified
76
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many'}
77
+ // ['vendor', 'organization_type'] -> many_to_one
78
+ // ['organization_type', 'tds_rate'] -> many_to_many
79
+ var _a;
80
+ return (_a = this.organizationTypes) === null || _a === void 0 ? void 0 : _a.flatMap((organizationType) => organizationType.tdsRates).filter((tdsRate) => !!tdsRate).reduce((accumulator, current) => {
81
+ if (!accumulator.some((tdsRate) => tdsRate.id === current.id)) {
82
+ accumulator.push(current);
83
+ }
84
+ return accumulator;
85
+ }, []);
86
+ }
87
+ get voucherTypes() {
88
+ // many_to_many -> many_to_many verified
89
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one'}
90
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
91
+ // ['vendor_invoice_item', 'voucher_type'] -> many_to_one
92
+ var _a;
93
+ return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.voucherType).filter((voucherType) => !!voucherType).reduce((accumulator, current) => {
94
+ if (!accumulator.some((voucherType) => voucherType.id === current.id)) {
95
+ accumulator.push(current);
96
+ }
97
+ return accumulator;
98
+ }, []);
99
+ }
100
+ get expenseHeads() {
101
+ // many_to_many -> many_to_many verified
102
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->expense_head': 'many_to_one'}
103
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
104
+ // ['vendor_invoice_item', 'expense_head'] -> many_to_one
105
+ var _a;
106
+ return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.expenseHead).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
107
+ if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
108
+ accumulator.push(current);
109
+ }
110
+ return accumulator;
111
+ }, []);
112
+ }
113
+ get vendorInvoiceItems() {
114
+ // one_to_many -> one_to_many verified
115
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many'}
116
+ // ['office_location', 'vendor_invoice'] -> one_to_many
117
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
118
+ var _a;
119
+ return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoiceItems).filter((vendorInvoiceItem) => !!vendorInvoiceItem).reduce((accumulator, current) => {
120
+ if (!accumulator.some((vendorInvoiceItem) => vendorInvoiceItem.id === current.id)) {
121
+ accumulator.push(current);
122
+ }
123
+ return accumulator;
124
+ }, []);
125
+ }
126
+ get gstRates() {
127
+ // many_to_many -> many_to_many verified
128
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
129
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
130
+ // ['vendor_invoice_item', 'gst_rate'] -> many_to_one
131
+ var _a;
132
+ return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
133
+ if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
134
+ accumulator.push(current);
135
+ }
136
+ return accumulator;
137
+ }, []);
138
+ }
139
+ get vendorAdvances() {
140
+ // many_to_many -> many_to_many verified
141
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->vendor_advance': 'one_to_many'}
142
+ // ['vendor_invoice', 'vendor'] -> many_to_one
143
+ // ['vendor', 'vendor_advance'] -> one_to_many
144
+ var _a;
145
+ return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorAdvances).filter((vendorAdvance) => !!vendorAdvance).reduce((accumulator, current) => {
146
+ if (!accumulator.some((vendorAdvance) => vendorAdvance.id === current.id)) {
147
+ accumulator.push(current);
148
+ }
149
+ return accumulator;
150
+ }, []);
151
+ }
152
+ get vendorInvoiceAdvances() {
153
+ // many_to_many -> many_to_many verified
154
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->vendor_invoice_advance': 'one_to_many'}
155
+ // ['vendor_invoice', 'vendor'] -> many_to_one
156
+ // ['vendor', 'vendor_invoice_advance'] -> one_to_many
157
+ var _a;
158
+ return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorInvoiceAdvances).filter((vendorInvoiceAdvance) => !!vendorInvoiceAdvance).reduce((accumulator, current) => {
159
+ if (!accumulator.some((vendorInvoiceAdvance) => vendorInvoiceAdvance.id === current.id)) {
160
+ accumulator.push(current);
161
+ }
162
+ return accumulator;
163
+ }, []);
164
+ }
165
+ get vendorTdsLiabilitys() {
166
+ // many_to_many -> many_to_many verified
167
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_liability': 'one_to_many'}
168
+ // ['organization_type', 'tds_rate'] -> many_to_many
169
+ // ['tds_rate', 'vendor_tds_liability'] -> one_to_many
170
+ var _a;
171
+ return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsLiabilitys).filter((vendorTdsLiability) => !!vendorTdsLiability).reduce((accumulator, current) => {
172
+ if (!accumulator.some((vendorTdsLiability) => vendorTdsLiability.id === current.id)) {
173
+ accumulator.push(current);
174
+ }
175
+ return accumulator;
176
+ }, []);
177
+ }
178
+ get vendorTdsChallans() {
179
+ // many_to_many -> many_to_many verified
180
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many'}
181
+ // ['organization_type', 'tds_rate'] -> many_to_many
182
+ // ['tds_rate', 'vendor_tds_challan'] -> one_to_many
183
+ var _a;
184
+ return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsChallans).filter((vendorTdsChallan) => !!vendorTdsChallan).reduce((accumulator, current) => {
185
+ if (!accumulator.some((vendorTdsChallan) => vendorTdsChallan.id === current.id)) {
186
+ accumulator.push(current);
187
+ }
188
+ return accumulator;
189
+ }, []);
190
+ }
191
+ get banks() {
192
+ // many_to_many -> many_to_many verified
193
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one'}
194
+ // ['tds_rate', 'vendor_tds_challan'] -> one_to_many
195
+ // ['vendor_tds_challan', 'bank'] -> many_to_one
196
+ var _a;
197
+ return (_a = this.vendorTdsChallans) === null || _a === void 0 ? void 0 : _a.flatMap((vendorTdsChallan) => vendorTdsChallan.bank).filter((bank) => !!bank).reduce((accumulator, current) => {
198
+ if (!accumulator.some((bank) => bank.id === current.id)) {
199
+ accumulator.push(current);
200
+ }
201
+ return accumulator;
202
+ }, []);
203
+ }
204
+ get clientDebitNotes() {
205
+ // many_to_many -> many_to_many verified
206
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many'}
207
+ // ['vendor_tds_challan', 'bank'] -> many_to_one
208
+ // ['bank', 'client_debit_note'] -> one_to_many
209
+ // return this.banks
210
+ // ?.flatMap((bank) => bank.clientDebitNotes)
211
+ // .filter((clientDebitNote): clientDebitNote is ClientDebitNoteEntityModel => !!clientDebitNote)
212
+ // .reduce((accumulator: ClientDebitNoteEntityModel[], current) => {
213
+ // if (!accumulator.some((clientDebitNote) => clientDebitNote.id === current.id)) {
214
+ // accumulator.push(current);
215
+ // }
216
+ // return accumulator;
217
+ // }, []);
218
+ return undefined;
219
+ }
220
+ get clients() {
221
+ // many_to_many -> many_to_many verified
222
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one'}
223
+ // ['bank', 'client_debit_note'] -> one_to_many
224
+ // ['client_debit_note', 'client'] -> many_to_one
225
+ var _a;
226
+ return (_a = this.clientDebitNotes) === null || _a === void 0 ? void 0 : _a.flatMap((clientDebitNote) => clientDebitNote.client).filter((client) => !!client).reduce((accumulator, current) => {
227
+ if (!accumulator.some((client) => client.id === current.id)) {
228
+ accumulator.push(current);
229
+ }
230
+ return accumulator;
231
+ }, []);
232
+ }
233
+ get users() {
234
+ // many_to_many -> many_to_many verified
235
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many'}
236
+ // ['client_debit_note', 'client'] -> many_to_one
237
+ // ['client', 'user'] -> many_to_many
238
+ // return this.clients
239
+ // ?.flatMap((client) => client.users)
240
+ // .filter((user): user is UserEntityModel => !!user)
241
+ // .reduce((accumulator: UserEntityModel[], current) => {
242
+ // if (!accumulator.some((user) => user.id === current.id)) {
243
+ // accumulator.push(current);
244
+ // }
245
+ // return accumulator;
246
+ // }, []);
247
+ return undefined;
248
+ }
249
+ get leaveApprovals() {
250
+ // many_to_many -> many_to_many verified
251
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many', 'user->leave_approval': 'one_to_many'}
252
+ // ['client', 'user'] -> many_to_many
253
+ // ['user', 'leave_approval'] -> one_to_many
254
+ // return this.users
255
+ // ?.flatMap((user) => user.leaveApprovals)
256
+ // .filter((leaveApproval): leaveApproval is LeaveApprovalEntityModel => !!leaveApproval)
257
+ // .reduce((accumulator: LeaveApprovalEntityModel[], current) => {
258
+ // if (!accumulator.some((leaveApproval) => leaveApproval.id === current.id)) {
259
+ // accumulator.push(current);
260
+ // }
261
+ // return accumulator;
262
+ // }, []);
263
+ return undefined;
264
+ }
265
+ get leaves() {
266
+ // many_to_many -> many_to_many verified
267
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many', 'user->leave_approval': 'one_to_many', 'leave_approval->leave': 'many_to_one'}
268
+ // ['user', 'leave_approval'] -> one_to_many
269
+ // ['leave_approval', 'leave'] -> many_to_one
270
+ var _a;
271
+ return (_a = this.leaveApprovals) === null || _a === void 0 ? void 0 : _a.flatMap((leaveApproval) => leaveApproval.leave).filter((leave) => !!leave).reduce((accumulator, current) => {
272
+ if (!accumulator.some((leave) => leave.id === current.id)) {
273
+ accumulator.push(current);
274
+ }
275
+ return accumulator;
276
+ }, []);
277
+ }
278
+ get workFromHomes() {
279
+ // many_to_many -> many_to_many verified
280
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many', 'user->work_from_home': 'one_to_many'}
281
+ // ['client', 'user'] -> many_to_many
282
+ // ['user', 'work_from_home'] -> one_to_many
283
+ // return this.users
284
+ // ?.flatMap((user) => user.workFromHomes)
285
+ // .filter((workFromHome): workFromHome is WorkFromHomeEntityModel => !!workFromHome)
286
+ // .reduce((accumulator: WorkFromHomeEntityModel[], current) => {
287
+ // if (!accumulator.some((workFromHome) => workFromHome.id === current.id)) {
288
+ // accumulator.push(current);
289
+ // }
290
+ // return accumulator;
291
+ // }, []);
292
+ return undefined;
293
+ }
294
+ get toDoLists() {
295
+ // many_to_many -> many_to_many verified
296
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many', 'user->to_do_list': 'one_to_many'}
297
+ // ['client', 'user'] -> many_to_many
298
+ // ['user', 'to_do_list'] -> one_to_many
299
+ // return this.users
300
+ // ?.flatMap((user) => user.toDoLists)
301
+ // .filter((toDoList): toDoList is ToDoListEntityModel => !!toDoList)
302
+ // .reduce((accumulator: ToDoListEntityModel[], current) => {
303
+ // if (!accumulator.some((toDoList) => toDoList.id === current.id)) {
304
+ // accumulator.push(current);
305
+ // }
306
+ // return accumulator;
307
+ // }, []);
308
+ return undefined;
309
+ }
310
+ get projects() {
311
+ // many_to_many -> many_to_many verified
312
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client': 'many_to_one', 'client->user': 'many_to_many', 'user->to_do_list': 'one_to_many', 'to_do_list->project': 'many_to_one'}
313
+ // ['user', 'to_do_list'] -> one_to_many
314
+ // ['to_do_list', 'project'] -> many_to_one
315
+ var _a;
316
+ return (_a = this.toDoLists) === null || _a === void 0 ? void 0 : _a.flatMap((toDoList) => toDoList.project).filter((project) => !!project).reduce((accumulator, current) => {
317
+ if (!accumulator.some((project) => project.id === current.id)) {
318
+ accumulator.push(current);
319
+ }
320
+ return accumulator;
321
+ }, []);
322
+ }
323
+ get clientAffiliates() {
324
+ // many_to_many -> many_to_many verified
325
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client_affiliate': 'many_to_one'}
326
+ // ['bank', 'client_debit_note'] -> one_to_many
327
+ // ['client_debit_note', 'client_affiliate'] -> many_to_one
328
+ var _a;
329
+ return (_a = this.clientDebitNotes) === null || _a === void 0 ? void 0 : _a.flatMap((clientDebitNote) => clientDebitNote.clientAffiliate).filter((clientAffiliate) => !!clientAffiliate).reduce((accumulator, current) => {
330
+ if (!accumulator.some((clientAffiliate) => clientAffiliate.id === current.id)) {
331
+ accumulator.push(current);
332
+ }
333
+ return accumulator;
334
+ }, []);
335
+ }
336
+ get clientDebitNoteParticularss() {
337
+ // one_to_many -> many_to_many mismatch
338
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->client_debit_note': 'one_to_many', 'client_debit_note->client_debit_note_particulars': 'one_to_many'}
339
+ // ['bank', 'client_debit_note'] -> one_to_many
340
+ // ['client_debit_note', 'client_debit_note_particulars'] -> one_to_many
341
+ // return this.clientDebitNotes
342
+ // ?.flatMap((clientDebitNote) => clientDebitNote.clientDebitNoteParticulars)
343
+ // .filter((clientDebitNoteParticulars): clientDebitNoteParticulars is ClientDebitNoteParticularsEntityModel => !!clientDebitNoteParticulars)
344
+ // .reduce((accumulator: ClientDebitNoteParticularsEntityModel[], current) => {
345
+ // if (!accumulator.some((clientDebitNoteParticulars) => clientDebitNoteParticulars.id === current.id)) {
346
+ // accumulator.push(current);
347
+ // }
348
+ // return accumulator;
349
+ // }, []);
350
+ return undefined;
351
+ }
352
+ get intermediaryBanks() {
353
+ // many_to_many -> many_to_many verified
354
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->intermediary_bank': 'one_to_many'}
355
+ // ['vendor_tds_challan', 'bank'] -> many_to_one
356
+ // ['bank', 'intermediary_bank'] -> one_to_many
357
+ var _a;
358
+ return (_a = this.banks) === null || _a === void 0 ? void 0 : _a.flatMap((bank) => bank.intermediaryBanks).filter((intermediaryBank) => !!intermediaryBank).reduce((accumulator, current) => {
359
+ if (!accumulator.some((intermediaryBank) => intermediaryBank.id === current.id)) {
360
+ accumulator.push(current);
361
+ }
362
+ return accumulator;
363
+ }, []);
364
+ }
365
+ get billings() {
366
+ // many_to_many -> many_to_many verified
367
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one', 'organization_type->tds_rate': 'many_to_many', 'tds_rate->vendor_tds_challan': 'one_to_many', 'vendor_tds_challan->bank': 'many_to_one', 'bank->billing': 'one_to_many'}
368
+ // ['vendor_tds_challan', 'bank'] -> many_to_one
369
+ // ['bank', 'billing'] -> one_to_many
370
+ // return this.banks
371
+ // ?.flatMap((bank) => bank.billings)
372
+ // .filter((billing): billing is BillingEntityModel => !!billing)
373
+ // .reduce((accumulator: BillingEntityModel[], current) => {
374
+ // if (!accumulator.some((billing) => billing.id === current.id)) {
375
+ // accumulator.push(current);
376
+ // }
377
+ // return accumulator;
378
+ // }, []);
379
+ return undefined;
380
+ }
381
+ get vendorInvoicePayments() {
382
+ // one_to_many -> one_to_many verified
383
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_payment': 'one_to_many'}
384
+ // ['office_location', 'vendor_invoice'] -> one_to_many
385
+ // ['vendor_invoice', 'vendor_invoice_payment'] -> one_to_many
386
+ var _a;
387
+ return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoicePayments).filter((vendorInvoicePayment) => !!vendorInvoicePayment).reduce((accumulator, current) => {
388
+ if (!accumulator.some((vendorInvoicePayment) => vendorInvoicePayment.id === current.id)) {
389
+ accumulator.push(current);
390
+ }
391
+ return accumulator;
392
+ }, []);
393
+ }
35
394
  getNextStatus(currentUser, action, officeLocationFlowConfigContextData) {
36
395
  if (!this.status) {
37
396
  throw new exceptions_1.AppBadRequestException({
@@ -69,7 +428,7 @@ class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
69
428
  if (!hasPermission) {
70
429
  throw new exceptions_1.AppBadRequestException({
71
430
  key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
72
- message: [`Current user does not have permission to ${action} office location`],
431
+ message: [`Current user does not have permission to ${action} officeLocation`],
73
432
  });
74
433
  }
75
434
  const nextStatus = matchingPermissionConfig.next(officeLocationFlowConfigContextData);
@@ -92,4 +451,32 @@ class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
92
451
  }
93
452
  }
94
453
  exports.OfficeLocationEntityModel = OfficeLocationEntityModel;
95
- OfficeLocationEntityModel.relationConfigs = [];
454
+ OfficeLocationEntityModel.relationConfigs = [
455
+ {
456
+ name: entity_utils_interface_1.EntityEnum.ORGANIZATION,
457
+ relation: entities_1.RelationType.ONE,
458
+ key: "organization",
459
+ mapKeyConfig: {
460
+ relationKey: "id",
461
+ key: "organizationId",
462
+ },
463
+ },
464
+ {
465
+ name: entity_utils_interface_1.EntityEnum.COUNTRY,
466
+ relation: entities_1.RelationType.ONE,
467
+ key: "country",
468
+ mapKeyConfig: {
469
+ relationKey: "name",
470
+ key: "country",
471
+ },
472
+ },
473
+ {
474
+ name: entity_utils_interface_1.EntityEnum.VENDOR_INVOICE,
475
+ relation: entities_1.RelationType.MANY,
476
+ key: "vendorInvoices",
477
+ mapKeyConfig: {
478
+ relationKey: "serviceLocationId",
479
+ key: "id",
480
+ },
481
+ },
482
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "14.1.4-beta.0",
3
+ "version": "14.1.4-beta.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [