law-common 14.1.4-beta.8 → 14.1.4-beta.9

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 +66 -8
  24. package/dist/src/entities/model/office_location.entity.model.js +405 -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
  }
@@ -9,5 +9,7 @@ export * from "./interface/to_do_list.create.dto.interface";
9
9
  export * from "./interface/to_do_list.update.dto.interface";
10
10
  export * from "./interface/expense_type.create.dto.interface";
11
11
  export * from "./interface/expense_type.update.dto.interface";
12
+ export * from "./interface/office_location.create.dto.interface";
13
+ export * from "./interface/office_location.update.dto.interface";
12
14
  export * from "./interface/task.create.dto.interface";
13
15
  export * from "./interface/task.update.dto.interface";
@@ -25,5 +25,7 @@ __exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
25
25
  __exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
26
26
  __exportStar(require("./interface/expense_type.create.dto.interface"), exports);
27
27
  __exportStar(require("./interface/expense_type.update.dto.interface"), exports);
28
+ __exportStar(require("./interface/office_location.create.dto.interface"), exports);
29
+ __exportStar(require("./interface/office_location.update.dto.interface"), exports);
28
30
  __exportStar(require("./interface/task.create.dto.interface"), exports);
29
31
  __exportStar(require("./interface/task.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
  const country_flow_config_1 = require("../country_flow.config");
10
11
  const industry_flow_config_1 = require("../industry_flow.config");
@@ -19,6 +20,7 @@ const to_do_list_flow_config_1 = require("../to_do_list_flow.config");
19
20
  */
20
21
  exports.enumToActionMap = {
21
22
  [entity_utils_interface_1.EntityEnum.EXPENSE_TYPE]: expense_type_flow_config_1.ACTION_MAP,
23
+ [entity_utils_interface_1.EntityEnum.OFFICE_LOCATION]: office_location_flow_config_1.ACTION_MAP,
22
24
  [entity_utils_interface_1.EntityEnum.WORK_FROM_HOME]: work_from_home_flow_config_1.ACTION_MAP,
23
25
  [entity_utils_interface_1.EntityEnum.COUNTRY]: country_flow_config_1.ACTION_MAP,
24
26
  [entity_utils_interface_1.EntityEnum.INDUSTRY]: industry_flow_config_1.ACTION_MAP,
@@ -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 = exports.rateFlowConfig = exports.RATE_ACTION_MAP = exports.designationFlowConfig = exports.DESIGNATION_ACTION_MAP = exports.taskFlowConfig = exports.TASK_ACTION_MAP = exports.industryFlowConfig = exports.INDUSTRY_ACTION_MAP = exports.toDoListFlowConfig = exports.TO_DO_LIST_ACTION_MAP = exports.countryFlowConfig = exports.COUNTRY_ACTION_MAP = void 0;
17
+ exports.workFromHomeFlowConfig = exports.WORK_FROM_HOME_ACTION_MAP = exports.rateFlowConfig = exports.RATE_ACTION_MAP = exports.designationFlowConfig = exports.DESIGNATION_ACTION_MAP = exports.taskFlowConfig = exports.TASK_ACTION_MAP = exports.industryFlowConfig = exports.INDUSTRY_ACTION_MAP = exports.toDoListFlowConfig = exports.TO_DO_LIST_ACTION_MAP = exports.countryFlowConfig = exports.COUNTRY_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);
@@ -443,3 +445,4 @@ __exportStar(require("./enums/user_gender_enum"), exports);
443
445
  __exportStar(require("./enums/user_role_enum"), exports);
444
446
  __exportStar(require("./enums/user_status_enum"), exports);
445
447
  __exportStar(require("./flow-configs/utils/flow-config.utils"), exports);
448
+ __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,87 @@
1
- import { OfficeLocationActionEnum } from "../enums/office_location_action_enum";
2
- import { IOfficeLocationFlowConfigContextData } from "../flow-configs/office_location_flow.config";
1
+ import type { IOfficeLocationAddress } from "../../api/v2";
2
+ import { EntityEnum } from "../interface/entity.utils.interface";
3
+ import { RelationConfigs } from "../interface/relation-config.interface";
3
4
  import { IUserEntity } from "../interface/user.entity.interface";
5
+ import { BaseEntityModel } from "./base.entity.model";
4
6
  import { IRowActions } from "./interface/row-actions.interface";
5
7
  import { UserEntityModel } from "./user.entity.model";
8
+ import { OfficeLocationActionEnum } from "../../entities";
6
9
  import { OfficeLocationStatusEnum } from "../enums/office_location_status_enum";
7
- import { EntityEnum } from "../interface/entity.utils.interface";
10
+ import { IOfficeLocationFlowConfigContextData } from "../flow-configs/office_location_flow.config";
8
11
  import { IOfficeLocationEntity } from "../interface/office_location.entity.interface";
9
- import { RelationConfigs } from "../interface/relation-config.interface";
10
- import { BaseEntityModel } from "./base.entity.model";
12
+ import { BankEntityModel } from "./bank.entity.model";
13
+ import { BillingEntityModel } from "./billing.entity.model";
14
+ import { ClientEntityModel } from "./client.entity.model";
15
+ import { ClientAffiliateEntityModel } from "./client_affiliate.entity.model";
16
+ import { ClientDebitNoteEntityModel } from "./client_debit_note.entity.model";
17
+ import { ClientDebitNoteParticularsEntityModel } from "./client_debit_note_particulars.entity.model";
18
+ import { CountryEntityModel } from "./country.entity.model";
19
+ import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
20
+ import { GstRateEntityModel } from "./gst_rate.entity.model";
21
+ import { IntermediaryBankEntityModel } from "./intermediary_bank.entity.model";
22
+ import { LeaveEntityModel } from "./leave.entity.model";
23
+ import { LeaveApprovalEntityModel } from "./leave_approval.entity.model";
24
+ import { OrganizationEntityModel } from "./organization.entity.model";
25
+ import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
26
+ import { ProjectEntityModel } from "./project.entity.model";
27
+ import { StateEntityModel } from "./state.entity.model";
28
+ import { TdsRateEntityModel } from "./tds_rate.entity.model";
29
+ import { ToDoListEntityModel } from "./to_do_list.entity.model";
30
+ import { VendorEntityModel } from "./vendor.entity.model";
31
+ import { VendorAdvanceEntityModel } from "./vendor_advance.entity.model";
32
+ import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
33
+ import { VendorInvoiceAdvanceEntityModel } from "./vendor_invoice_advance.entity.model";
34
+ import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
35
+ import { VendorInvoicePaymentEntityModel } from "./vendor_invoice_payment.entity.model";
36
+ import { VendorTdsChallanEntityModel } from "./vendor_tds_challan.entity.model";
37
+ import { VendorTdsLiabilityEntityModel } from "./vendor_tds_liability.entity.model";
38
+ import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
39
+ import { WorkFromHomeEntityModel } from "./work_from_home.entity.model";
11
40
  export declare class OfficeLocationEntityModel extends BaseEntityModel<EntityEnum.OFFICE_LOCATION> implements IOfficeLocationEntity {
12
41
  id: number;
13
42
  name: string;
14
43
  country: string;
15
- state: string;
16
- address: string;
17
44
  zipCode: number;
45
+ address: string;
18
46
  organizationId: number;
19
47
  status: OfficeLocationStatusEnum;
20
48
  createdOn: number;
21
49
  updatedOn: number;
22
50
  createdBy: number;
23
51
  updatedBy: number;
24
- static relationConfigs: RelationConfigs<[], EntityEnum.OFFICE_LOCATION>;
52
+ organization?: OrganizationEntityModel;
53
+ countryModel?: CountryEntityModel;
54
+ vendorInvoices?: VendorInvoiceEntityModel[];
55
+ static relationConfigs: RelationConfigs<[EntityEnum.ORGANIZATION, EntityEnum.COUNTRY, EntityEnum.VENDOR_INVOICE], EntityEnum.OFFICE_LOCATION>;
25
56
  static fromEntity(entity: IOfficeLocationEntity): OfficeLocationEntityModel;
57
+ static parseAddress(value: string): IOfficeLocationAddress;
26
58
  getRelationConfigs(): any[];
59
+ get vendors(): VendorEntityModel[] | undefined;
60
+ get states(): StateEntityModel[] | undefined;
61
+ get organizationTypes(): OrganizationTypeEntityModel[] | undefined;
62
+ get tdsRates(): TdsRateEntityModel[] | undefined;
63
+ get voucherTypes(): VoucherTypeEntityModel[] | undefined;
64
+ get expenseHeads(): ExpenseHeadEntityModel[] | undefined;
65
+ get vendorInvoiceItems(): VendorInvoiceItemEntityModel[] | undefined;
66
+ get gstRates(): GstRateEntityModel[] | undefined;
67
+ get vendorAdvances(): VendorAdvanceEntityModel[] | undefined;
68
+ get vendorInvoiceAdvances(): VendorInvoiceAdvanceEntityModel[] | undefined;
69
+ get vendorTdsLiabilitys(): VendorTdsLiabilityEntityModel[] | undefined;
70
+ get vendorTdsChallans(): VendorTdsChallanEntityModel[] | undefined;
71
+ get banks(): BankEntityModel[] | undefined;
72
+ get clientDebitNotes(): ClientDebitNoteEntityModel[] | undefined;
73
+ get clients(): ClientEntityModel[] | undefined;
74
+ get users(): UserEntityModel[] | undefined;
75
+ get leaveApprovals(): LeaveApprovalEntityModel[] | undefined;
76
+ get leaves(): LeaveEntityModel[] | undefined;
77
+ get workFromHomes(): WorkFromHomeEntityModel[] | undefined;
78
+ get toDoLists(): ToDoListEntityModel[] | undefined;
79
+ get projects(): ProjectEntityModel[] | undefined;
80
+ get clientAffiliates(): ClientAffiliateEntityModel[] | undefined;
81
+ get clientDebitNoteParticularss(): ClientDebitNoteParticularsEntityModel[] | undefined;
82
+ get intermediaryBanks(): IntermediaryBankEntityModel[] | undefined;
83
+ get billings(): BillingEntityModel[] | undefined;
84
+ get vendorInvoicePayments(): VendorInvoicePaymentEntityModel[] | undefined;
27
85
  getNextStatus(currentUser: IUserEntity, action: OfficeLocationActionEnum, officeLocationFlowConfigContextData: IOfficeLocationFlowConfigContextData): OfficeLocationStatusEnum;
28
86
  getAvailableActions(currentUser: UserEntityModel, config?: {
29
87
  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;
@@ -29,9 +29,380 @@ class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
29
29
  Object.assign(result, entity);
30
30
  return result;
31
31
  }
32
+ static parseAddress(value) {
33
+ try {
34
+ const parsed = JSON.parse(value);
35
+ if (parsed && typeof parsed === "object") {
36
+ return parsed;
37
+ }
38
+ }
39
+ catch (_a) {
40
+ // fall through to the legacy plain-string shape
41
+ }
42
+ return { addressLine1: value };
43
+ }
32
44
  getRelationConfigs() {
33
45
  return this.constructor.prototype.constructor.relationConfigs || [];
34
46
  }
47
+ get vendors() {
48
+ // many_to_many -> many_to_many verified
49
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one'}
50
+ // ['office_location', 'vendor_invoice'] -> one_to_many
51
+ // ['vendor_invoice', 'vendor'] -> many_to_one
52
+ var _a;
53
+ return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendor).filter((vendor) => !!vendor).reduce((accumulator, current) => {
54
+ if (!accumulator.some((vendor) => vendor.id === current.id)) {
55
+ accumulator.push(current);
56
+ }
57
+ return accumulator;
58
+ }, []);
59
+ }
60
+ get states() {
61
+ // many_to_one -> many_to_many mismatch
62
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->state': 'many_to_one'}
63
+ // ['vendor_invoice', 'vendor'] -> many_to_one
64
+ // ['vendor', 'state'] -> many_to_one
65
+ var _a;
66
+ return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.stateModel).filter((state) => !!state).reduce((accumulator, current) => {
67
+ if (!accumulator.some((state) => state.id === current.id)) {
68
+ accumulator.push(current);
69
+ }
70
+ return accumulator;
71
+ }, []);
72
+ }
73
+ get organizationTypes() {
74
+ // many_to_one -> many_to_many mismatch
75
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->organization_type': 'many_to_one'}
76
+ // ['vendor_invoice', 'vendor'] -> many_to_one
77
+ // ['vendor', 'organization_type'] -> many_to_one
78
+ var _a;
79
+ return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.organizationType).filter((organizationType) => !!organizationType).reduce((accumulator, current) => {
80
+ if (!accumulator.some((organizationType) => organizationType.id === current.id)) {
81
+ accumulator.push(current);
82
+ }
83
+ return accumulator;
84
+ }, []);
85
+ }
86
+ get tdsRates() {
87
+ // many_to_many -> many_to_many verified
88
+ // {'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'}
89
+ // ['vendor', 'organization_type'] -> many_to_one
90
+ // ['organization_type', 'tds_rate'] -> many_to_many
91
+ var _a;
92
+ return (_a = this.organizationTypes) === null || _a === void 0 ? void 0 : _a.flatMap((organizationType) => organizationType.tdsRates).filter((tdsRate) => !!tdsRate).reduce((accumulator, current) => {
93
+ if (!accumulator.some((tdsRate) => tdsRate.id === current.id)) {
94
+ accumulator.push(current);
95
+ }
96
+ return accumulator;
97
+ }, []);
98
+ }
99
+ get voucherTypes() {
100
+ // many_to_many -> many_to_many verified
101
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->voucher_type': 'many_to_one'}
102
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
103
+ // ['vendor_invoice_item', 'voucher_type'] -> many_to_one
104
+ var _a;
105
+ return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.voucherType).filter((voucherType) => !!voucherType).reduce((accumulator, current) => {
106
+ if (!accumulator.some((voucherType) => voucherType.id === current.id)) {
107
+ accumulator.push(current);
108
+ }
109
+ return accumulator;
110
+ }, []);
111
+ }
112
+ get expenseHeads() {
113
+ // many_to_many -> many_to_many verified
114
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->expense_head': 'many_to_one'}
115
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
116
+ // ['vendor_invoice_item', 'expense_head'] -> many_to_one
117
+ var _a;
118
+ return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.expenseHead).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
119
+ if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
120
+ accumulator.push(current);
121
+ }
122
+ return accumulator;
123
+ }, []);
124
+ }
125
+ get vendorInvoiceItems() {
126
+ // one_to_many -> one_to_many verified
127
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many'}
128
+ // ['office_location', 'vendor_invoice'] -> one_to_many
129
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
130
+ var _a;
131
+ return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoiceItems).filter((vendorInvoiceItem) => !!vendorInvoiceItem).reduce((accumulator, current) => {
132
+ if (!accumulator.some((vendorInvoiceItem) => vendorInvoiceItem.id === current.id)) {
133
+ accumulator.push(current);
134
+ }
135
+ return accumulator;
136
+ }, []);
137
+ }
138
+ get gstRates() {
139
+ // many_to_many -> many_to_many verified
140
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
141
+ // ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
142
+ // ['vendor_invoice_item', 'gst_rate'] -> many_to_one
143
+ var _a;
144
+ return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
145
+ if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
146
+ accumulator.push(current);
147
+ }
148
+ return accumulator;
149
+ }, []);
150
+ }
151
+ get vendorAdvances() {
152
+ // many_to_many -> many_to_many verified
153
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->vendor_advance': 'one_to_many'}
154
+ // ['vendor_invoice', 'vendor'] -> many_to_one
155
+ // ['vendor', 'vendor_advance'] -> one_to_many
156
+ var _a;
157
+ return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorAdvances).filter((vendorAdvance) => !!vendorAdvance).reduce((accumulator, current) => {
158
+ if (!accumulator.some((vendorAdvance) => vendorAdvance.id === current.id)) {
159
+ accumulator.push(current);
160
+ }
161
+ return accumulator;
162
+ }, []);
163
+ }
164
+ get vendorInvoiceAdvances() {
165
+ // many_to_many -> many_to_many verified
166
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor': 'many_to_one', 'vendor->vendor_invoice_advance': 'one_to_many'}
167
+ // ['vendor_invoice', 'vendor'] -> many_to_one
168
+ // ['vendor', 'vendor_invoice_advance'] -> one_to_many
169
+ var _a;
170
+ return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorInvoiceAdvances).filter((vendorInvoiceAdvance) => !!vendorInvoiceAdvance).reduce((accumulator, current) => {
171
+ if (!accumulator.some((vendorInvoiceAdvance) => vendorInvoiceAdvance.id === current.id)) {
172
+ accumulator.push(current);
173
+ }
174
+ return accumulator;
175
+ }, []);
176
+ }
177
+ get vendorTdsLiabilitys() {
178
+ // many_to_many -> many_to_many verified
179
+ // {'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'}
180
+ // ['organization_type', 'tds_rate'] -> many_to_many
181
+ // ['tds_rate', 'vendor_tds_liability'] -> one_to_many
182
+ var _a;
183
+ return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsLiabilitys).filter((vendorTdsLiability) => !!vendorTdsLiability).reduce((accumulator, current) => {
184
+ if (!accumulator.some((vendorTdsLiability) => vendorTdsLiability.id === current.id)) {
185
+ accumulator.push(current);
186
+ }
187
+ return accumulator;
188
+ }, []);
189
+ }
190
+ get vendorTdsChallans() {
191
+ // many_to_many -> many_to_many verified
192
+ // {'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'}
193
+ // ['organization_type', 'tds_rate'] -> many_to_many
194
+ // ['tds_rate', 'vendor_tds_challan'] -> one_to_many
195
+ var _a;
196
+ return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.vendorTdsChallans).filter((vendorTdsChallan) => !!vendorTdsChallan).reduce((accumulator, current) => {
197
+ if (!accumulator.some((vendorTdsChallan) => vendorTdsChallan.id === current.id)) {
198
+ accumulator.push(current);
199
+ }
200
+ return accumulator;
201
+ }, []);
202
+ }
203
+ get banks() {
204
+ // many_to_many -> many_to_many verified
205
+ // {'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'}
206
+ // ['tds_rate', 'vendor_tds_challan'] -> one_to_many
207
+ // ['vendor_tds_challan', 'bank'] -> many_to_one
208
+ var _a;
209
+ return (_a = this.vendorTdsChallans) === null || _a === void 0 ? void 0 : _a.flatMap((vendorTdsChallan) => vendorTdsChallan.bank).filter((bank) => !!bank).reduce((accumulator, current) => {
210
+ if (!accumulator.some((bank) => bank.id === current.id)) {
211
+ accumulator.push(current);
212
+ }
213
+ return accumulator;
214
+ }, []);
215
+ }
216
+ get clientDebitNotes() {
217
+ // many_to_many -> many_to_many verified
218
+ // {'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'}
219
+ // ['vendor_tds_challan', 'bank'] -> many_to_one
220
+ // ['bank', 'client_debit_note'] -> one_to_many
221
+ // return this.banks
222
+ // ?.flatMap((bank) => bank.clientDebitNotes)
223
+ // .filter((clientDebitNote): clientDebitNote is ClientDebitNoteEntityModel => !!clientDebitNote)
224
+ // .reduce((accumulator: ClientDebitNoteEntityModel[], current) => {
225
+ // if (!accumulator.some((clientDebitNote) => clientDebitNote.id === current.id)) {
226
+ // accumulator.push(current);
227
+ // }
228
+ // return accumulator;
229
+ // }, []);
230
+ return undefined;
231
+ }
232
+ get clients() {
233
+ // many_to_many -> many_to_many verified
234
+ // {'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'}
235
+ // ['bank', 'client_debit_note'] -> one_to_many
236
+ // ['client_debit_note', 'client'] -> many_to_one
237
+ var _a;
238
+ return (_a = this.clientDebitNotes) === null || _a === void 0 ? void 0 : _a.flatMap((clientDebitNote) => clientDebitNote.client).filter((client) => !!client).reduce((accumulator, current) => {
239
+ if (!accumulator.some((client) => client.id === current.id)) {
240
+ accumulator.push(current);
241
+ }
242
+ return accumulator;
243
+ }, []);
244
+ }
245
+ get users() {
246
+ // many_to_many -> many_to_many verified
247
+ // {'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'}
248
+ // ['client_debit_note', 'client'] -> many_to_one
249
+ // ['client', 'user'] -> many_to_many
250
+ // return this.clients
251
+ // ?.flatMap((client) => client.users)
252
+ // .filter((user): user is UserEntityModel => !!user)
253
+ // .reduce((accumulator: UserEntityModel[], current) => {
254
+ // if (!accumulator.some((user) => user.id === current.id)) {
255
+ // accumulator.push(current);
256
+ // }
257
+ // return accumulator;
258
+ // }, []);
259
+ return undefined;
260
+ }
261
+ get leaveApprovals() {
262
+ // many_to_many -> many_to_many verified
263
+ // {'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'}
264
+ // ['client', 'user'] -> many_to_many
265
+ // ['user', 'leave_approval'] -> one_to_many
266
+ // return this.users
267
+ // ?.flatMap((user) => user.leaveApprovals)
268
+ // .filter((leaveApproval): leaveApproval is LeaveApprovalEntityModel => !!leaveApproval)
269
+ // .reduce((accumulator: LeaveApprovalEntityModel[], current) => {
270
+ // if (!accumulator.some((leaveApproval) => leaveApproval.id === current.id)) {
271
+ // accumulator.push(current);
272
+ // }
273
+ // return accumulator;
274
+ // }, []);
275
+ return undefined;
276
+ }
277
+ get leaves() {
278
+ // many_to_many -> many_to_many verified
279
+ // {'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'}
280
+ // ['user', 'leave_approval'] -> one_to_many
281
+ // ['leave_approval', 'leave'] -> many_to_one
282
+ var _a;
283
+ return (_a = this.leaveApprovals) === null || _a === void 0 ? void 0 : _a.flatMap((leaveApproval) => leaveApproval.leave).filter((leave) => !!leave).reduce((accumulator, current) => {
284
+ if (!accumulator.some((leave) => leave.id === current.id)) {
285
+ accumulator.push(current);
286
+ }
287
+ return accumulator;
288
+ }, []);
289
+ }
290
+ get workFromHomes() {
291
+ // many_to_many -> many_to_many verified
292
+ // {'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'}
293
+ // ['client', 'user'] -> many_to_many
294
+ // ['user', 'work_from_home'] -> one_to_many
295
+ // return this.users
296
+ // ?.flatMap((user) => user.workFromHomes)
297
+ // .filter((workFromHome): workFromHome is WorkFromHomeEntityModel => !!workFromHome)
298
+ // .reduce((accumulator: WorkFromHomeEntityModel[], current) => {
299
+ // if (!accumulator.some((workFromHome) => workFromHome.id === current.id)) {
300
+ // accumulator.push(current);
301
+ // }
302
+ // return accumulator;
303
+ // }, []);
304
+ return undefined;
305
+ }
306
+ get toDoLists() {
307
+ // many_to_many -> many_to_many verified
308
+ // {'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'}
309
+ // ['client', 'user'] -> many_to_many
310
+ // ['user', 'to_do_list'] -> one_to_many
311
+ // return this.users
312
+ // ?.flatMap((user) => user.toDoLists)
313
+ // .filter((toDoList): toDoList is ToDoListEntityModel => !!toDoList)
314
+ // .reduce((accumulator: ToDoListEntityModel[], current) => {
315
+ // if (!accumulator.some((toDoList) => toDoList.id === current.id)) {
316
+ // accumulator.push(current);
317
+ // }
318
+ // return accumulator;
319
+ // }, []);
320
+ return undefined;
321
+ }
322
+ get projects() {
323
+ // many_to_many -> many_to_many verified
324
+ // {'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'}
325
+ // ['user', 'to_do_list'] -> one_to_many
326
+ // ['to_do_list', 'project'] -> many_to_one
327
+ var _a;
328
+ return (_a = this.toDoLists) === null || _a === void 0 ? void 0 : _a.flatMap((toDoList) => toDoList.project).filter((project) => !!project).reduce((accumulator, current) => {
329
+ if (!accumulator.some((project) => project.id === current.id)) {
330
+ accumulator.push(current);
331
+ }
332
+ return accumulator;
333
+ }, []);
334
+ }
335
+ get clientAffiliates() {
336
+ // many_to_many -> many_to_many verified
337
+ // {'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'}
338
+ // ['bank', 'client_debit_note'] -> one_to_many
339
+ // ['client_debit_note', 'client_affiliate'] -> many_to_one
340
+ var _a;
341
+ return (_a = this.clientDebitNotes) === null || _a === void 0 ? void 0 : _a.flatMap((clientDebitNote) => clientDebitNote.clientAffiliate).filter((clientAffiliate) => !!clientAffiliate).reduce((accumulator, current) => {
342
+ if (!accumulator.some((clientAffiliate) => clientAffiliate.id === current.id)) {
343
+ accumulator.push(current);
344
+ }
345
+ return accumulator;
346
+ }, []);
347
+ }
348
+ get clientDebitNoteParticularss() {
349
+ // one_to_many -> many_to_many mismatch
350
+ // {'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'}
351
+ // ['bank', 'client_debit_note'] -> one_to_many
352
+ // ['client_debit_note', 'client_debit_note_particulars'] -> one_to_many
353
+ // return this.clientDebitNotes
354
+ // ?.flatMap((clientDebitNote) => clientDebitNote.clientDebitNoteParticulars)
355
+ // .filter((clientDebitNoteParticulars): clientDebitNoteParticulars is ClientDebitNoteParticularsEntityModel => !!clientDebitNoteParticulars)
356
+ // .reduce((accumulator: ClientDebitNoteParticularsEntityModel[], current) => {
357
+ // if (!accumulator.some((clientDebitNoteParticulars) => clientDebitNoteParticulars.id === current.id)) {
358
+ // accumulator.push(current);
359
+ // }
360
+ // return accumulator;
361
+ // }, []);
362
+ return undefined;
363
+ }
364
+ get intermediaryBanks() {
365
+ // many_to_many -> many_to_many verified
366
+ // {'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'}
367
+ // ['vendor_tds_challan', 'bank'] -> many_to_one
368
+ // ['bank', 'intermediary_bank'] -> one_to_many
369
+ var _a;
370
+ return (_a = this.banks) === null || _a === void 0 ? void 0 : _a.flatMap((bank) => bank.intermediaryBanks).filter((intermediaryBank) => !!intermediaryBank).reduce((accumulator, current) => {
371
+ if (!accumulator.some((intermediaryBank) => intermediaryBank.id === current.id)) {
372
+ accumulator.push(current);
373
+ }
374
+ return accumulator;
375
+ }, []);
376
+ }
377
+ get billings() {
378
+ // many_to_many -> many_to_many verified
379
+ // {'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'}
380
+ // ['vendor_tds_challan', 'bank'] -> many_to_one
381
+ // ['bank', 'billing'] -> one_to_many
382
+ // return this.banks
383
+ // ?.flatMap((bank) => bank.billings)
384
+ // .filter((billing): billing is BillingEntityModel => !!billing)
385
+ // .reduce((accumulator: BillingEntityModel[], current) => {
386
+ // if (!accumulator.some((billing) => billing.id === current.id)) {
387
+ // accumulator.push(current);
388
+ // }
389
+ // return accumulator;
390
+ // }, []);
391
+ return undefined;
392
+ }
393
+ get vendorInvoicePayments() {
394
+ // one_to_many -> one_to_many verified
395
+ // {'office_location->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_payment': 'one_to_many'}
396
+ // ['office_location', 'vendor_invoice'] -> one_to_many
397
+ // ['vendor_invoice', 'vendor_invoice_payment'] -> one_to_many
398
+ var _a;
399
+ return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoicePayments).filter((vendorInvoicePayment) => !!vendorInvoicePayment).reduce((accumulator, current) => {
400
+ if (!accumulator.some((vendorInvoicePayment) => vendorInvoicePayment.id === current.id)) {
401
+ accumulator.push(current);
402
+ }
403
+ return accumulator;
404
+ }, []);
405
+ }
35
406
  getNextStatus(currentUser, action, officeLocationFlowConfigContextData) {
36
407
  if (!this.status) {
37
408
  throw new exceptions_1.AppBadRequestException({
@@ -69,7 +440,7 @@ class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
69
440
  if (!hasPermission) {
70
441
  throw new exceptions_1.AppBadRequestException({
71
442
  key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
72
- message: [`Current user does not have permission to ${action} office location`],
443
+ message: [`Current user does not have permission to ${action} officeLocation`],
73
444
  });
74
445
  }
75
446
  const nextStatus = matchingPermissionConfig.next(officeLocationFlowConfigContextData);
@@ -92,4 +463,32 @@ class OfficeLocationEntityModel extends base_entity_model_1.BaseEntityModel {
92
463
  }
93
464
  }
94
465
  exports.OfficeLocationEntityModel = OfficeLocationEntityModel;
95
- OfficeLocationEntityModel.relationConfigs = [];
466
+ OfficeLocationEntityModel.relationConfigs = [
467
+ {
468
+ name: entity_utils_interface_1.EntityEnum.ORGANIZATION,
469
+ relation: entities_1.RelationType.ONE,
470
+ key: "organization",
471
+ mapKeyConfig: {
472
+ relationKey: "id",
473
+ key: "organizationId",
474
+ },
475
+ },
476
+ {
477
+ name: entity_utils_interface_1.EntityEnum.COUNTRY,
478
+ relation: entities_1.RelationType.ONE,
479
+ key: "countryModel",
480
+ mapKeyConfig: {
481
+ relationKey: "name",
482
+ key: "country",
483
+ },
484
+ },
485
+ {
486
+ name: entity_utils_interface_1.EntityEnum.VENDOR_INVOICE,
487
+ relation: entities_1.RelationType.MANY,
488
+ key: "vendorInvoices",
489
+ mapKeyConfig: {
490
+ relationKey: "serviceLocationId",
491
+ key: "id",
492
+ },
493
+ },
494
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "14.1.4-beta.8",
3
+ "version": "14.1.4-beta.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [