law-common 10.72.8 → 10.72.10
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/interface/leave.api.d.ts +2 -11
- package/dist/src/api/interface/vendor.create.dto.interface.autocode.js +12 -3
- package/dist/src/api/interface/vendor.entity.response.d.ts +4 -10
- package/dist/src/entities/flow-configs/flow-config.type.d.ts +10 -10
- package/dist/src/entities/flow-configs/leave.flow.config.d.ts +1 -1
- package/dist/src/entities/flow-configs/vendor-flow.config.js +15 -15
- package/dist/src/entities/interface/aggregation.utils.d.ts +39 -0
- package/dist/src/entities/interface/aggregation.utils.js +16 -0
- package/dist/src/entities/interface/entity.utils.interface.d.ts +15 -2
- package/dist/src/entities/model/entity.model.interface.d.ts +2 -6
- package/dist/src/entities/model/entity.model.interface.js +8 -0
- package/dist/src/entities/model/leave.entity.model.js +1 -1
- package/dist/src/entities/model/organization_type.entity.model.d.ts +21 -5
- package/dist/src/entities/model/organization_type.entity.model.js +113 -14
- package/dist/src/entities/model/tds_rate.entity.model.d.ts +27 -3
- package/dist/src/entities/model/tds_rate.entity.model.js +114 -2
- package/dist/src/entities/model/vendor.entity.model.d.ts +44 -32
- package/dist/src/entities/model/vendor.entity.model.js +132 -53
- package/dist/src/entities/model/vendor_invoice_item.entity.model.autocode.js +40 -0
- package/dist/src/entities/model/vendor_invoice_item.entity.model.d.ts +24 -15
- package/dist/src/entities/model/vendor_invoice_item.entity.model.js +44 -5
- package/dist/src/entities/model/voucher_type.entity.model.d.ts +25 -5
- package/dist/src/entities/model/voucher_type.entity.model.js +102 -2
- package/dist/src/utils/entity.flow.util.d.ts +40 -40
- package/package.json +1 -1
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import { ILeaveEntity, LeaveActionEnum, LeaveStatusEnum } from "../../entities";
|
|
1
|
+
import { FlowConfig, ILeaveEntity, LeaveActionEnum, LeaveStatusEnum } from "../../entities";
|
|
2
2
|
import { ILeaveUpdateDto } from "./leave.update.dto.interface";
|
|
3
3
|
export type ILeaveFlowContextData = {
|
|
4
4
|
currentTimesheet?: ILeaveEntity;
|
|
5
5
|
dto?: ILeaveUpdateDto;
|
|
6
6
|
};
|
|
7
|
-
export type ILeaveFlowConfig =
|
|
8
|
-
[key in LeaveStatusEnum]?: {
|
|
9
|
-
actions: {
|
|
10
|
-
[key in LeaveActionEnum]?: {
|
|
11
|
-
permissions: string[];
|
|
12
|
-
next: () => LeaveStatusEnum;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
};
|
|
7
|
+
export type ILeaveFlowConfig = FlowConfig<LeaveStatusEnum, LeaveActionEnum, never>;
|
|
@@ -22,10 +22,19 @@
|
|
|
22
22
|
// }
|
|
23
23
|
// export type IVendorBankDetailCreateExclude = never;
|
|
24
24
|
// export interface IVendorBankDetailCreateDto extends Omit<IEntityCreateDto<IVendorBankDetailEntity>, IVendorBankDetailCreateExclude> {}
|
|
25
|
-
// export type IVendorCreateExclude =
|
|
25
|
+
// export type IVendorCreateExclude =
|
|
26
|
+
// | "contactDetail"
|
|
27
|
+
// | "bankDetail"
|
|
28
|
+
// | "organizationTypeId"
|
|
29
|
+
// | "status"
|
|
30
|
+
// | "remark"
|
|
31
|
+
// | "panDocument"
|
|
32
|
+
// | "gstDocument"
|
|
33
|
+
// | "contractDocument"
|
|
34
|
+
// | "attachmentDocuments";
|
|
26
35
|
// export interface IVendorCreateDto extends Omit<IEntityCreateDto<IVendorEntity>, IVendorCreateExclude> {
|
|
27
|
-
// contactDetail?:
|
|
28
|
-
// bankDetail?:
|
|
36
|
+
// contactDetail?: IVendorContactDetailCreateDto[];
|
|
37
|
+
// bankDetail?: IVendorBankDetailCreateDto[];
|
|
29
38
|
// panDocument?: Nullable<MulterFileWithUrl>;
|
|
30
39
|
// gstDocument?: Nullable<MulterFileWithUrl>;
|
|
31
40
|
// contractDocument?: Nullable<MulterFileWithUrl>;
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { VendorActionEnum } from "../../entities/enums/vendor-action.enum";
|
|
2
2
|
import { VendorStatusEnum } from "../../entities/enums/vendor-status.enum";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
permissions: string[];
|
|
8
|
-
next: () => VendorStatusEnum;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
};
|
|
3
|
+
import { FlowConfig } from "../../entities/flow-configs/flow-config.type";
|
|
4
|
+
export interface IVendorFlowConfigContextData {
|
|
5
|
+
}
|
|
6
|
+
export type IVendorFlowConfig = FlowConfig<VendorStatusEnum, VendorActionEnum, IVendorFlowConfigContextData>;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* Used as the single source of truth for what actions are valid
|
|
6
6
|
* at each status, and what permissions are required to execute them.
|
|
7
7
|
*
|
|
8
|
-
* @template
|
|
9
|
-
* @template
|
|
10
|
-
* @template
|
|
8
|
+
* @template STATUS_ENUM_TYPE - String enum of all possible statuses
|
|
9
|
+
* @template ACTION_ENUM_TYPE - String enum of all possible actions
|
|
10
|
+
* @template CONTEXT_DATA_TYPE - Optional context data shape passed to the `next()` resolver.
|
|
11
11
|
* Defaults to `never` for flows where `next()` needs no runtime data.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
* // Flow with context data (reimbursement parent)
|
|
28
28
|
* const config: FlowConfig<ReimbursementStatusEnum, ReimbursementActionEnum, IReimbursementFlowContextData> = { ... }
|
|
29
29
|
*/
|
|
30
|
-
export type FlowConfig<
|
|
31
|
-
[key in
|
|
30
|
+
export type FlowConfig<STATUS_ENUM_TYPE extends string, ACTION_ENUM_TYPE extends string, CONTEXT_DATA_TYPE = never> = {
|
|
31
|
+
[key in STATUS_ENUM_TYPE]?: {
|
|
32
32
|
actions: {
|
|
33
|
-
[key in
|
|
33
|
+
[key in ACTION_ENUM_TYPE]?: IFlowConfigActionConfig<STATUS_ENUM_TYPE, CONTEXT_DATA_TYPE>;
|
|
34
34
|
};
|
|
35
35
|
description?: string;
|
|
36
36
|
};
|
|
@@ -39,8 +39,8 @@ export type FlowConfig<S extends string, A extends string, T extends Record<any,
|
|
|
39
39
|
* Configuration for a single action within a {@link FlowConfig}.
|
|
40
40
|
* Defines who can execute the action and what status it transitions to.
|
|
41
41
|
*
|
|
42
|
-
* @template
|
|
43
|
-
* @template
|
|
42
|
+
* @template STATUS_ENUM_TYPE - String enum of statuses, used as the return type of `next()`
|
|
43
|
+
* @template CONTEXT_DATA_TYPE - Optional context data passed to `next()` for dynamic status resolution.
|
|
44
44
|
* Pass `never` for actions where the next status is always static.
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
@@ -58,9 +58,9 @@ export type FlowConfig<S extends string, A extends string, T extends Record<any,
|
|
|
58
58
|
* next: (data) => areAllRowsApproved(data) ? ReimbursementStatusEnum.APPROVED : ReimbursementStatusEnum.APPROVAL_PENDING,
|
|
59
59
|
* };
|
|
60
60
|
*/
|
|
61
|
-
export interface IFlowConfigActionConfig<
|
|
61
|
+
export interface IFlowConfigActionConfig<STATUS_ENUM_TYPE extends string, CONTEXT_DATA_TYPE> {
|
|
62
62
|
permissions: string[];
|
|
63
|
-
next: (data
|
|
63
|
+
next: (data: CONTEXT_DATA_TYPE) => STATUS_ENUM_TYPE;
|
|
64
64
|
description?: string;
|
|
65
65
|
}
|
|
66
66
|
export type ParentChildFlowConfig<S extends string, A extends string, CS extends string = never, CA extends string = never, T extends Record<any, any> = never> = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { LeaveActionEnum } from "../enums/leave.action.enum";
|
|
2
2
|
import { LeaveStatusEnum } from "../enums/leave.status.enum";
|
|
3
3
|
import { FlowConfig } from "./flow-config.type";
|
|
4
|
-
export declare const leaveFlowConfig: FlowConfig<LeaveStatusEnum, LeaveActionEnum>;
|
|
4
|
+
export declare const leaveFlowConfig: FlowConfig<LeaveStatusEnum, LeaveActionEnum, never>;
|
|
@@ -8,19 +8,19 @@ exports.vendorFlowConfig = {
|
|
|
8
8
|
actions: {
|
|
9
9
|
[vendor_action_enum_1.VendorActionEnum.APPROVE]: {
|
|
10
10
|
permissions: ["VENDOR_APPROVE_ORG"],
|
|
11
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.APPROVED,
|
|
11
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.APPROVED,
|
|
12
12
|
},
|
|
13
13
|
[vendor_action_enum_1.VendorActionEnum.EDIT]: {
|
|
14
14
|
permissions: ["VENDOR_UPDATE"],
|
|
15
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.CREATE_APPROVAL,
|
|
15
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.CREATE_APPROVAL,
|
|
16
16
|
},
|
|
17
17
|
[vendor_action_enum_1.VendorActionEnum.REJECT]: {
|
|
18
18
|
permissions: ["VENDOR_APPROVE_ORG"],
|
|
19
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.REJECTED,
|
|
19
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.REJECTED,
|
|
20
20
|
},
|
|
21
21
|
[vendor_action_enum_1.VendorActionEnum.DELETE]: {
|
|
22
22
|
permissions: ["VENDOR_UPDATE"],
|
|
23
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.DELETED,
|
|
23
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.DELETED,
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
},
|
|
@@ -28,19 +28,19 @@ exports.vendorFlowConfig = {
|
|
|
28
28
|
actions: {
|
|
29
29
|
[vendor_action_enum_1.VendorActionEnum.APPROVE]: {
|
|
30
30
|
permissions: ["VENDOR_APPROVE_ORG"],
|
|
31
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.APPROVED,
|
|
31
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.APPROVED,
|
|
32
32
|
},
|
|
33
33
|
[vendor_action_enum_1.VendorActionEnum.EDIT]: {
|
|
34
34
|
permissions: ["VENDOR_UPDATE"],
|
|
35
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.EDIT_APPROVAL,
|
|
35
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.EDIT_APPROVAL,
|
|
36
36
|
},
|
|
37
37
|
[vendor_action_enum_1.VendorActionEnum.REJECT]: {
|
|
38
38
|
permissions: ["VENDOR_APPROVE_ORG"],
|
|
39
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.RESOLVED_REJECTED,
|
|
39
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.RESOLVED_REJECTED,
|
|
40
40
|
},
|
|
41
41
|
// [VendorActionEnum.RECALL]: {
|
|
42
42
|
// permissions: ["VENDOR_UPDATE"],
|
|
43
|
-
// next: () => VendorStatusEnum.DELETED,
|
|
43
|
+
// next: (vendorFlowConfigContextData: IVendorFlowConfigContextData) => VendorStatusEnum.DELETED,
|
|
44
44
|
// },
|
|
45
45
|
},
|
|
46
46
|
},
|
|
@@ -48,15 +48,15 @@ exports.vendorFlowConfig = {
|
|
|
48
48
|
actions: {
|
|
49
49
|
[vendor_action_enum_1.VendorActionEnum.APPROVE]: {
|
|
50
50
|
permissions: ["VENDOR_APPROVE_ORG"],
|
|
51
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.DELETED,
|
|
51
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.DELETED,
|
|
52
52
|
},
|
|
53
53
|
[vendor_action_enum_1.VendorActionEnum.REJECT]: {
|
|
54
54
|
permissions: ["VENDOR_APPROVE_ORG"],
|
|
55
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.RESOLVED_REJECTED,
|
|
55
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.RESOLVED_REJECTED,
|
|
56
56
|
},
|
|
57
57
|
// [VendorActionEnum.RECALL]: {
|
|
58
58
|
// permissions: ["VENDOR_UPDATE"],
|
|
59
|
-
// next: () => VendorStatusEnum.DELETED,
|
|
59
|
+
// next: (vendorFlowConfigContextData: IVendorFlowConfigContextData) => VendorStatusEnum.DELETED,
|
|
60
60
|
// },
|
|
61
61
|
},
|
|
62
62
|
},
|
|
@@ -64,11 +64,11 @@ exports.vendorFlowConfig = {
|
|
|
64
64
|
actions: {
|
|
65
65
|
[vendor_action_enum_1.VendorActionEnum.EDIT]: {
|
|
66
66
|
permissions: ["VENDOR_UPDATE"],
|
|
67
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.EDIT_APPROVAL,
|
|
67
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.EDIT_APPROVAL,
|
|
68
68
|
},
|
|
69
69
|
[vendor_action_enum_1.VendorActionEnum.DELETE]: {
|
|
70
70
|
permissions: ["VENDOR_UPDATE"],
|
|
71
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.DELETE_APPROVAL,
|
|
71
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.DELETE_APPROVAL,
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
74
|
},
|
|
@@ -76,11 +76,11 @@ exports.vendorFlowConfig = {
|
|
|
76
76
|
actions: {
|
|
77
77
|
[vendor_action_enum_1.VendorActionEnum.EDIT]: {
|
|
78
78
|
permissions: ["VENDOR_UPDATE"],
|
|
79
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.EDIT_APPROVAL,
|
|
79
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.EDIT_APPROVAL,
|
|
80
80
|
},
|
|
81
81
|
[vendor_action_enum_1.VendorActionEnum.DELETE]: {
|
|
82
82
|
permissions: ["VENDOR_UPDATE"],
|
|
83
|
-
next: () => vendor_status_enum_1.VendorStatusEnum.DELETE_APPROVAL,
|
|
83
|
+
next: (vendorFlowConfigContextData) => vendor_status_enum_1.VendorStatusEnum.DELETE_APPROVAL,
|
|
84
84
|
},
|
|
85
85
|
},
|
|
86
86
|
},
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IEntityServiceResponse } from "./entity.utils.interface";
|
|
2
|
+
export declare enum AggregationOperation {
|
|
3
|
+
SUM = "sum",
|
|
4
|
+
MAX = "max",
|
|
5
|
+
MIN = "min",
|
|
6
|
+
COUNT = "count",
|
|
7
|
+
AVG = "avg"
|
|
8
|
+
}
|
|
9
|
+
export declare enum RetainEntities {
|
|
10
|
+
YES = "yes",
|
|
11
|
+
NO = "no"
|
|
12
|
+
}
|
|
13
|
+
export type NumericKeys<T> = {
|
|
14
|
+
[K in keyof T]: T[K] extends number ? K : never;
|
|
15
|
+
}[keyof T];
|
|
16
|
+
export type AggregationFields<T> = {
|
|
17
|
+
[K in NumericKeys<T> as `sum_${string & K}`]?: number;
|
|
18
|
+
} & {
|
|
19
|
+
[K in NumericKeys<T> as `avg_${string & K}`]?: number;
|
|
20
|
+
} & {
|
|
21
|
+
[K in keyof T as `max_${string & K}`]?: number;
|
|
22
|
+
} & {
|
|
23
|
+
[K in keyof T as `min_${string & K}`]?: number;
|
|
24
|
+
} & {
|
|
25
|
+
[K in keyof T as `count_${string & K}`]?: number;
|
|
26
|
+
};
|
|
27
|
+
export interface IEntityAggregationConfig<T> {
|
|
28
|
+
retainEntities: boolean;
|
|
29
|
+
groupingBy: (keyof T)[];
|
|
30
|
+
sum?: NumericKeys<T>[];
|
|
31
|
+
max?: (keyof T)[];
|
|
32
|
+
min?: (keyof T)[];
|
|
33
|
+
count?: (keyof T)[];
|
|
34
|
+
avg?: NumericKeys<T>[];
|
|
35
|
+
}
|
|
36
|
+
export interface IBaseEntityServiceResponseWithAggregation<T> {
|
|
37
|
+
baseEntities: (T & AggregationFields<T>)[] | T[];
|
|
38
|
+
relatedEntities?: IEntityServiceResponse;
|
|
39
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RetainEntities = exports.AggregationOperation = void 0;
|
|
4
|
+
var AggregationOperation;
|
|
5
|
+
(function (AggregationOperation) {
|
|
6
|
+
AggregationOperation["SUM"] = "sum";
|
|
7
|
+
AggregationOperation["MAX"] = "max";
|
|
8
|
+
AggregationOperation["MIN"] = "min";
|
|
9
|
+
AggregationOperation["COUNT"] = "count";
|
|
10
|
+
AggregationOperation["AVG"] = "avg";
|
|
11
|
+
})(AggregationOperation || (exports.AggregationOperation = AggregationOperation = {}));
|
|
12
|
+
var RetainEntities;
|
|
13
|
+
(function (RetainEntities) {
|
|
14
|
+
RetainEntities["YES"] = "yes";
|
|
15
|
+
RetainEntities["NO"] = "no";
|
|
16
|
+
})(RetainEntities || (exports.RetainEntities = RetainEntities = {}));
|
|
@@ -71,6 +71,7 @@ import { WebsiteNewsletterSubscriptionEntityModel } from "../model/website_newsl
|
|
|
71
71
|
import { WorkFromHomeEntityModel } from "../model/work-from-home.entity.model";
|
|
72
72
|
import { WorkFromHomeHistoryEntityModel } from "../model/work_from_home_history.entity.model";
|
|
73
73
|
import { IAddressBookEntity } from "./address-book.entity.interface";
|
|
74
|
+
import { AggregationFields, IEntityAggregationConfig } from "./aggregation.utils";
|
|
74
75
|
import { IBankEntity } from "./bank.entity.interface";
|
|
75
76
|
import { IBankHistoryEntity } from "./bank_history.entity.interface";
|
|
76
77
|
import { IBillingReimbursementExpenseHistoryEntity } from "./billing-reimbursement-expense-history.entity.interface";
|
|
@@ -248,12 +249,18 @@ export type IBaseEntityServiceResponse<T> = {
|
|
|
248
249
|
baseEntities: T[];
|
|
249
250
|
relatedEntities?: IEntityServiceResponse;
|
|
250
251
|
virtualEntities?: IEntityServiceResponse;
|
|
252
|
+
aggregateEntities?: {
|
|
253
|
+
[key in EntityEnum | VirtualEntityEnum]?: any[];
|
|
254
|
+
};
|
|
251
255
|
};
|
|
252
256
|
export type IBaseEntityApiResponse<T> = {
|
|
253
257
|
baseEntities: T[];
|
|
254
258
|
relatedEntities?: {
|
|
255
259
|
[K in EntityEnum | VirtualEntityEnum]?: IBaseEntityApiResponse<EnumEntityType<K>>;
|
|
256
260
|
};
|
|
261
|
+
aggregateEntities?: {
|
|
262
|
+
[key in EntityEnum | VirtualEntityEnum]?: AggregationFields<EnumToModel<key>>[];
|
|
263
|
+
};
|
|
257
264
|
};
|
|
258
265
|
export type EnumEntityType<T extends EntityEnum | VirtualEntityEnum> = (T extends EntityEnum.BILLING ? IBillingEntity : T extends EntityEnum.BILLING_HISTORY ? IBillingHistoryEntity : T extends EntityEnum.BILLING_TIMESHEET ? IBillingTimesheetEntity : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? IBillingReimbursementExpenseEntity : T extends EntityEnum.BILLING_TIMESHEET_HISTORY ? IBillingTimesheetHistoryEntity : T extends EntityEnum.BILLING_REIMBURESMENT_EXPENSE_HISTORY ? IBillingReimbursementExpenseHistoryEntity : T extends EntityEnum.TIMESHEET ? ITimesheetEntity : T extends EntityEnum.USER ? IUserEntity : T extends EntityEnum.PROJECT ? IProjectEntity : T extends EntityEnum.CLIENT ? IClientEntity : T extends EntityEnum.LEAVE ? ILeaveEntity : T extends EntityEnum.BANK ? IBankEntity : T extends EntityEnum.BILLING_TRANSACTION ? IBillingTransactionEntity : T extends EntityEnum.BILLING_TRANSACTION_HISTORY ? IBillingTransactionHistoryEntity : T extends EntityEnum.CLIENT_AFFILIATE ? IClientAffiliateEntity : T extends EntityEnum.CONFIGURATION ? IConfigurationEntity : T extends EntityEnum.HOLIDAY ? IHolidayEntity : T extends EntityEnum.HOLIDAY_LIST ? IHolidayListEntity : T extends EntityEnum.COUNTRY ? ICountryEntity : T extends EntityEnum.EXPENSE_TYPE ? IExpenseTypeEntity : T extends EntityEnum.INDUSTRY ? IIndustryEntity : T extends EntityEnum.INTERMEDIARY_BANK ? IIntermediaryBankEntity : T extends EntityEnum.OFFICE_LOCATION ? IOfficeLocationEntity : T extends EntityEnum.PERMISSION ? IPermissionEntity : T extends EntityEnum.ROLE ? IRoleEntity : T extends EntityEnum.TASK ? ITaskEntity : T extends EntityEnum.DESIGNATION ? IDesignationEntity : T extends EntityEnum.RATE ? IRateEntity : T extends EntityEnum.REIMBURSEMENT ? IReimbursementEntity : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? IReimbursementExpenseEntity : T extends EntityEnum.REIMBURSEMENT_HISTORY ? IReimbursementHistoryEntity : T extends EntityEnum.WORK_FROM_HOME ? IWorkFromHomeEntity : T extends EntityEnum.ORGANIZATION ? IOrganizationEntity : T extends EntityEnum.PROJECT_USER_MAPPING ? IProjectUserMappingEntity : T extends EntityEnum.CLIENT_USER_MAPPING ? IClientUserMappingEntity : T extends EntityEnum.CLIENT_INTRODUCING_MAPPING ? IClientIntroducingMappingEntity : T extends EntityEnum.TO_DO_LIST ? IToDoListEntity : T extends EntityEnum.CRON_JOBS ? ICronJobsEntity : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : T extends EntityEnum.BANK_HISTORY ? IBankHistoryEntity : T extends VirtualEntityEnum.LEAVE_COUNT ? ILeaveCountVirtualEntity : T extends EntityEnum.LEAVE_HISTORY ? ILeaveHistoryEntity : T extends EntityEnum.WORK_FROM_HOME_HISTORY ? IWorkFromHomeHistoryEntity : T extends EntityEnum.TIMESHEET_HISTORY ? ITimesheetHistoryEntity : T extends EntityEnum.ADDRESS_BOOK ? IAddressBookEntity : T extends EntityEnum.STATE ? IStateEntity : T extends EntityEnum.GST_RATE ? IGstRateEntity : T extends EntityEnum.ORGANIZATION_TYPE ? IOrganizationTypeEntity : T extends EntityEnum.TDS_RATE ? ITdsRateEntity : T extends EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING ? IOrganizationTypeTdsRateMappingEntity : T extends EntityEnum.VOUCHER_TYPE ? IVoucherTypeEntity : T extends EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING ? ITdsRateVoucherTypeMappingEntity : T extends EntityEnum.EXPENSE_HEAD ? IExpenseHeadEntity : T extends EntityEnum.DOCUMENT_UPLOAD ? IDocumentUploadEntity : T extends EntityEnum.VENDOR ? IVendorEntity : T extends EntityEnum.VENDOR_INVOICE ? IVendorInvoiceEntity : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? IVendorInvoiceHistoryEntity : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? IVendorInvoiceHistoryEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM ? IVendorInvoiceItemEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? IVendorInvoiceItemHistoryEntity : T extends EntityEnum.VENDOR_HISTORY ? IVendorHistoryEntity : T extends EntityEnum.WEBSITE_LEAD ? IWebsiteLeadEntity : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? IWebsiteNewsletterSubscriptionEntity : T extends EntityEnum.CLIENT_QUOTE ? IClientQuoteEntity : T extends EntityEnum.CLIENT_QUOTE_RATE ? IClientQuoteRateEntity : T extends EntityEnum.BILLING_PROFILE ? IBillingProfileEntity : T extends EntityEnum.PROJECT_REVENUE_SPLIT_MAPPING ? IProjectRevenueSplitMappingEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? IVendorInvoiceItemHistoryEntity : T extends EntityEnum.VENDOR_HISTORY ? IVendorHistoryEntity : T extends EntityEnum.WEBSITE_LEAD ? IWebsiteLeadEntity : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? IWebsiteNewsletterSubscriptionEntity : T extends EntityEnum.CLIENT_QUOTE ? IClientQuoteEntity : T extends EntityEnum.CLIENT_QUOTE_RATE ? IClientQuoteRateEntity : never) & {
|
|
259
266
|
id: number;
|
|
@@ -299,6 +306,7 @@ export type IEntityFilterData<T extends EnumEntityType<EntityEnum | VirtualEntit
|
|
|
299
306
|
virtualRelations?: ISearchIncludeEntity<VirtualEntityEnum>[];
|
|
300
307
|
orderBy?: Partial<Record<keyof T, ColumnOrderBy>>;
|
|
301
308
|
limit?: number;
|
|
309
|
+
aggregation?: IEntityAggregationConfig<T>;
|
|
302
310
|
};
|
|
303
311
|
export type ISearchIncludeEntity<T extends EntityEnum | VirtualEntityEnum> = {
|
|
304
312
|
id?: number[];
|
|
@@ -332,6 +340,7 @@ export type ISearchIncludeEntity<T extends EntityEnum | VirtualEntityEnum> = {
|
|
|
332
340
|
virtualRelations?: ISearchIncludeEntity<EntityRelations[VirtualEntityEnum]>[];
|
|
333
341
|
orderBy?: Partial<Record<keyof EnumEntityType<T>, ColumnOrderBy>>;
|
|
334
342
|
limit?: number;
|
|
343
|
+
aggregation?: IEntityAggregationConfig<EnumEntityType<T>>;
|
|
335
344
|
};
|
|
336
345
|
export type IEntityHistoryParsed = {
|
|
337
346
|
parsedData: any;
|
|
@@ -369,8 +378,8 @@ export type IHistoryEntitySearchByConstraintResponse<T> = {
|
|
|
369
378
|
export type IHistoryEntityChangedLogs<T> = {
|
|
370
379
|
key: keyof T;
|
|
371
380
|
label: string;
|
|
372
|
-
newValue:
|
|
373
|
-
oldValue:
|
|
381
|
+
newValue: T[keyof T];
|
|
382
|
+
oldValue: T[keyof T] | null;
|
|
374
383
|
timeStamp: number;
|
|
375
384
|
};
|
|
376
385
|
export declare enum VirtualEntityEnum {
|
|
@@ -382,6 +391,10 @@ export type IHistoryConstraintSearchServiceResponse<T> = IHistoryEntitySearchByC
|
|
|
382
391
|
export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.BILLING_HISTORY ? BillingHistoryEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.INTERMEDIARY_BANK ? IntermediaryBankEntityModel : T extends EntityEnum.PROJECT ? ProjectEntityModel : T extends EntityEnum.PROJECT_USER_MAPPING ? ProjectUserMappingEntityModel : T extends EntityEnum.REIMBURSEMENT ? ReimbursementEntityModel : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? ReimbursementExpenseEntityModel : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? BillingReimbursementExpneseEntityModel : T extends EntityEnum.BILLING_REIMBURESMENT_EXPENSE_HISTORY ? BillingReimbursementExpenseHistoryEntityModel : T extends EntityEnum.LEAVE ? LeaveEntityModel : T extends EntityEnum.WORK_FROM_HOME ? WorkFromHomeEntityModel : T extends EntityEnum.HOLIDAY ? HolidayEntityModel : T extends VirtualEntityEnum.LEAVE_COUNT ? LeaveCountVirtualEntityModel : T extends EntityEnum.CLIENT_AFFILIATE ? ClientAffiliateEntityModel : T extends EntityEnum.BANK ? BankEntityModel : T extends EntityEnum.CONFIGURATION ? ConfigurationEntityModel : T extends EntityEnum.TASK ? TaskEntityModel : T extends EntityEnum.BILLING_TIMESHEET ? BillingTimesheetEntityModel : T extends EntityEnum.BILLING_TIMESHEET_HISTORY ? BillingTimesheetHistoryEntityModel : T extends EntityEnum.TIMESHEET ? TimesheetEntityModel : T extends EntityEnum.TIMESHEET_HISTORY ? TimesheetHistoryEntityModel : T extends EntityEnum.COUNTRY ? CountryEntityModel : T extends EntityEnum.BILLING_TRANSACTION ? BillingTransactionEntityModel : T extends EntityEnum.BILLING_TRANSACTION_HISTORY ? BillingTransactionHistoryEntityModel : T extends EntityEnum.ADDRESS_BOOK ? AddressBookEntityModel : T extends EntityEnum.STATE ? StateEntityModel : T extends EntityEnum.GST_RATE ? GstRateEntityModel : T extends EntityEnum.ORGANIZATION_TYPE ? OrganizationTypeEntityModel : T extends EntityEnum.TDS_RATE ? TdsRateEntityModel : T extends EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING ? OrganizationTypeTdsRateMappingEntityModel : T extends EntityEnum.VOUCHER_TYPE ? VoucherTypeEntityModel : T extends EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING ? TdsRateVoucherTypeMappingEntityModel : T extends EntityEnum.ORGANIZATION ? OrganizationEntityModel : T extends EntityEnum.INDUSTRY ? IndustryEntityModel : T extends EntityEnum.EXPENSE_TYPE ? ExpenseTypeEntityModel : T extends EntityEnum.DESIGNATION ? DesignationEntityModel : T extends EntityEnum.RATE ? RateEntityModel : T extends EntityEnum.ROLE ? RoleEntityModel : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? RolePermissionMappingEntityModel : T extends EntityEnum.PERMISSION ? PermissionEntityModel : T extends EntityEnum.EXPENSE_HEAD ? ExpenseHeadEntityModel : T extends EntityEnum.DOCUMENT_UPLOAD ? DocumentUploadEntityModel : T extends EntityEnum.VENDOR ? VendorEntityModel : T extends EntityEnum.VENDOR_INVOICE ? VendorInvoiceEntityModel : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? VendorInvoiceHistoryEntityModel : T extends EntityEnum.OFFICE_LOCATION ? OfficeLocationEntityModel : T extends EntityEnum.VENDOR_INVOICE_ITEM ? VendorInvoiceItemEntityModel : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? VendorInvoiceItemHistoryEntityModel : T extends EntityEnum.VENDOR_HISTORY ? VendorHistoryEntityModel : T extends EntityEnum.WEBSITE_LEAD ? WebsiteLeadEntityModel : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? WebsiteNewsletterSubscriptionEntityModel : T extends EntityEnum.WORK_FROM_HOME_HISTORY ? WorkFromHomeHistoryEntityModel : T extends EntityEnum.LEAVE_HISTORY ? LeaveHistoryEntityModel : T extends EntityEnum.BANK_HISTORY ? BankHistoryEntityModel : T extends EntityEnum.REIMBURSEMENT_HISTORY ? ReimbursementHistoryEntityModel : T extends EntityEnum.CLIENT_USER_MAPPING ? ClientUserMappingEntityModel : T extends EntityEnum.CLIENT_INTRODUCING_MAPPING ? ClientIntroducingMappingEntityModel : T extends EntityEnum.HOLIDAY_LIST ? HolidayListEntityModel : T extends EntityEnum.CRON_JOBS ? CronJobsEntityModel : T extends EntityEnum.TO_DO_LIST ? ToDoListEntityModel : T extends EntityEnum.CLIENT_QUOTE ? ClientQuoteEntityModel : T extends EntityEnum.CLIENT_QUOTE_RATE ? ClientQuoteRateEntityModel : T extends EntityEnum.BILLING_PROFILE ? BillingProfileEntityModel : T extends EntityEnum.PROJECT_REVENUE_SPLIT_MAPPING ? ProjectRevenueSplitMappingEntityModel : T extends EntityEnum.WEBSITE_LEAD ? WebsiteLeadEntityModel : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? WebsiteNewsletterSubscriptionEntityModel : T extends EntityEnum.CLIENT_QUOTE ? ClientQuoteEntityModel : T extends EntityEnum.CLIENT_QUOTE_RATE ? ClientQuoteRateEntityModel : T extends EntityEnum.DESIGNATION ? DesignationEntityModel : T extends EntityEnum.RATE ? RateEntityModel : UserEntityModel;
|
|
383
392
|
export type EntityMap = {
|
|
384
393
|
[key in EntityEnum | VirtualEntityEnum]: EnumToModel<key>[];
|
|
394
|
+
} & {
|
|
395
|
+
aggregateEntities?: {
|
|
396
|
+
[key in EntityEnum | VirtualEntityEnum]: AggregationFields<EnumToModel<key>>[];
|
|
397
|
+
};
|
|
385
398
|
};
|
|
386
399
|
export type EntityIndexMap = {
|
|
387
400
|
[key in EntityEnum | VirtualEntityEnum]: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityEnum, EntityIndexMap, EntityMap, EnumEntityType, EnumToModel,
|
|
1
|
+
import { EntityEnum, EntityIndexMap, EntityMap, EnumEntityType, EnumToModel, IBaseEntityApiResponse, VirtualEntityEnum } from "../interface/entity.utils.interface";
|
|
2
2
|
import { BaseEntityModel } from "./base.entity.model";
|
|
3
3
|
export declare function mapToIndex(entityMap: EntityMap): EntityIndexMap;
|
|
4
4
|
export declare function getEntityIndexMap<T extends EntityEnum>(data: IBaseEntityApiResponse<EnumEntityType<T>>, baseEntity: T, reusedConfig?: {
|
|
@@ -12,11 +12,7 @@ export declare const entityEnumToEntityModel: {
|
|
|
12
12
|
export declare function entityMapToModels(entityMap: EntityMap): void;
|
|
13
13
|
export declare function parseEntities<T extends EnumEntityType<EntityEnum | VirtualEntityEnum>>(json: IBaseEntityApiResponse<T>, baseEntity: EntityEnum | VirtualEntityEnum, entityMap: EntityMap): EntityMap;
|
|
14
14
|
export declare function entityMapToEntityIndexMap(entityMap: EntityMap, entityRelationsFor: EntityEnum[]): EntityIndexMap;
|
|
15
|
-
export declare function parseEntitiesWithoutModels<T extends EnumEntityType<EntityEnum | VirtualEntityEnum>>(json: IBaseEntityApiResponse<T>, baseEntity: EntityEnum | VirtualEntityEnum, entityMap?:
|
|
16
|
-
[E in EntityEnum | VirtualEntityEnum]?: IApiEntity<EnumEntityType<E>>[];
|
|
17
|
-
}): {
|
|
18
|
-
[E in EntityEnum | VirtualEntityEnum]?: IApiEntity<EnumEntityType<E>>[];
|
|
19
|
-
};
|
|
15
|
+
export declare function parseEntitiesWithoutModels<T extends EnumEntityType<EntityEnum | VirtualEntityEnum>>(json: IBaseEntityApiResponse<T>, baseEntity: EntityEnum | VirtualEntityEnum, entityMap?: EntityMap): EntityMap;
|
|
20
16
|
export declare function removeEntityById(entityIndexMap: EntityIndexMap, entity: EntityEnum, id: number): void;
|
|
21
17
|
export declare class EntityModelRelationHelper {
|
|
22
18
|
private entityMap;
|
|
@@ -217,6 +217,14 @@ function parseEntitiesWithoutModels(json, baseEntity, entityMap = {}) {
|
|
|
217
217
|
relatedEntities[entityName], entityName, entityMap);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
+
if (json["aggregateEntities"]) {
|
|
221
|
+
if (!entityMap["aggregateEntities"]) {
|
|
222
|
+
entityMap["aggregateEntities"] = {};
|
|
223
|
+
}
|
|
224
|
+
for (const entityName in json["aggregateEntities"]) {
|
|
225
|
+
entityMap["aggregateEntities"][entityName] = json["aggregateEntities"][entityName];
|
|
226
|
+
}
|
|
227
|
+
}
|
|
220
228
|
return entityMap;
|
|
221
229
|
}
|
|
222
230
|
function removeEntityById(entityIndexMap, entity, id) {
|
|
@@ -233,7 +233,7 @@ class LeaveEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
233
233
|
message: [`Current user does not have permission to ${dto.actionData.action} leave`],
|
|
234
234
|
});
|
|
235
235
|
}
|
|
236
|
-
const nextStatus = matchingPermissionConfig.next();
|
|
236
|
+
const nextStatus = matchingPermissionConfig.next({});
|
|
237
237
|
return nextStatus;
|
|
238
238
|
}
|
|
239
239
|
mapStatusLabel(status) {
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { OrganizationTypeStatusEnum } from "../enums/organization_type_status_enum";
|
|
2
1
|
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
3
|
-
import { IOrganizationTypeEntity } from "../interface/organization_type.entity.interface";
|
|
4
|
-
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
5
2
|
import { BaseEntityModel } from "./base.entity.model";
|
|
3
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
|
+
import { IOrganizationTypeEntity } from "../interface/organization_type.entity.interface";
|
|
5
|
+
import { OrganizationTypeStatusEnum } from "../enums/organization_type_status_enum";
|
|
6
6
|
import { OrganizationTypeTdsRateMappingEntityModel } from "./organization_type_tds_rate_mapping.entity.model";
|
|
7
7
|
import { TdsRateEntityModel } from "./tds_rate.entity.model";
|
|
8
|
+
import { VendorEntityModel } from "./vendor.entity.model";
|
|
8
9
|
import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
|
|
10
|
+
import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
|
|
11
|
+
import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
|
|
12
|
+
import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
|
|
13
|
+
import { StateEntityModel } from "./state.entity.model";
|
|
14
|
+
import { CountryEntityModel } from "./country.entity.model";
|
|
15
|
+
import { OfficeLocationEntityModel } from "./office_location.entity.model";
|
|
16
|
+
import { GstRateEntityModel } from "./gst_rate.entity.model";
|
|
9
17
|
export declare class OrganizationTypeEntityModel extends BaseEntityModel<EntityEnum.ORGANIZATION_TYPE> implements IOrganizationTypeEntity {
|
|
10
18
|
id: number;
|
|
11
19
|
code: string;
|
|
@@ -16,9 +24,17 @@ export declare class OrganizationTypeEntityModel extends BaseEntityModel<EntityE
|
|
|
16
24
|
createdBy: number;
|
|
17
25
|
updatedBy: number;
|
|
18
26
|
organizationTypeTdsRateMappings?: OrganizationTypeTdsRateMappingEntityModel[];
|
|
19
|
-
|
|
27
|
+
vendors?: VendorEntityModel[];
|
|
28
|
+
static relationConfigs: RelationConfigs<[EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING, EntityEnum.VENDOR], EntityEnum.ORGANIZATION_TYPE>;
|
|
20
29
|
static fromEntity(entity: IOrganizationTypeEntity): OrganizationTypeEntityModel;
|
|
21
30
|
getRelationConfigs(): any[];
|
|
22
31
|
get tdsRates(): TdsRateEntityModel[];
|
|
23
|
-
get voucherTypes(): VoucherTypeEntityModel[];
|
|
32
|
+
get voucherTypes(): VoucherTypeEntityModel[] | undefined;
|
|
33
|
+
get expenseHeads(): ExpenseHeadEntityModel[] | undefined;
|
|
34
|
+
get vendorInvoiceItems(): VendorInvoiceItemEntityModel[] | undefined;
|
|
35
|
+
get vendorInvoices(): VendorInvoiceEntityModel[] | undefined;
|
|
36
|
+
get states(): StateEntityModel[] | undefined;
|
|
37
|
+
get countrys(): CountryEntityModel[] | undefined;
|
|
38
|
+
get officeLocations(): OfficeLocationEntityModel[] | undefined;
|
|
39
|
+
get gstRates(): GstRateEntityModel[] | undefined;
|
|
24
40
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrganizationTypeEntityModel = void 0;
|
|
4
|
-
const organization_type_status_enum_1 = require("../enums/organization_type_status_enum");
|
|
5
|
-
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
6
4
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
7
5
|
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
7
|
+
const organization_type_status_enum_1 = require("../enums/organization_type_status_enum");
|
|
8
8
|
class OrganizationTypeEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
@@ -32,18 +32,108 @@ class OrganizationTypeEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
32
32
|
return [];
|
|
33
33
|
}
|
|
34
34
|
get voucherTypes() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
voucherTypes.reduce((
|
|
41
|
-
if (!
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
return
|
|
45
|
-
},
|
|
46
|
-
|
|
35
|
+
// many_to_many -> many_to_many verified
|
|
36
|
+
// {'organization_type->tds_rate': 'many_to_many', 'tds_rate->voucher_type': 'many_to_many'}
|
|
37
|
+
// ['organization_type', 'tds_rate'] -> many_to_many
|
|
38
|
+
// ['tds_rate', 'voucher_type'] -> many_to_many
|
|
39
|
+
var _a;
|
|
40
|
+
return (_a = this.tdsRates) === null || _a === void 0 ? void 0 : _a.flatMap((tdsRate) => tdsRate.voucherTypes).filter((voucherType) => !!voucherType).reduce((accumulator, current) => {
|
|
41
|
+
if (!accumulator.some((voucherType) => voucherType.id === current.id)) {
|
|
42
|
+
accumulator.push(current);
|
|
43
|
+
}
|
|
44
|
+
return accumulator;
|
|
45
|
+
}, []);
|
|
46
|
+
}
|
|
47
|
+
get expenseHeads() {
|
|
48
|
+
// many_to_many -> many_to_many verified
|
|
49
|
+
// {'organization_type->tds_rate': 'many_to_many', 'tds_rate->voucher_type': 'many_to_many', 'voucher_type->expense_head': 'one_to_many'}
|
|
50
|
+
// ['tds_rate', 'voucher_type'] -> many_to_many
|
|
51
|
+
// ['voucher_type', 'expense_head'] -> one_to_many
|
|
52
|
+
var _a;
|
|
53
|
+
return (_a = this.voucherTypes) === null || _a === void 0 ? void 0 : _a.flatMap((voucherType) => voucherType.expenseHeads).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
|
|
54
|
+
if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
|
|
55
|
+
accumulator.push(current);
|
|
56
|
+
}
|
|
57
|
+
return accumulator;
|
|
58
|
+
}, []);
|
|
59
|
+
}
|
|
60
|
+
get vendorInvoiceItems() {
|
|
61
|
+
// one_to_many -> one_to_many verified
|
|
62
|
+
// {'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many'}
|
|
63
|
+
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
64
|
+
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
65
|
+
var _a;
|
|
66
|
+
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.vendorInvoiceItems).filter((vendorInvoiceItem) => !!vendorInvoiceItem).reduce((accumulator, current) => {
|
|
67
|
+
if (!accumulator.some((vendorInvoiceItem) => vendorInvoiceItem.id === current.id)) {
|
|
68
|
+
accumulator.push(current);
|
|
69
|
+
}
|
|
70
|
+
return accumulator;
|
|
71
|
+
}, []);
|
|
72
|
+
}
|
|
73
|
+
get vendorInvoices() {
|
|
74
|
+
// one_to_many -> one_to_many verified
|
|
75
|
+
// {'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many'}
|
|
76
|
+
// ['organization_type', 'vendor'] -> one_to_many
|
|
77
|
+
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
78
|
+
var _a;
|
|
79
|
+
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorInvoices).filter((vendorInvoice) => !!vendorInvoice).reduce((accumulator, current) => {
|
|
80
|
+
if (!accumulator.some((vendorInvoice) => vendorInvoice.id === current.id)) {
|
|
81
|
+
accumulator.push(current);
|
|
82
|
+
}
|
|
83
|
+
return accumulator;
|
|
84
|
+
}, []);
|
|
85
|
+
}
|
|
86
|
+
get states() {
|
|
87
|
+
// many_to_many -> many_to_many verified
|
|
88
|
+
// {'organization_type->vendor': 'one_to_many', 'vendor->state': 'many_to_one'}
|
|
89
|
+
// ['organization_type', 'vendor'] -> one_to_many
|
|
90
|
+
// ['vendor', 'state'] -> many_to_one
|
|
91
|
+
var _a;
|
|
92
|
+
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.stateModel).filter((state) => !!state).reduce((accumulator, current) => {
|
|
93
|
+
if (!accumulator.some((state) => state.id === current.id)) {
|
|
94
|
+
accumulator.push(current);
|
|
95
|
+
}
|
|
96
|
+
return accumulator;
|
|
97
|
+
}, []);
|
|
98
|
+
}
|
|
99
|
+
get countrys() {
|
|
100
|
+
// many_to_many -> many_to_many verified
|
|
101
|
+
// {'organization_type->vendor': 'one_to_many', 'vendor->country': 'many_to_one'}
|
|
102
|
+
// ['organization_type', 'vendor'] -> one_to_many
|
|
103
|
+
// ['vendor', 'country'] -> many_to_one
|
|
104
|
+
var _a;
|
|
105
|
+
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.countryModel).filter((country) => !!country).reduce((accumulator, current) => {
|
|
106
|
+
if (!accumulator.some((country) => country.id === current.id)) {
|
|
107
|
+
accumulator.push(current);
|
|
108
|
+
}
|
|
109
|
+
return accumulator;
|
|
110
|
+
}, []);
|
|
111
|
+
}
|
|
112
|
+
get officeLocations() {
|
|
113
|
+
// many_to_many -> many_to_many verified
|
|
114
|
+
// {'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->office_location': 'many_to_one'}
|
|
115
|
+
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
116
|
+
// ['vendor_invoice', 'office_location'] -> many_to_one
|
|
117
|
+
var _a;
|
|
118
|
+
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.officeLocation).filter((officeLocation) => !!officeLocation).reduce((accumulator, current) => {
|
|
119
|
+
if (!accumulator.some((officeLocation) => officeLocation.id === current.id)) {
|
|
120
|
+
accumulator.push(current);
|
|
121
|
+
}
|
|
122
|
+
return accumulator;
|
|
123
|
+
}, []);
|
|
124
|
+
}
|
|
125
|
+
get gstRates() {
|
|
126
|
+
// many_to_many -> many_to_many verified
|
|
127
|
+
// {'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
|
|
128
|
+
// ['vendor_invoice', 'vendor_invoice_item'] -> one_to_many
|
|
129
|
+
// ['vendor_invoice_item', 'gst_rate'] -> many_to_one
|
|
130
|
+
var _a;
|
|
131
|
+
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
|
|
132
|
+
if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
|
|
133
|
+
accumulator.push(current);
|
|
134
|
+
}
|
|
135
|
+
return accumulator;
|
|
136
|
+
}, []);
|
|
47
137
|
}
|
|
48
138
|
}
|
|
49
139
|
exports.OrganizationTypeEntityModel = OrganizationTypeEntityModel;
|
|
@@ -57,4 +147,13 @@ OrganizationTypeEntityModel.relationConfigs = [
|
|
|
57
147
|
key: "id",
|
|
58
148
|
},
|
|
59
149
|
},
|
|
150
|
+
{
|
|
151
|
+
name: entity_utils_interface_1.EntityEnum.VENDOR,
|
|
152
|
+
relation: relation_type_enum_1.RelationType.MANY,
|
|
153
|
+
key: "vendors",
|
|
154
|
+
mapKeyConfig: {
|
|
155
|
+
relationKey: "organizationTypeId",
|
|
156
|
+
key: "id",
|
|
157
|
+
},
|
|
158
|
+
},
|
|
60
159
|
];
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import { TdsRateStatusEnum } from "../enums/tds_rate_status_enum";
|
|
2
1
|
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
2
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
3
3
|
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
4
|
import { ITdsRateEntity } from "../interface/tds_rate.entity.interface";
|
|
5
|
-
import {
|
|
5
|
+
import { TdsRateStatusEnum } from "../enums/tds_rate_status_enum";
|
|
6
6
|
import { OrganizationTypeTdsRateMappingEntityModel } from "./organization_type_tds_rate_mapping.entity.model";
|
|
7
7
|
import { TdsRateVoucherTypeMappingEntityModel } from "./tds_rate_voucher_type_mapping.entity.model";
|
|
8
|
+
import { OrganizationTypeEntityModel } from "./organization_type.entity.model";
|
|
9
|
+
import { VoucherTypeEntityModel } from "./voucher_type.entity.model";
|
|
10
|
+
import { VendorInvoiceItemEntityModel } from "./vendor_invoice_item.entity.model";
|
|
11
|
+
import { VendorEntityModel } from "./vendor.entity.model";
|
|
12
|
+
import { StateEntityModel } from "./state.entity.model";
|
|
13
|
+
import { CountryEntityModel } from "./country.entity.model";
|
|
14
|
+
import { VendorInvoiceEntityModel } from "./vendor_invoice.entity.model";
|
|
15
|
+
import { OfficeLocationEntityModel } from "./office_location.entity.model";
|
|
16
|
+
import { ExpenseHeadEntityModel } from "./expense_head.entity.model";
|
|
17
|
+
import { GstRateEntityModel } from "./gst_rate.entity.model";
|
|
8
18
|
export declare class TdsRateEntityModel extends BaseEntityModel<EntityEnum.TDS_RATE> implements ITdsRateEntity {
|
|
9
19
|
id: number;
|
|
10
20
|
section: string;
|
|
@@ -20,9 +30,23 @@ export declare class TdsRateEntityModel extends BaseEntityModel<EntityEnum.TDS_R
|
|
|
20
30
|
updatedBy: number;
|
|
21
31
|
organizationTypeTdsRateMappings?: OrganizationTypeTdsRateMappingEntityModel[];
|
|
22
32
|
tdsRateVoucherTypeMappings?: TdsRateVoucherTypeMappingEntityModel[];
|
|
23
|
-
|
|
33
|
+
vendorInvoiceItems?: VendorInvoiceItemEntityModel[];
|
|
34
|
+
static relationConfigs: RelationConfigs<[
|
|
35
|
+
EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING,
|
|
36
|
+
EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING,
|
|
37
|
+
EntityEnum.VENDOR_INVOICE_ITEM
|
|
38
|
+
], EntityEnum.TDS_RATE>;
|
|
24
39
|
static fromEntity(entity: ITdsRateEntity): TdsRateEntityModel;
|
|
25
40
|
getRelationConfigs(): any[];
|
|
41
|
+
get organizationTypes(): OrganizationTypeEntityModel[];
|
|
42
|
+
get voucherTypes(): VoucherTypeEntityModel[];
|
|
43
|
+
get vendors(): VendorEntityModel[] | undefined;
|
|
44
|
+
get states(): StateEntityModel[] | undefined;
|
|
45
|
+
get countrys(): CountryEntityModel[] | undefined;
|
|
46
|
+
get vendorInvoices(): VendorInvoiceEntityModel[] | undefined;
|
|
47
|
+
get officeLocations(): OfficeLocationEntityModel[] | undefined;
|
|
48
|
+
get expenseHeads(): ExpenseHeadEntityModel[] | undefined;
|
|
49
|
+
get gstRates(): GstRateEntityModel[] | undefined;
|
|
26
50
|
get organizationTypeIds(): number[];
|
|
27
51
|
static getTdsNotApplicableRate(tdsRateEntityModels: TdsRateEntityModel[]): TdsRateEntityModel | undefined;
|
|
28
52
|
isTdsNotApplicable(): boolean;
|