law-common 14.0.10-beta.0 → 14.0.10-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.
- package/dist/src/api/index.d.ts +0 -4
- package/dist/src/api/index.js +7 -21
- package/dist/src/api/v1/index.d.ts +4 -0
- package/dist/src/api/v1/index.js +4 -0
- package/dist/src/api/{interface → v1/interface}/expense_type.create.dto.interface.d.ts +1 -1
- package/dist/src/api/{interface → v1/interface}/expense_type.update.dto.interface.d.ts +1 -1
- package/dist/src/api/{interface → v1/interface}/office_location.create.dto.interface.d.ts +1 -1
- package/dist/src/api/{interface → v1/interface}/office_location.update.dto.interface.d.ts +1 -1
- package/dist/src/api/v2/index.d.ts +4 -0
- package/dist/src/api/v2/index.js +4 -0
- package/dist/src/api/v2/interface/expense_type.create.dto.interface.d.ts +5 -0
- package/dist/src/api/v2/interface/expense_type.create.dto.interface.js +2 -0
- package/dist/src/api/v2/interface/expense_type.update.dto.interface.d.ts +12 -0
- package/dist/src/api/v2/interface/expense_type.update.dto.interface.js +2 -0
- package/dist/src/api/v2/interface/office_location.create.dto.interface.d.ts +15 -0
- package/dist/src/api/v2/interface/office_location.create.dto.interface.js +2 -0
- package/dist/src/api/v2/interface/office_location.update.dto.interface.d.ts +13 -0
- package/dist/src/api/v2/interface/office_location.update.dto.interface.js +2 -0
- package/dist/src/entities/flow-configs/expense_type_flow.config.d.ts +1 -1
- package/dist/src/entities/flow-configs/expense_type_flow.config.js +21 -21
- package/dist/src/entities/index.d.ts +2 -1
- package/dist/src/entities/index.js +2 -1
- package/dist/src/entities/interface/expense_type.entity.interface.d.ts +3 -2
- package/dist/src/entities/interface/field-constraint/expense_type_field_constraints.interface.d.ts +0 -8
- package/dist/src/entities/interface/field-constraint/office_location_address_field_constraints.interface.d.ts +13 -0
- package/dist/src/entities/interface/field-constraint/office_location_address_field_constraints.interface.js +17 -0
- package/dist/src/entities/interface/field-constraint/office_location_field_constraints.interface.d.ts +0 -9
- package/dist/src/entities/interface/field-constraint/office_location_field_constraints.interface.js +4 -13
- package/dist/src/entities/model/base.entity.model.js +7 -17
- package/dist/src/entities/model/expense_type.entity.model.d.ts +7 -7
- package/dist/src/entities/model/expense_type.entity.model.js +6 -6
- package/dist/src/entities/model/office_location.entity.model.d.ts +64 -8
- package/dist/src/entities/model/office_location.entity.model.js +393 -6
- package/dist/src/index.js +7 -17
- package/dist/src/utils/helper.fn.util.d.ts +2 -2
- package/package.json +1 -1
- /package/dist/src/api/{interface → v1/interface}/expense_type.create.dto.interface.js +0 -0
- /package/dist/src/api/{interface → v1/interface}/expense_type.update.dto.interface.js +0 -0
- /package/dist/src/api/{interface → v1/interface}/office_location.create.dto.interface.js +0 -0
- /package/dist/src/api/{interface → v1/interface}/office_location.update.dto.interface.js +0 -0
- /package/dist/src/entities/enums/{expense_type_entity_enum.d.ts → expense_type_enum.d.ts} +0 -0
- /package/dist/src/entities/enums/{expense_type_entity_enum.js → expense_type_enum.js} +0 -0
package/dist/src/api/index.d.ts
CHANGED
|
@@ -20,8 +20,6 @@ export * from "./interface/reimbursement_expense.update.dto.interface";
|
|
|
20
20
|
export * from "./interface/billing_reimbursement_expense.create.dto.interface";
|
|
21
21
|
export * from "./interface/billing_reimbursement_expense.filter.dto.interface";
|
|
22
22
|
export * from "./interface/billing_reimbursement_expense.update.dto.interface";
|
|
23
|
-
export * from "./interface/expense_type.create.dto.interface";
|
|
24
|
-
export * from "./interface/expense_type.update.dto.interface";
|
|
25
23
|
export * from "./interface/expense_type.entity.response";
|
|
26
24
|
export * from "./interface/billing.create.dto.interface";
|
|
27
25
|
export * from "./interface/billing_particular_line_item.create.dto.interface";
|
|
@@ -37,10 +35,8 @@ export * from "./interface/billing_timesheet.details.dto.interface";
|
|
|
37
35
|
export * from "./interface/billing_timesheet.filter.dto.interface";
|
|
38
36
|
export * from "./interface/billing_timesheet.update.dto.interface";
|
|
39
37
|
export * from "./interface/billing.entity.response";
|
|
40
|
-
export * from "./interface/office_location.create.dto.interface";
|
|
41
38
|
export * from "./interface/office_location.entity.response";
|
|
42
39
|
export * from "./interface/office_location.filter.dto.interface";
|
|
43
|
-
export * from "./interface/office_location.update.dto.interface";
|
|
44
40
|
export * from "./interface/organization.filter.dto.interface";
|
|
45
41
|
export * from "./interface/billing.update.dto.interface";
|
|
46
42
|
export * from "./interface/moving_timesheet.create.dto.interface";
|
package/dist/src/api/index.js
CHANGED
|
@@ -18,23 +18,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
|
-
var __importStar = (this && this.__importStar) ||
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
38
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
29
|
exports.v2 = exports.v1 = void 0;
|
|
40
30
|
__exportStar(require("./interface/base.response.interface"), exports);
|
|
@@ -59,8 +49,6 @@ __exportStar(require("./interface/reimbursement_expense.update.dto.interface"),
|
|
|
59
49
|
__exportStar(require("./interface/billing_reimbursement_expense.create.dto.interface"), exports);
|
|
60
50
|
__exportStar(require("./interface/billing_reimbursement_expense.filter.dto.interface"), exports);
|
|
61
51
|
__exportStar(require("./interface/billing_reimbursement_expense.update.dto.interface"), exports);
|
|
62
|
-
__exportStar(require("./interface/expense_type.create.dto.interface"), exports);
|
|
63
|
-
__exportStar(require("./interface/expense_type.update.dto.interface"), exports);
|
|
64
52
|
__exportStar(require("./interface/expense_type.entity.response"), exports);
|
|
65
53
|
__exportStar(require("./interface/billing.create.dto.interface"), exports);
|
|
66
54
|
__exportStar(require("./interface/billing_particular_line_item.create.dto.interface"), exports);
|
|
@@ -76,10 +64,8 @@ __exportStar(require("./interface/billing_timesheet.details.dto.interface"), exp
|
|
|
76
64
|
__exportStar(require("./interface/billing_timesheet.filter.dto.interface"), exports);
|
|
77
65
|
__exportStar(require("./interface/billing_timesheet.update.dto.interface"), exports);
|
|
78
66
|
__exportStar(require("./interface/billing.entity.response"), exports);
|
|
79
|
-
__exportStar(require("./interface/office_location.create.dto.interface"), exports);
|
|
80
67
|
__exportStar(require("./interface/office_location.entity.response"), exports);
|
|
81
68
|
__exportStar(require("./interface/office_location.filter.dto.interface"), exports);
|
|
82
|
-
__exportStar(require("./interface/office_location.update.dto.interface"), exports);
|
|
83
69
|
__exportStar(require("./interface/organization.filter.dto.interface"), exports);
|
|
84
70
|
__exportStar(require("./interface/billing.update.dto.interface"), exports);
|
|
85
71
|
__exportStar(require("./interface/moving_timesheet.create.dto.interface"), exports);
|
|
@@ -5,5 +5,9 @@
|
|
|
5
5
|
* generator never writes to this directory (checklist 12.4). An entity appears either in
|
|
6
6
|
* api/interface/ or in v1 + v2 - never both.
|
|
7
7
|
*/
|
|
8
|
+
export * from "./interface/expense_type.create.dto.interface";
|
|
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";
|
|
8
12
|
export * from "./interface/to_do_list.create.dto.interface";
|
|
9
13
|
export * from "./interface/to_do_list.update.dto.interface";
|
package/dist/src/api/v1/index.js
CHANGED
|
@@ -21,5 +21,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
21
21
|
* generator never writes to this directory (checklist 12.4). An entity appears either in
|
|
22
22
|
* api/interface/ or in v1 + v2 - never both.
|
|
23
23
|
*/
|
|
24
|
+
__exportStar(require("./interface/expense_type.create.dto.interface"), exports);
|
|
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);
|
|
24
28
|
__exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
|
|
25
29
|
__exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IEntityCreateDto, IOfficeLocationEntity } from "
|
|
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 "
|
|
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,3 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export * from "./interface/to_do_list.create.dto.interface";
|
|
11
11
|
export * from "./interface/to_do_list.update.dto.interface";
|
|
12
|
+
export * from "./interface/expense_type.create.dto.interface";
|
|
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";
|
package/dist/src/api/v2/index.js
CHANGED
|
@@ -27,3 +27,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
27
27
|
// };
|
|
28
28
|
__exportStar(require("./interface/to_do_list.create.dto.interface"), exports);
|
|
29
29
|
__exportStar(require("./interface/to_do_list.update.dto.interface"), exports);
|
|
30
|
+
__exportStar(require("./interface/expense_type.create.dto.interface"), exports);
|
|
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,5 @@
|
|
|
1
|
+
import { IEntityCreateDto } from "../../../entities";
|
|
2
|
+
import { IExpenseTypeEntity } from "../../../entities/interface/expense_type.entity.interface";
|
|
3
|
+
export type IExpenseTypeCreateExclude = "status";
|
|
4
|
+
export interface IExpenseTypeCreateDto extends Omit<IEntityCreateDto<IExpenseTypeEntity>, IExpenseTypeCreateExclude> {
|
|
5
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DeepPartialButRequired } from "../../interface/api.utils.interface";
|
|
2
|
+
import { ExpenseTypeActionEnum } from "../../../entities";
|
|
3
|
+
import { IExpenseTypeCreateDto } from "./expense_type.create.dto.interface";
|
|
4
|
+
export type IExpenseTypeUpdateDto = DeepPartialButRequired<IExpenseTypeCreateDto, never> & {
|
|
5
|
+
actionData: IExpenseTypeActionDataDto;
|
|
6
|
+
} & {
|
|
7
|
+
id?: number;
|
|
8
|
+
};
|
|
9
|
+
export interface IExpenseTypeActionDataDto {
|
|
10
|
+
action: ExpenseTypeActionEnum;
|
|
11
|
+
remark?: string;
|
|
12
|
+
}
|
|
@@ -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,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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlowConfig } from "./flow-config.type";
|
|
2
|
-
import { ExpenseTypeActionEnum } from "
|
|
2
|
+
import { ExpenseTypeActionEnum } from "../../entities";
|
|
3
3
|
import { ExpenseTypeStatusEnum } from "../enums/expense_type_status_enum";
|
|
4
4
|
export interface IExpenseTypeFlowConfigContextData {
|
|
5
5
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.expenseTypeFlowConfig = void 0;
|
|
4
4
|
const base_flow_config_factory_1 = require("./base-flow-config.factory");
|
|
5
|
-
const
|
|
5
|
+
const entities_1 = require("../../entities");
|
|
6
6
|
const expense_type_status_enum_1 = require("../enums/expense_type_status_enum");
|
|
7
7
|
const EXPENSE_TYPE_CREATE_PERMISSION = ["EXPENSE_TYPE_CREATE"];
|
|
8
8
|
const EXPENSE_TYPE_UPDATE_PERMISSION = ["EXPENSE_TYPE_UPDATE"];
|
|
@@ -11,60 +11,60 @@ const EXPENSE_TYPE_DEACTIVATE_PERMISSION = ["EXPENSE_TYPE_DEACTIVATE"];
|
|
|
11
11
|
const EXPENSE_TYPE_ACTIVATE_PERMISSION = ["EXPENSE_TYPE_ACTIVATE"];
|
|
12
12
|
const EXPENSE_TYPE_RESTORE_PERMISSION = ["EXPENSE_TYPE_RESTORE"];
|
|
13
13
|
const ACTION_MAP = {
|
|
14
|
-
[
|
|
14
|
+
[entities_1.ExpenseTypeActionEnum.CREATE]: {
|
|
15
15
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
16
16
|
permissions: EXPENSE_TYPE_CREATE_PERMISSION,
|
|
17
17
|
},
|
|
18
|
-
[
|
|
18
|
+
[entities_1.ExpenseTypeActionEnum.UPDATE]: {
|
|
19
19
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
20
20
|
permissions: EXPENSE_TYPE_UPDATE_PERMISSION,
|
|
21
21
|
},
|
|
22
|
-
[
|
|
22
|
+
[entities_1.ExpenseTypeActionEnum.DELETE]: {
|
|
23
23
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED],
|
|
24
24
|
permissions: EXPENSE_TYPE_DELETE_PERMISSION,
|
|
25
25
|
},
|
|
26
|
-
[
|
|
26
|
+
[entities_1.ExpenseTypeActionEnum.DEACTIVATE]: {
|
|
27
27
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.DEACTIVATED],
|
|
28
28
|
permissions: EXPENSE_TYPE_DEACTIVATE_PERMISSION,
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[entities_1.ExpenseTypeActionEnum.ACTIVATE]: {
|
|
31
31
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
32
32
|
permissions: EXPENSE_TYPE_ACTIVATE_PERMISSION,
|
|
33
33
|
},
|
|
34
|
-
[
|
|
34
|
+
[entities_1.ExpenseTypeActionEnum.RESTORE]: {
|
|
35
35
|
reachableStatues: [expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED],
|
|
36
36
|
permissions: EXPENSE_TYPE_RESTORE_PERMISSION,
|
|
37
37
|
},
|
|
38
38
|
};
|
|
39
39
|
const { createActionConfig } = (0, base_flow_config_factory_1.createFlowConfigFactory)()(ACTION_MAP);
|
|
40
40
|
// APPROVED status transitions
|
|
41
|
-
const transitionApprovedStatusUpdateAction = createActionConfig(
|
|
42
|
-
const transitionApprovedStatusDeleteAction = createActionConfig(
|
|
43
|
-
const transitionApprovedStatusDeactivateAction = createActionConfig(
|
|
41
|
+
const transitionApprovedStatusUpdateAction = createActionConfig(entities_1.ExpenseTypeActionEnum.UPDATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
42
|
+
const transitionApprovedStatusDeleteAction = createActionConfig(entities_1.ExpenseTypeActionEnum.DELETE, expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED);
|
|
43
|
+
const transitionApprovedStatusDeactivateAction = createActionConfig(entities_1.ExpenseTypeActionEnum.DEACTIVATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.DEACTIVATED);
|
|
44
44
|
// DEACTIVATED status transitions
|
|
45
|
-
const transitionDeactivatedStatusDeleteAction = createActionConfig(
|
|
46
|
-
const transitionDeactivatedStatusActivateAction = createActionConfig(
|
|
45
|
+
const transitionDeactivatedStatusDeleteAction = createActionConfig(entities_1.ExpenseTypeActionEnum.DELETE, expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED);
|
|
46
|
+
const transitionDeactivatedStatusActivateAction = createActionConfig(entities_1.ExpenseTypeActionEnum.ACTIVATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
47
47
|
// DELETED status transitions
|
|
48
|
-
const transitionDeletedStatusUpdateAction = createActionConfig(
|
|
49
|
-
const transitionDeletedStatusRestoreAction = createActionConfig(
|
|
48
|
+
const transitionDeletedStatusUpdateAction = createActionConfig(entities_1.ExpenseTypeActionEnum.UPDATE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
49
|
+
const transitionDeletedStatusRestoreAction = createActionConfig(entities_1.ExpenseTypeActionEnum.RESTORE, expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED);
|
|
50
50
|
exports.expenseTypeFlowConfig = {
|
|
51
51
|
[expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED]: {
|
|
52
52
|
actions: {
|
|
53
|
-
[
|
|
54
|
-
[
|
|
55
|
-
[
|
|
53
|
+
[entities_1.ExpenseTypeActionEnum.UPDATE]: transitionApprovedStatusUpdateAction,
|
|
54
|
+
[entities_1.ExpenseTypeActionEnum.DELETE]: transitionApprovedStatusDeleteAction,
|
|
55
|
+
[entities_1.ExpenseTypeActionEnum.DEACTIVATE]: transitionApprovedStatusDeactivateAction,
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
[expense_type_status_enum_1.ExpenseTypeStatusEnum.DEACTIVATED]: {
|
|
59
59
|
actions: {
|
|
60
|
-
[
|
|
61
|
-
[
|
|
60
|
+
[entities_1.ExpenseTypeActionEnum.DELETE]: transitionDeactivatedStatusDeleteAction,
|
|
61
|
+
[entities_1.ExpenseTypeActionEnum.ACTIVATE]: transitionDeactivatedStatusActivateAction,
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
64
|
[expense_type_status_enum_1.ExpenseTypeStatusEnum.DELETED]: {
|
|
65
65
|
actions: {
|
|
66
|
-
[
|
|
67
|
-
[
|
|
66
|
+
[entities_1.ExpenseTypeActionEnum.UPDATE]: transitionDeletedStatusUpdateAction,
|
|
67
|
+
[entities_1.ExpenseTypeActionEnum.RESTORE]: transitionDeletedStatusRestoreAction,
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
70
|
};
|
|
@@ -47,7 +47,7 @@ export * from "./flow-configs/reimbursement_flow.config";
|
|
|
47
47
|
export * from "./flow-configs/reimbursement_expense_flow.config";
|
|
48
48
|
export * from "./interface/reimbursement.entity.interface";
|
|
49
49
|
export * from "./interface/field-constraint/reimbursement_field_constraints.interface";
|
|
50
|
-
export * from "./enums/
|
|
50
|
+
export * from "./enums/expense_type_enum";
|
|
51
51
|
export * from "./enums/expense_type_action_enum";
|
|
52
52
|
export * from "./enums/expense_type_status_enum";
|
|
53
53
|
export * from "./flow-configs/expense_type_flow.config";
|
|
@@ -409,3 +409,4 @@ export * from "./model/work_from_home.entity.model";
|
|
|
409
409
|
export * from "./enums/user_gender_enum";
|
|
410
410
|
export * from "./enums/user_role_enum";
|
|
411
411
|
export * from "./enums/user_status_enum";
|
|
412
|
+
export * from "./interface/field-constraint/office_location_address_field_constraints.interface";
|
|
@@ -63,7 +63,7 @@ __exportStar(require("./flow-configs/reimbursement_flow.config"), exports);
|
|
|
63
63
|
__exportStar(require("./flow-configs/reimbursement_expense_flow.config"), exports);
|
|
64
64
|
__exportStar(require("./interface/reimbursement.entity.interface"), exports);
|
|
65
65
|
__exportStar(require("./interface/field-constraint/reimbursement_field_constraints.interface"), exports);
|
|
66
|
-
__exportStar(require("./enums/
|
|
66
|
+
__exportStar(require("./enums/expense_type_enum"), exports);
|
|
67
67
|
__exportStar(require("./enums/expense_type_action_enum"), exports);
|
|
68
68
|
__exportStar(require("./enums/expense_type_status_enum"), exports);
|
|
69
69
|
__exportStar(require("./flow-configs/expense_type_flow.config"), exports);
|
|
@@ -426,3 +426,4 @@ __exportStar(require("./model/work_from_home.entity.model"), exports);
|
|
|
426
426
|
__exportStar(require("./enums/user_gender_enum"), exports);
|
|
427
427
|
__exportStar(require("./enums/user_role_enum"), exports);
|
|
428
428
|
__exportStar(require("./enums/user_status_enum"), exports);
|
|
429
|
+
__exportStar(require("./interface/field-constraint/office_location_address_field_constraints.interface"), exports);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ExpenseTypeEnum } from "../enums/
|
|
1
|
+
import { ExpenseTypeEnum } from "../enums/expense_type_enum";
|
|
2
2
|
import { ExpenseTypeStatusEnum } from "../enums/expense_type_status_enum";
|
|
3
3
|
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
4
|
+
import { Nullable } from "./entity.utils.interface";
|
|
4
5
|
export interface IExpenseTypeEntity extends IEntityAuditColumn {
|
|
5
6
|
id: number;
|
|
6
7
|
name: string;
|
|
7
|
-
description?: string
|
|
8
|
+
description?: Nullable<string>;
|
|
8
9
|
type: ExpenseTypeEnum;
|
|
9
10
|
status: ExpenseTypeStatusEnum;
|
|
10
11
|
}
|
package/dist/src/entities/interface/field-constraint/expense_type_field_constraints.interface.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { IEntityAuditColumn } from "../entity-audit-columns.interface";
|
|
2
2
|
import { IExpenseTypeEntity } from "../expense_type.entity.interface";
|
|
3
3
|
import { IFieldMinMaxConstraint } from "./utils";
|
|
4
|
-
/**
|
|
5
|
-
* excluded, and why:
|
|
6
|
-
* - "type", "status" enum columns, enums carry no min/max
|
|
7
|
-
* - "id", keyof IEntityAuditColumn generated columns
|
|
8
|
-
*
|
|
9
|
-
* this entity has a create DTO only — there is no ExpenseTypeUpdateDto, so no
|
|
10
|
-
* create/update disagreement is possible
|
|
11
|
-
*/
|
|
12
4
|
export type IExpenseTypeFieldLengthConstraintsExclude = "status" | "type" | "id" | keyof IEntityAuditColumn;
|
|
13
5
|
/**
|
|
14
6
|
* since some fields are optional, but we still need their
|
|
@@ -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
|
package/dist/src/entities/interface/field-constraint/office_location_field_constraints.interface.js
CHANGED
|
@@ -6,23 +6,14 @@ exports.officeLocationFieldMinMaxConstraints = {
|
|
|
6
6
|
min: 3,
|
|
7
7
|
max: 128,
|
|
8
8
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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:
|
|
23
|
-
},
|
|
24
|
-
country: {
|
|
25
|
-
max: 128,
|
|
16
|
+
max: 9999999,
|
|
26
17
|
},
|
|
27
18
|
organizationId: {
|
|
28
19
|
max: 9999999,
|
|
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) ||
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
35
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
26
|
exports.BaseEntityModel = void 0;
|
|
37
27
|
// @ts-nocheck
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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";
|
|
6
|
-
import {
|
|
7
|
+
import { ExpenseTypeActionEnum } from "../../entities";
|
|
8
|
+
import { ExpenseTypeEnum } from "../enums/expense_type_enum";
|
|
7
9
|
import { ExpenseTypeStatusEnum } from "../enums/expense_type_status_enum";
|
|
8
|
-
import {
|
|
10
|
+
import { IExpenseTypeFlowConfigContextData } from "../flow-configs/expense_type_flow.config";
|
|
9
11
|
import { IExpenseTypeEntity } from "../interface/expense_type.entity.interface";
|
|
10
|
-
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
11
|
-
import { BaseEntityModel } from "./base.entity.model";
|
|
12
12
|
export declare class ExpenseTypeEntityModel extends BaseEntityModel<EntityEnum.EXPENSE_TYPE> implements IExpenseTypeEntity {
|
|
13
13
|
id: number;
|
|
14
14
|
name: string;
|
|
@@ -21,7 +21,7 @@ export declare class ExpenseTypeEntityModel extends BaseEntityModel<EntityEnum.E
|
|
|
21
21
|
updatedBy: number;
|
|
22
22
|
static relationConfigs: RelationConfigs<[], EntityEnum.EXPENSE_TYPE>;
|
|
23
23
|
static fromEntity(entity: IExpenseTypeEntity): ExpenseTypeEntityModel;
|
|
24
|
-
getRelationConfigs(): [];
|
|
24
|
+
getRelationConfigs(): any[];
|
|
25
25
|
getNextStatus(currentUser: IUserEntity, action: ExpenseTypeActionEnum, expenseTypeFlowConfigContextData: IExpenseTypeFlowConfigContextData): ExpenseTypeStatusEnum;
|
|
26
26
|
getAvailableActions(currentUser: UserEntityModel, config?: {
|
|
27
27
|
combinedActions?: Record<string, {
|
|
@@ -4,17 +4,17 @@ exports.ExpenseTypeEntityModel = 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 expense_type_flow_config_1 = require("../flow-configs/expense_type_flow.config");
|
|
8
|
-
const expense_type_entity_enum_1 = require("../enums/expense_type_entity_enum");
|
|
9
|
-
const expense_type_status_enum_1 = require("../enums/expense_type_status_enum");
|
|
10
7
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
11
8
|
const base_entity_model_1 = require("./base.entity.model");
|
|
9
|
+
const expense_type_enum_1 = require("../enums/expense_type_enum");
|
|
10
|
+
const expense_type_status_enum_1 = require("../enums/expense_type_status_enum");
|
|
11
|
+
const expense_type_flow_config_1 = require("../flow-configs/expense_type_flow.config");
|
|
12
12
|
class ExpenseTypeEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.id = 0;
|
|
16
16
|
this.name = "";
|
|
17
|
-
this.type =
|
|
17
|
+
this.type = expense_type_enum_1.ExpenseTypeEnum.BILLABLE;
|
|
18
18
|
this.status = expense_type_status_enum_1.ExpenseTypeStatusEnum.APPROVED;
|
|
19
19
|
this.createdOn = 0;
|
|
20
20
|
this.updatedOn = 0;
|
|
@@ -27,7 +27,7 @@ class ExpenseTypeEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
27
27
|
return result;
|
|
28
28
|
}
|
|
29
29
|
getRelationConfigs() {
|
|
30
|
-
return
|
|
30
|
+
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
31
31
|
}
|
|
32
32
|
getNextStatus(currentUser, action, expenseTypeFlowConfigContextData) {
|
|
33
33
|
if (!this.status) {
|
|
@@ -66,7 +66,7 @@ class ExpenseTypeEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
66
66
|
if (!hasPermission) {
|
|
67
67
|
throw new exceptions_1.AppBadRequestException({
|
|
68
68
|
key: error_key_enum_1.ErrorKeyEnum.PERMISSION,
|
|
69
|
-
message: [`Current user does not have permission to ${action}
|
|
69
|
+
message: [`Current user does not have permission to ${action} expenseType`],
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
const nextStatus = matchingPermissionConfig.next(expenseTypeFlowConfigContextData);
|
|
@@ -1,29 +1,85 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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 {
|
|
9
|
+
import { IOfficeLocationFlowConfigContextData } from "../flow-configs/office_location_flow.config";
|
|
8
10
|
import { IOfficeLocationEntity } from "../interface/office_location.entity.interface";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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
|
-
|
|
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}
|
|
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/dist/src/index.js
CHANGED
|
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) ||
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
35
25
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
27
|
};
|
|
@@ -149,12 +149,12 @@ export declare function getEnumNames(enumType: object): string[];
|
|
|
149
149
|
export declare function getFilterByPermission<T extends EnumEntityType<EntityEnum>>(permissionFilterConfig: {
|
|
150
150
|
[key: string]: IEntityFilterData<T>;
|
|
151
151
|
}, propertyName: keyof T, userPermission: string, filterDto: IEntityFilterData<T>, emptyValue?: any): {
|
|
152
|
-
[
|
|
152
|
+
[x: string]: any;
|
|
153
153
|
};
|
|
154
154
|
export declare function getFilterByPermissionFn<T extends EnumEntityType<EntityEnum>>(permissionFilterConfig: {
|
|
155
155
|
[key: string]: () => Promise<IEntityFilterData<T>>;
|
|
156
156
|
}, propertyName: keyof T, userPermission: string, filterDto: IEntityFilterData<T>, emptyValue?: any): Promise<{
|
|
157
|
-
[
|
|
157
|
+
[x: string]: any;
|
|
158
158
|
}>;
|
|
159
159
|
export declare function getPropertyFilterByPermissionFn<T extends EnumEntityType<EntityEnum>>(permissionFilterConfig: {
|
|
160
160
|
[key: string]: () => Promise<IEntityFilterData<T>>;
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|