law-common 10.72.1 → 10.72.2-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/README.md +1 -1
- 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/entity.utils.interface.d.ts +2 -2
- 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 +41 -41
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# law-common
|
|
1
|
+
# law-common
|
|
@@ -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
|
},
|
|
@@ -369,8 +369,8 @@ export type IHistoryEntitySearchByConstraintResponse<T> = {
|
|
|
369
369
|
export type IHistoryEntityChangedLogs<T> = {
|
|
370
370
|
key: keyof T;
|
|
371
371
|
label: string;
|
|
372
|
-
newValue:
|
|
373
|
-
oldValue:
|
|
372
|
+
newValue: T[keyof T];
|
|
373
|
+
oldValue: T[keyof T] | null;
|
|
374
374
|
timeStamp: number;
|
|
375
375
|
};
|
|
376
376
|
export declare enum VirtualEntityEnum {
|
|
@@ -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;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TdsRateEntityModel = void 0;
|
|
4
|
-
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
5
|
-
const tds_rate_status_enum_1 = require("../enums/tds_rate_status_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 tds_rate_status_enum_1 = require("../enums/tds_rate_status_enum");
|
|
8
8
|
class TdsRateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
@@ -28,6 +28,109 @@ class TdsRateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
28
28
|
getRelationConfigs() {
|
|
29
29
|
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
30
30
|
}
|
|
31
|
+
get organizationTypes() {
|
|
32
|
+
if (this.organizationTypeTdsRateMappings) {
|
|
33
|
+
return this.organizationTypeTdsRateMappings.filter((mapping) => mapping.organizationType).map((mapping) => mapping.organizationType);
|
|
34
|
+
}
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
get voucherTypes() {
|
|
38
|
+
if (this.tdsRateVoucherTypeMappings) {
|
|
39
|
+
return this.tdsRateVoucherTypeMappings.filter((mapping) => mapping.voucherType).map((mapping) => mapping.voucherType);
|
|
40
|
+
}
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
get vendors() {
|
|
44
|
+
// many_to_many -> many_to_many verified
|
|
45
|
+
// {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many'}
|
|
46
|
+
// ['tds_rate', 'organization_type'] -> many_to_many
|
|
47
|
+
// ['organization_type', 'vendor'] -> one_to_many
|
|
48
|
+
var _a;
|
|
49
|
+
return (_a = this.organizationTypes) === null || _a === void 0 ? void 0 : _a.flatMap((organizationType) => organizationType.vendors).filter((vendor) => !!vendor).reduce((accumulator, current) => {
|
|
50
|
+
if (!accumulator.some((vendor) => vendor.id === current.id)) {
|
|
51
|
+
accumulator.push(current);
|
|
52
|
+
}
|
|
53
|
+
return accumulator;
|
|
54
|
+
}, []);
|
|
55
|
+
}
|
|
56
|
+
get states() {
|
|
57
|
+
// many_to_many -> many_to_many verified
|
|
58
|
+
// {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->state': 'many_to_one'}
|
|
59
|
+
// ['organization_type', 'vendor'] -> one_to_many
|
|
60
|
+
// ['vendor', 'state'] -> many_to_one
|
|
61
|
+
var _a;
|
|
62
|
+
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.stateModel).filter((state) => !!state).reduce((accumulator, current) => {
|
|
63
|
+
if (!accumulator.some((state) => state.id === current.id)) {
|
|
64
|
+
accumulator.push(current);
|
|
65
|
+
}
|
|
66
|
+
return accumulator;
|
|
67
|
+
}, []);
|
|
68
|
+
}
|
|
69
|
+
get countrys() {
|
|
70
|
+
// many_to_many -> many_to_many verified
|
|
71
|
+
// {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->country': 'many_to_one'}
|
|
72
|
+
// ['organization_type', 'vendor'] -> one_to_many
|
|
73
|
+
// ['vendor', 'country'] -> many_to_one
|
|
74
|
+
var _a;
|
|
75
|
+
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.countryModel).filter((country) => !!country).reduce((accumulator, current) => {
|
|
76
|
+
if (!accumulator.some((country) => country.id === current.id)) {
|
|
77
|
+
accumulator.push(current);
|
|
78
|
+
}
|
|
79
|
+
return accumulator;
|
|
80
|
+
}, []);
|
|
81
|
+
}
|
|
82
|
+
get vendorInvoices() {
|
|
83
|
+
// one_to_many -> many_to_many mismatch
|
|
84
|
+
// {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many'}
|
|
85
|
+
// ['organization_type', 'vendor'] -> one_to_many
|
|
86
|
+
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
87
|
+
var _a;
|
|
88
|
+
return (_a = this.vendors) === null || _a === void 0 ? void 0 : _a.flatMap((vendor) => vendor.vendorInvoices).filter((vendorInvoice) => !!vendorInvoice).reduce((accumulator, current) => {
|
|
89
|
+
if (!accumulator.some((vendorInvoice) => vendorInvoice.id === current.id)) {
|
|
90
|
+
accumulator.push(current);
|
|
91
|
+
}
|
|
92
|
+
return accumulator;
|
|
93
|
+
}, []);
|
|
94
|
+
}
|
|
95
|
+
get officeLocations() {
|
|
96
|
+
// many_to_many -> many_to_many verified
|
|
97
|
+
// {'tds_rate->organization_type': 'many_to_many', 'organization_type->vendor': 'one_to_many', 'vendor->vendor_invoice': 'one_to_many', 'vendor_invoice->office_location': 'many_to_one'}
|
|
98
|
+
// ['vendor', 'vendor_invoice'] -> one_to_many
|
|
99
|
+
// ['vendor_invoice', 'office_location'] -> many_to_one
|
|
100
|
+
var _a;
|
|
101
|
+
return (_a = this.vendorInvoices) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoice) => vendorInvoice.officeLocation).filter((officeLocation) => !!officeLocation).reduce((accumulator, current) => {
|
|
102
|
+
if (!accumulator.some((officeLocation) => officeLocation.id === current.id)) {
|
|
103
|
+
accumulator.push(current);
|
|
104
|
+
}
|
|
105
|
+
return accumulator;
|
|
106
|
+
}, []);
|
|
107
|
+
}
|
|
108
|
+
get expenseHeads() {
|
|
109
|
+
// many_to_many -> many_to_many verified
|
|
110
|
+
// {'tds_rate->voucher_type': 'many_to_many', 'voucher_type->expense_head': 'one_to_many'}
|
|
111
|
+
// ['tds_rate', 'voucher_type'] -> many_to_many
|
|
112
|
+
// ['voucher_type', 'expense_head'] -> one_to_many
|
|
113
|
+
var _a;
|
|
114
|
+
return (_a = this.voucherTypes) === null || _a === void 0 ? void 0 : _a.flatMap((voucherType) => voucherType.expenseHeads).filter((expenseHead) => !!expenseHead).reduce((accumulator, current) => {
|
|
115
|
+
if (!accumulator.some((expenseHead) => expenseHead.id === current.id)) {
|
|
116
|
+
accumulator.push(current);
|
|
117
|
+
}
|
|
118
|
+
return accumulator;
|
|
119
|
+
}, []);
|
|
120
|
+
}
|
|
121
|
+
get gstRates() {
|
|
122
|
+
// many_to_many -> many_to_many verified
|
|
123
|
+
// {'tds_rate->vendor_invoice_item': 'one_to_many', 'vendor_invoice_item->gst_rate': 'many_to_one'}
|
|
124
|
+
// ['tds_rate', 'vendor_invoice_item'] -> one_to_many
|
|
125
|
+
// ['vendor_invoice_item', 'gst_rate'] -> many_to_one
|
|
126
|
+
var _a;
|
|
127
|
+
return (_a = this.vendorInvoiceItems) === null || _a === void 0 ? void 0 : _a.flatMap((vendorInvoiceItem) => vendorInvoiceItem.gstRate).filter((gstRate) => !!gstRate).reduce((accumulator, current) => {
|
|
128
|
+
if (!accumulator.some((gstRate) => gstRate.id === current.id)) {
|
|
129
|
+
accumulator.push(current);
|
|
130
|
+
}
|
|
131
|
+
return accumulator;
|
|
132
|
+
}, []);
|
|
133
|
+
}
|
|
31
134
|
get organizationTypeIds() {
|
|
32
135
|
var _a;
|
|
33
136
|
return ((_a = this.organizationTypeTdsRateMappings) === null || _a === void 0 ? void 0 : _a.map((mapping) => mapping.organizationTypeId)) || [];
|
|
@@ -59,4 +162,13 @@ TdsRateEntityModel.relationConfigs = [
|
|
|
59
162
|
key: "id",
|
|
60
163
|
},
|
|
61
164
|
},
|
|
165
|
+
{
|
|
166
|
+
name: entity_utils_interface_1.EntityEnum.VENDOR_INVOICE_ITEM,
|
|
167
|
+
relation: relation_type_enum_1.RelationType.MANY,
|
|
168
|
+
key: "vendorInvoiceItems",
|
|
169
|
+
mapKeyConfig: {
|
|
170
|
+
relationKey: "tdsRateId",
|
|
171
|
+
key: "id",
|
|
172
|
+
},
|
|
173
|
+
},
|
|
62
174
|
];
|