law-common 10.72.2-beta.2 → 10.72.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 +11 -2
- package/dist/src/api/interface/vendor.create.dto.interface.autocode.js +3 -12
- package/dist/src/api/interface/vendor.entity.response.d.ts +10 -4
- 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/interface/reimbursement.entity.interface.d.ts +3 -0
- package/dist/src/entities/model/leave.entity.model.js +1 -1
- package/dist/src/entities/model/organization_type.entity.model.d.ts +5 -21
- package/dist/src/entities/model/organization_type.entity.model.js +14 -113
- package/dist/src/entities/model/reimbursement.entity.model.d.ts +1 -0
- package/dist/src/entities/model/reimbursement.entity.model.js +1 -0
- package/dist/src/entities/model/tds_rate.entity.model.d.ts +3 -27
- package/dist/src/entities/model/tds_rate.entity.model.js +2 -114
- package/dist/src/entities/model/vendor.entity.model.d.ts +32 -44
- package/dist/src/entities/model/vendor.entity.model.js +53 -132
- package/dist/src/entities/model/vendor_invoice_item.entity.model.autocode.js +0 -40
- package/dist/src/entities/model/vendor_invoice_item.entity.model.d.ts +15 -24
- package/dist/src/entities/model/vendor_invoice_item.entity.model.js +5 -44
- package/dist/src/entities/model/voucher_type.entity.model.d.ts +5 -25
- package/dist/src/entities/model/voucher_type.entity.model.js +2 -102
- 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,7 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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 =
|
|
7
|
+
export type ILeaveFlowConfig = {
|
|
8
|
+
[key in LeaveStatusEnum]?: {
|
|
9
|
+
actions: {
|
|
10
|
+
[key in LeaveActionEnum]?: {
|
|
11
|
+
permissions: string[];
|
|
12
|
+
next: () => LeaveStatusEnum;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -22,19 +22,10 @@
|
|
|
22
22
|
// }
|
|
23
23
|
// export type IVendorBankDetailCreateExclude = never;
|
|
24
24
|
// export interface IVendorBankDetailCreateDto extends Omit<IEntityCreateDto<IVendorBankDetailEntity>, IVendorBankDetailCreateExclude> {}
|
|
25
|
-
// export type IVendorCreateExclude =
|
|
26
|
-
// | "contactDetail"
|
|
27
|
-
// | "bankDetail"
|
|
28
|
-
// | "organizationTypeId"
|
|
29
|
-
// | "status"
|
|
30
|
-
// | "remark"
|
|
31
|
-
// | "panDocument"
|
|
32
|
-
// | "gstDocument"
|
|
33
|
-
// | "contractDocument"
|
|
34
|
-
// | "attachmentDocuments";
|
|
25
|
+
// export type IVendorCreateExclude = "contactDetail" | "bankDetail" | "panDocument" | "gstDocument" | "contractDocument" | "attachmentDocuments";
|
|
35
26
|
// export interface IVendorCreateDto extends Omit<IEntityCreateDto<IVendorEntity>, IVendorCreateExclude> {
|
|
36
|
-
// contactDetail?:
|
|
37
|
-
// bankDetail?:
|
|
27
|
+
// contactDetail?: IVendorContactDetailEntity;
|
|
28
|
+
// bankDetail?: IVendorBankDetailEntity;
|
|
38
29
|
// panDocument?: Nullable<MulterFileWithUrl>;
|
|
39
30
|
// gstDocument?: Nullable<MulterFileWithUrl>;
|
|
40
31
|
// contractDocument?: Nullable<MulterFileWithUrl>;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { VendorActionEnum } from "../../entities/enums/vendor-action.enum";
|
|
2
2
|
import { VendorStatusEnum } from "../../entities/enums/vendor-status.enum";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export type IVendorFlowConfig = {
|
|
4
|
+
[key in VendorStatusEnum]?: {
|
|
5
|
+
actions: {
|
|
6
|
+
[key in VendorActionEnum]?: {
|
|
7
|
+
permissions: string[];
|
|
8
|
+
next: () => VendorStatusEnum;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -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 S - String enum of all possible statuses
|
|
9
|
+
* @template A - String enum of all possible actions
|
|
10
|
+
* @template T - 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<S extends string, A extends string, T extends Record<any, any> = never> = {
|
|
31
|
+
[key in S]?: {
|
|
32
32
|
actions: {
|
|
33
|
-
[key in
|
|
33
|
+
[key in A]?: IFlowConfigActionConfig<S, T>;
|
|
34
34
|
};
|
|
35
35
|
description?: string;
|
|
36
36
|
};
|
|
@@ -39,8 +39,8 @@ export type FlowConfig<STATUS_ENUM_TYPE extends string, ACTION_ENUM_TYPE extends
|
|
|
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 S - String enum of statuses, used as the return type of `next()`
|
|
43
|
+
* @template T - 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<STATUS_ENUM_TYPE extends string, ACTION_ENUM_TYPE extends
|
|
|
58
58
|
* next: (data) => areAllRowsApproved(data) ? ReimbursementStatusEnum.APPROVED : ReimbursementStatusEnum.APPROVAL_PENDING,
|
|
59
59
|
* };
|
|
60
60
|
*/
|
|
61
|
-
export interface IFlowConfigActionConfig<
|
|
61
|
+
export interface IFlowConfigActionConfig<S extends string, T> {
|
|
62
62
|
permissions: string[];
|
|
63
|
-
next: (data
|
|
63
|
+
next: (data?: T) => S;
|
|
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>;
|
|
@@ -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: (
|
|
11
|
+
next: () => vendor_status_enum_1.VendorStatusEnum.APPROVED,
|
|
12
12
|
},
|
|
13
13
|
[vendor_action_enum_1.VendorActionEnum.EDIT]: {
|
|
14
14
|
permissions: ["VENDOR_UPDATE"],
|
|
15
|
-
next: (
|
|
15
|
+
next: () => 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: (
|
|
19
|
+
next: () => vendor_status_enum_1.VendorStatusEnum.REJECTED,
|
|
20
20
|
},
|
|
21
21
|
[vendor_action_enum_1.VendorActionEnum.DELETE]: {
|
|
22
22
|
permissions: ["VENDOR_UPDATE"],
|
|
23
|
-
next: (
|
|
23
|
+
next: () => 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: (
|
|
31
|
+
next: () => vendor_status_enum_1.VendorStatusEnum.APPROVED,
|
|
32
32
|
},
|
|
33
33
|
[vendor_action_enum_1.VendorActionEnum.EDIT]: {
|
|
34
34
|
permissions: ["VENDOR_UPDATE"],
|
|
35
|
-
next: (
|
|
35
|
+
next: () => 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: (
|
|
39
|
+
next: () => vendor_status_enum_1.VendorStatusEnum.RESOLVED_REJECTED,
|
|
40
40
|
},
|
|
41
41
|
// [VendorActionEnum.RECALL]: {
|
|
42
42
|
// permissions: ["VENDOR_UPDATE"],
|
|
43
|
-
// next: (
|
|
43
|
+
// next: () => 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: (
|
|
51
|
+
next: () => vendor_status_enum_1.VendorStatusEnum.DELETED,
|
|
52
52
|
},
|
|
53
53
|
[vendor_action_enum_1.VendorActionEnum.REJECT]: {
|
|
54
54
|
permissions: ["VENDOR_APPROVE_ORG"],
|
|
55
|
-
next: (
|
|
55
|
+
next: () => vendor_status_enum_1.VendorStatusEnum.RESOLVED_REJECTED,
|
|
56
56
|
},
|
|
57
57
|
// [VendorActionEnum.RECALL]: {
|
|
58
58
|
// permissions: ["VENDOR_UPDATE"],
|
|
59
|
-
// next: (
|
|
59
|
+
// next: () => 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: (
|
|
67
|
+
next: () => vendor_status_enum_1.VendorStatusEnum.EDIT_APPROVAL,
|
|
68
68
|
},
|
|
69
69
|
[vendor_action_enum_1.VendorActionEnum.DELETE]: {
|
|
70
70
|
permissions: ["VENDOR_UPDATE"],
|
|
71
|
-
next: (
|
|
71
|
+
next: () => 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: (
|
|
79
|
+
next: () => vendor_status_enum_1.VendorStatusEnum.EDIT_APPROVAL,
|
|
80
80
|
},
|
|
81
81
|
[vendor_action_enum_1.VendorActionEnum.DELETE]: {
|
|
82
82
|
permissions: ["VENDOR_UPDATE"],
|
|
83
|
-
next: (
|
|
83
|
+
next: () => 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: string | number;
|
|
373
|
+
oldValue: string | number;
|
|
374
374
|
timeStamp: number;
|
|
375
375
|
};
|
|
376
376
|
export declare enum VirtualEntityEnum {
|
|
@@ -2,6 +2,7 @@ import { ReimbursementActionEnum, ReimbursementBillingPresentEnum, Reimbursement
|
|
|
2
2
|
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
3
3
|
import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
|
|
4
4
|
import { IProjectUserMappingEntity } from "./project.entity.interface";
|
|
5
|
+
import { IUserEntity } from "./user.entity.interface";
|
|
5
6
|
export interface IReimbursementEntity extends IEntityAuditColumn {
|
|
6
7
|
id: number;
|
|
7
8
|
billingType: ReimbursementBillingTypeEnum;
|
|
@@ -22,6 +23,7 @@ export interface IReimbursementEntity extends IEntityAuditColumn {
|
|
|
22
23
|
disbursementDate?: string;
|
|
23
24
|
referenceNo?: string;
|
|
24
25
|
bankId?: number;
|
|
26
|
+
incurredByUserId: number;
|
|
25
27
|
}
|
|
26
28
|
export interface IReimbursementExpenseAllocation {
|
|
27
29
|
id: number;
|
|
@@ -38,6 +40,7 @@ export interface IReimbursementCreateDtoExtra {
|
|
|
38
40
|
attachmentDocumentUrls?: string[];
|
|
39
41
|
}
|
|
40
42
|
export interface IReimbursementEntityCreateDtoValidationData {
|
|
43
|
+
incurredByUser: IUserEntity;
|
|
41
44
|
projectUserMappingEntities: IProjectUserMappingEntity[];
|
|
42
45
|
}
|
|
43
46
|
export interface IReimbursementEntityUpdateDtoValidationData {
|
|
@@ -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,19 +1,11 @@
|
|
|
1
|
+
import { OrganizationTypeStatusEnum } from "../enums/organization_type_status_enum";
|
|
1
2
|
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
2
|
-
import { BaseEntityModel } from "./base.entity.model";
|
|
3
|
-
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
3
|
import { IOrganizationTypeEntity } from "../interface/organization_type.entity.interface";
|
|
5
|
-
import {
|
|
4
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
5
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
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";
|
|
9
8
|
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";
|
|
17
9
|
export declare class OrganizationTypeEntityModel extends BaseEntityModel<EntityEnum.ORGANIZATION_TYPE> implements IOrganizationTypeEntity {
|
|
18
10
|
id: number;
|
|
19
11
|
code: string;
|
|
@@ -24,17 +16,9 @@ export declare class OrganizationTypeEntityModel extends BaseEntityModel<EntityE
|
|
|
24
16
|
createdBy: number;
|
|
25
17
|
updatedBy: number;
|
|
26
18
|
organizationTypeTdsRateMappings?: OrganizationTypeTdsRateMappingEntityModel[];
|
|
27
|
-
|
|
28
|
-
static relationConfigs: RelationConfigs<[EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING, EntityEnum.VENDOR], EntityEnum.ORGANIZATION_TYPE>;
|
|
19
|
+
static relationConfigs: RelationConfigs<[EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING], EntityEnum.ORGANIZATION_TYPE>;
|
|
29
20
|
static fromEntity(entity: IOrganizationTypeEntity): OrganizationTypeEntityModel;
|
|
30
21
|
getRelationConfigs(): any[];
|
|
31
22
|
get tdsRates(): TdsRateEntityModel[];
|
|
32
|
-
get voucherTypes(): VoucherTypeEntityModel[]
|
|
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;
|
|
23
|
+
get voucherTypes(): VoucherTypeEntityModel[];
|
|
40
24
|
}
|
|
@@ -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");
|
|
4
6
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
5
7
|
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,108 +32,18 @@ class OrganizationTypeEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
32
32
|
return [];
|
|
33
33
|
}
|
|
34
34
|
get voucherTypes() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
return
|
|
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
|
-
}, []);
|
|
35
|
+
const tdsRateVoucherTypeMappings = this.tdsRates.map((tdsRate) => tdsRate.tdsRateVoucherTypeMappings || []).flat();
|
|
36
|
+
const voucherTypes = tdsRateVoucherTypeMappings.filter((mapping) => mapping.voucherType).map((mapping) => mapping.voucherType);
|
|
37
|
+
// remove duplicate voucher types based on id
|
|
38
|
+
const uniqueVoucherTypesMap = {};
|
|
39
|
+
// Use Reduce to create a map of unique voucher types
|
|
40
|
+
voucherTypes.reduce((acc, voucherType) => {
|
|
41
|
+
if (!acc[voucherType.id]) {
|
|
42
|
+
acc[voucherType.id] = voucherType;
|
|
43
|
+
}
|
|
44
|
+
return acc;
|
|
45
|
+
}, uniqueVoucherTypesMap);
|
|
46
|
+
return Object.values(uniqueVoucherTypesMap);
|
|
137
47
|
}
|
|
138
48
|
}
|
|
139
49
|
exports.OrganizationTypeEntityModel = OrganizationTypeEntityModel;
|
|
@@ -147,13 +57,4 @@ OrganizationTypeEntityModel.relationConfigs = [
|
|
|
147
57
|
key: "id",
|
|
148
58
|
},
|
|
149
59
|
},
|
|
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
|
-
},
|
|
159
60
|
];
|
|
@@ -17,6 +17,7 @@ class ReimbursementEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
17
17
|
this.description = "";
|
|
18
18
|
this.status = reimbursement_entity_enum_1.ReimbursementStatusEnum.APPROVAL_PENDING;
|
|
19
19
|
this.paymentStatus = reimbursement_entity_enum_1.ReimbursementPaymentStatusEnum.UNPAID;
|
|
20
|
+
this.incurredByUserId = 0;
|
|
20
21
|
this.createdBy = 0;
|
|
21
22
|
this.updatedBy = 0;
|
|
22
23
|
this.createdOn = 0;
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
+
import { TdsRateStatusEnum } from "../enums/tds_rate_status_enum";
|
|
1
2
|
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 { BaseEntityModel } from "./base.entity.model";
|
|
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";
|
|
18
8
|
export declare class TdsRateEntityModel extends BaseEntityModel<EntityEnum.TDS_RATE> implements ITdsRateEntity {
|
|
19
9
|
id: number;
|
|
20
10
|
section: string;
|
|
@@ -30,23 +20,9 @@ export declare class TdsRateEntityModel extends BaseEntityModel<EntityEnum.TDS_R
|
|
|
30
20
|
updatedBy: number;
|
|
31
21
|
organizationTypeTdsRateMappings?: OrganizationTypeTdsRateMappingEntityModel[];
|
|
32
22
|
tdsRateVoucherTypeMappings?: TdsRateVoucherTypeMappingEntityModel[];
|
|
33
|
-
|
|
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>;
|
|
23
|
+
static relationConfigs: RelationConfigs<[EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING, EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING], EntityEnum.TDS_RATE>;
|
|
39
24
|
static fromEntity(entity: ITdsRateEntity): TdsRateEntityModel;
|
|
40
25
|
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;
|
|
50
26
|
get organizationTypeIds(): number[];
|
|
51
27
|
static getTdsNotApplicableRate(tdsRateEntityModels: TdsRateEntityModel[]): TdsRateEntityModel | undefined;
|
|
52
28
|
isTdsNotApplicable(): boolean;
|