law-common 10.17.0 → 10.17.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/api/index.d.ts +1 -0
- package/dist/src/api/index.js +1 -0
- package/dist/src/api/interface/billing-reimbursement-expense-history.api.d.ts +4 -0
- package/dist/src/api/interface/billing-reimbursement-expense-history.api.js +2 -0
- package/dist/src/api/interface/billing.create.dto.interface.d.ts +17 -3
- package/dist/src/api/interface/billing.entity.response.d.ts +3 -2
- package/dist/src/entities/enums/billing-reimburement-expense-impact.enum.d.ts +5 -0
- package/dist/src/entities/enums/billing-reimburement-expense-impact.enum.js +9 -0
- package/dist/src/entities/enums/billing-reimbursement-expense-change-status.enum.d.ts +5 -0
- package/dist/src/entities/enums/billing-reimbursement-expense-change-status.enum.js +9 -0
- package/dist/src/entities/enums/billing-type.enum.d.ts +5 -0
- package/dist/src/entities/enums/billing-type.enum.js +9 -0
- package/dist/src/entities/index.d.ts +5 -0
- package/dist/src/entities/index.js +5 -0
- package/dist/src/entities/interface/billing-reimbursement-expense-history.entity.interface.d.ts +7 -0
- package/dist/src/entities/interface/billing-reimbursement-expense-history.entity.interface.js +2 -0
- package/dist/src/entities/interface/billing-reimbursement-expense.entity.interface.d.ts +23 -0
- package/dist/src/entities/interface/billing-reimbursement-expense.entity.interface.js +2 -0
- package/dist/src/entities/interface/billing.entity.interface.d.ts +2 -0
- package/dist/src/entities/interface/entity.utils.interface.d.ts +35 -1
- package/dist/src/entities/interface/entity.utils.interface.js +32 -0
- package/dist/src/utils/helper.fn.util.d.ts +29 -0
- package/dist/src/utils/helper.fn.util.js +52 -0
- package/package.json +35 -35
package/dist/src/api/index.d.ts
CHANGED
|
@@ -80,3 +80,4 @@ export * from "./interface/holiday-list.entity.response";
|
|
|
80
80
|
export * from "./interface/cron-job-manual-trigger.dto.interface";
|
|
81
81
|
export * from "./interface/cron-job.entity.response";
|
|
82
82
|
export * from "./interface/to-do.entity.api";
|
|
83
|
+
export * from "./interface/billing-reimbursement-expense-history.api";
|
package/dist/src/api/index.js
CHANGED
|
@@ -96,3 +96,4 @@ __exportStar(require("./interface/holiday-list.entity.response"), exports);
|
|
|
96
96
|
__exportStar(require("./interface/cron-job-manual-trigger.dto.interface"), exports);
|
|
97
97
|
__exportStar(require("./interface/cron-job.entity.response"), exports);
|
|
98
98
|
__exportStar(require("./interface/to-do.entity.api"), exports);
|
|
99
|
+
__exportStar(require("./interface/billing-reimbursement-expense-history.api"), exports);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IApiEntity } from "../../entities";
|
|
2
|
+
import { IBillingReimbursementExpenseHistoryEntity } from "../../entities/interface/billing-reimbursement-expense-history.entity.interface";
|
|
3
|
+
export type IBillingReimbursementExpenseHistoryApiEntity = IApiEntity<IBillingReimbursementExpenseHistoryEntity>;
|
|
4
|
+
export type IBillingReimbursementExpenseHistoryApiEntityArray = IBillingReimbursementExpenseHistoryApiEntity[];
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { BillingImpactEnum, BillingStatusEnum, IBillingEntity, IBillingTimesheetEntity, IEntityCreateDto, IProjectEntity, ITimesheetEntity } from "../../entities";
|
|
1
|
+
import { BillingImpactEnum, BillingReimbursementExpenseChangedStatusEnum, BillingStatusEnum, IBillingEntity, IBillingTimesheetEntity, IEntityCreateDto, IProjectEntity, ITimesheetEntity } from "../../entities";
|
|
2
2
|
export type IBillingCreateExclude = "paymentStatus" | "status" | "writeoffAmount" | "tdsAmount" | "totalAmountPaid" | "creditNoteAmount" | "invoicePdfUrl";
|
|
3
3
|
export interface IBillingCreateDto extends Omit<IEntityCreateDto<IBillingEntity>, IBillingCreateExclude> {
|
|
4
4
|
timesheets: IBillingTimesheetsDto;
|
|
5
5
|
status?: BillingStatusEnum;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface IBillingTimesheetUnchangedDto {
|
|
8
|
+
id: number;
|
|
9
|
+
amount: number;
|
|
10
|
+
}
|
|
11
|
+
export interface IBillingReimbursementExpenseUnchangedDto {
|
|
8
12
|
id: number;
|
|
9
13
|
amount: number;
|
|
10
14
|
}
|
|
@@ -20,7 +24,7 @@ export interface IBillingTimesheetUpdateDeleteDetailDto {
|
|
|
20
24
|
}
|
|
21
25
|
export interface IBillingTimesheetsDto {
|
|
22
26
|
all: number[];
|
|
23
|
-
unchanged:
|
|
27
|
+
unchanged: IBillingTimesheetUnchangedDto[];
|
|
24
28
|
updateDetails: IBillingTimesheetUpdateDeleteDetailDto[];
|
|
25
29
|
deleteDetails: IBillingTimesheetUpdateDeleteDetailDto[];
|
|
26
30
|
}
|
|
@@ -29,3 +33,13 @@ export interface IBillingEntityCreateDtoValidationData {
|
|
|
29
33
|
billingTimesheetEntities: IBillingTimesheetEntity[];
|
|
30
34
|
timesheetEntities: ITimesheetEntity[];
|
|
31
35
|
}
|
|
36
|
+
export interface IBillingReimbursementExpenseCreateDtoDetails {
|
|
37
|
+
userId: number;
|
|
38
|
+
reimbursementExpenseId: number;
|
|
39
|
+
projectId: number;
|
|
40
|
+
expenseType: string;
|
|
41
|
+
totalAmount: number;
|
|
42
|
+
expenseIncurredDate: string;
|
|
43
|
+
changedStatus: BillingReimbursementExpenseChangedStatusEnum;
|
|
44
|
+
amendmentPurpose?: string;
|
|
45
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BillingActionsEnum, BillingStatusEnum, IBillingEntity } from "../../entities";
|
|
1
|
+
import { BillingActionsEnum, BillingStatusEnum, IBillingEntity, IBillingReimbursementExpenseEntity } from "../../entities";
|
|
2
2
|
import { IBillingApiEntity } from "./billing.entity.api";
|
|
3
3
|
import { IBillingTimesheetApiEntity } from "./billing.timesheet.entity.api";
|
|
4
4
|
import { IUpdateBillingDto } from "./billing.update.dto.interface";
|
|
@@ -6,7 +6,8 @@ import { IProjectApiEntity } from "./project.entity.response";
|
|
|
6
6
|
import { IUserApiEntity } from "./user.entity.api";
|
|
7
7
|
export type IBillingEntityResponse = {
|
|
8
8
|
billing: IBillingApiEntity;
|
|
9
|
-
billingTimesheets
|
|
9
|
+
billingTimesheets?: IBillingTimesheetApiEntity[];
|
|
10
|
+
billingReimbursementExpenses?: IBillingReimbursementExpenseEntity[];
|
|
10
11
|
};
|
|
11
12
|
export interface IUserEntityRelation {
|
|
12
13
|
users?: IUserApiEntity[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillingReimbursementExpenseImpactEnum = void 0;
|
|
4
|
+
var BillingReimbursementExpenseImpactEnum;
|
|
5
|
+
(function (BillingReimbursementExpenseImpactEnum) {
|
|
6
|
+
BillingReimbursementExpenseImpactEnum["POSITIVE"] = "positive";
|
|
7
|
+
BillingReimbursementExpenseImpactEnum["NEUTRAL"] = "neutral";
|
|
8
|
+
BillingReimbursementExpenseImpactEnum["NEGATIVE"] = "negative";
|
|
9
|
+
})(BillingReimbursementExpenseImpactEnum || (exports.BillingReimbursementExpenseImpactEnum = BillingReimbursementExpenseImpactEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillingReimbursementExpenseChangedStatusEnum = void 0;
|
|
4
|
+
var BillingReimbursementExpenseChangedStatusEnum;
|
|
5
|
+
(function (BillingReimbursementExpenseChangedStatusEnum) {
|
|
6
|
+
BillingReimbursementExpenseChangedStatusEnum["UNCHANGED"] = "unchanged";
|
|
7
|
+
BillingReimbursementExpenseChangedStatusEnum["UPDATED"] = "updated";
|
|
8
|
+
BillingReimbursementExpenseChangedStatusEnum["DELETED"] = "deleted";
|
|
9
|
+
})(BillingReimbursementExpenseChangedStatusEnum || (exports.BillingReimbursementExpenseChangedStatusEnum = BillingReimbursementExpenseChangedStatusEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillingTypeEnum = void 0;
|
|
4
|
+
var BillingTypeEnum;
|
|
5
|
+
(function (BillingTypeEnum) {
|
|
6
|
+
BillingTypeEnum["DEBIT_NOTE"] = "debitNote";
|
|
7
|
+
BillingTypeEnum["INVOICE"] = "invoice";
|
|
8
|
+
BillingTypeEnum["BOTH"] = "both";
|
|
9
|
+
})(BillingTypeEnum || (exports.BillingTypeEnum = BillingTypeEnum = {}));
|
|
@@ -74,3 +74,8 @@ export * from "./enums/timezone.enum";
|
|
|
74
74
|
export * from "./interface/cron-job.entity.interface";
|
|
75
75
|
export * from "./model/configuration.model";
|
|
76
76
|
export * from "./interface/to-do.entity.interface";
|
|
77
|
+
export * from "./enums/billing-type.enum";
|
|
78
|
+
export * from "./interface/billing-reimbursement-expense.entity.interface";
|
|
79
|
+
export * from "./enums/billing-reimbursement-expense-change-status.enum";
|
|
80
|
+
export * from "./interface/billing-reimbursement-expense-history.entity.interface";
|
|
81
|
+
export * from "./enums/billing-reimburement-expense-impact.enum";
|
|
@@ -91,3 +91,8 @@ __exportStar(require("./enums/timezone.enum"), exports);
|
|
|
91
91
|
__exportStar(require("./interface/cron-job.entity.interface"), exports);
|
|
92
92
|
__exportStar(require("./model/configuration.model"), exports);
|
|
93
93
|
__exportStar(require("./interface/to-do.entity.interface"), exports);
|
|
94
|
+
__exportStar(require("./enums/billing-type.enum"), exports);
|
|
95
|
+
__exportStar(require("./interface/billing-reimbursement-expense.entity.interface"), exports);
|
|
96
|
+
__exportStar(require("./enums/billing-reimbursement-expense-change-status.enum"), exports);
|
|
97
|
+
__exportStar(require("./interface/billing-reimbursement-expense-history.entity.interface"), exports);
|
|
98
|
+
__exportStar(require("./enums/billing-reimburement-expense-impact.enum"), exports);
|
package/dist/src/entities/interface/billing-reimbursement-expense-history.entity.interface.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IBaseHistoryEntity, IEntityCreateDto, IEntityFilterData } from "./entity.utils.interface";
|
|
2
|
+
export interface IBillingReimbursementExpenseHistoryEntity extends IBaseHistoryEntity {
|
|
3
|
+
}
|
|
4
|
+
export interface IBillingReimbursementExpenseHistoryCreateDto extends IEntityCreateDto<IBillingReimbursementExpenseHistoryEntity> {
|
|
5
|
+
}
|
|
6
|
+
export interface IBillingReimbursementExpenseHistorySearchDto extends IEntityFilterData<IBillingReimbursementExpenseHistoryEntity> {
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BillingReimbursementExpenseImpactEnum } from "../enums/billing-reimburement-expense-impact.enum";
|
|
2
|
+
import { BillingReimbursementExpenseChangedStatusEnum } from "../enums/billing-reimbursement-expense-change-status.enum";
|
|
3
|
+
import { IAuditColumnEntity } from "./audit-column.entity.interface";
|
|
4
|
+
import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
|
|
5
|
+
export interface IBillingReimbursementExpenseEntity extends IAuditColumnEntity {
|
|
6
|
+
id: number;
|
|
7
|
+
billingId: number;
|
|
8
|
+
userId: number;
|
|
9
|
+
reimbursementExpenseId: number;
|
|
10
|
+
projectId: number;
|
|
11
|
+
expenseType: string;
|
|
12
|
+
totalAmount: number;
|
|
13
|
+
expenseIncurredDate: string;
|
|
14
|
+
changedStatus: BillingReimbursementExpenseChangedStatusEnum;
|
|
15
|
+
amendmentPurpose?: string;
|
|
16
|
+
impact: BillingReimbursementExpenseImpactEnum;
|
|
17
|
+
}
|
|
18
|
+
export interface IBillingReimbursementExpenseCreateDto extends IEntityCreateDto<IBillingReimbursementExpenseEntity> {
|
|
19
|
+
}
|
|
20
|
+
export interface IBillingReimbursementExpenseUpdateDto extends IEntityUpdateDto<IBillingReimbursementExpenseEntity> {
|
|
21
|
+
}
|
|
22
|
+
export interface IBillingReimbursementExpenseFilterData extends IEntityFilterData<IBillingReimbursementExpenseEntity> {
|
|
23
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CurrencyEnum } from "../../enums";
|
|
2
|
+
import { BillingTypeEnum } from "../enums/billing-type.enum";
|
|
2
3
|
import { BillingStatusEnum } from "../enums/billing.status.enum";
|
|
3
4
|
import { BillingInvoiceTypeEnum } from "../enums/billing_invoice_type.enum";
|
|
4
5
|
import { PaymentStatusEnum } from "../enums/payment_status.enum";
|
|
@@ -26,6 +27,7 @@ export interface IBillingEntity extends IAuditColumnEntity {
|
|
|
26
27
|
conversionRate?: number;
|
|
27
28
|
particulars: string;
|
|
28
29
|
currency: CurrencyEnum;
|
|
30
|
+
type: BillingTypeEnum;
|
|
29
31
|
}
|
|
30
32
|
export interface IBillingEntityFilterDto extends IEntityFilterData<IBillingEntity> {
|
|
31
33
|
}
|
|
@@ -6,6 +6,7 @@ import { HistoryOperationEnum } from "../enums/history_operation.enum";
|
|
|
6
6
|
import { IAuditColumnEntity } from "./audit-column.entity.interface";
|
|
7
7
|
import { IBankEntity } from "./bank.entity.interface";
|
|
8
8
|
import { IBankHistoryEntity } from "./bank_history.entity.interface";
|
|
9
|
+
import { IBillingReimbursementExpenseEntity } from "./billing-reimbursement-expense.entity.interface";
|
|
9
10
|
import { IBillingEntity } from "./billing.entity.interface";
|
|
10
11
|
import { IBillingPaymentEntity } from "./billing_payment.entity.interface";
|
|
11
12
|
import { IBillingTimesheetEntity } from "./billing_timesheet.entity.interface";
|
|
@@ -48,11 +49,43 @@ export type IApiEntity<T extends {
|
|
|
48
49
|
}>;
|
|
49
50
|
export type IEntityCreateDto<T> = Omit<T, "id" | keyof IAuditColumnEntity>;
|
|
50
51
|
export type IEntityUpdateDto<T> = Omit<Partial<T>, "id" | keyof IAuditColumnEntity>;
|
|
52
|
+
/**
|
|
53
|
+
* EntityEnum
|
|
54
|
+
*
|
|
55
|
+
* Centralized registry of **entity identifiers** used across the application.
|
|
56
|
+
*
|
|
57
|
+
* Purpose:
|
|
58
|
+
* - Provides a single source of truth for entity names.
|
|
59
|
+
* - Ensures consistency across backend, frontend, and shared packages.
|
|
60
|
+
* - In the backend, these values are also used as TypeORM table names.
|
|
61
|
+
*
|
|
62
|
+
* Rules:
|
|
63
|
+
* - Whenever a new entity (domain object / database table) is introduced,
|
|
64
|
+
* its corresponding entry MUST be added here.
|
|
65
|
+
* - Backend entities must always use `@Entity(EntityEnum.XYZ)` instead of string literals.
|
|
66
|
+
*
|
|
67
|
+
* Example (backend):
|
|
68
|
+
* ```ts
|
|
69
|
+
* @Entity(EntityEnum.USER)
|
|
70
|
+
* export class UserEntity { ... }
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* Example (frontend / service):
|
|
74
|
+
* ```ts
|
|
75
|
+
* if (entity === EntityEnum.USER) {
|
|
76
|
+
* // handle user entity logic
|
|
77
|
+
* }
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* Do not duplicate or hardcode entity names in different layers.
|
|
81
|
+
*/
|
|
51
82
|
export declare enum EntityEnum {
|
|
52
83
|
BILLING = "billing",
|
|
53
84
|
BILLING_HISTORY = "billing_history",
|
|
54
85
|
BILLING_TIMESHEET = "billing_timesheet",
|
|
86
|
+
BILLING_REIMBURSEMENT_EXPENSE = "billing_reimbursement_expense",
|
|
55
87
|
BILLING_TIMESHEET_HISTORY = "billing_timesheet_history",
|
|
88
|
+
BILLING_REIMBURESMENT_EXPENSE_HISTORY = "billing_reimbursement_expense_history",
|
|
56
89
|
TIMESHEET = "timesheet",
|
|
57
90
|
TIMESHEET_HISTORY = "timesheet_history",
|
|
58
91
|
USER = "user",
|
|
@@ -111,7 +144,7 @@ export type IBaseEntityApiResponse<T extends {
|
|
|
111
144
|
[K in EntityEnum | VirtualEntityEnum]?: IBaseEntityApiResponse<EnumEntityType<K>>;
|
|
112
145
|
};
|
|
113
146
|
};
|
|
114
|
-
export type EnumEntityType<T extends EntityEnum | VirtualEntityEnum> = (T extends EntityEnum.BILLING ? IBillingEntity : T extends EntityEnum.BILLING_TIMESHEET ? IBillingTimesheetEntity : 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_PAYMENT ? IBillingPaymentEntity : T extends EntityEnum.BILLING_TRANSACTION ? IBillingTransactionEntity : 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.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.TO_DO_LIST ? IToDoListEntity : T extends EntityEnum.CRON_JOBS ? ICronJobsEntity : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : T extends VirtualEntityEnum.USER_LEAVE ? IUserLeaveVirtualEntity : T extends EntityEnum.BANK_HISTORY ? IBankHistoryEntity : T extends EntityEnum.LEAVE_HISTORY ? ILeaveHistoryEntity : T extends EntityEnum.WORK_FROM_HOME_HISTORY ? IWorkFromHomeHistoryEntity : T extends EntityEnum.TIMESHEET_HISTORY ? ITimesheetHistoryEntity : never) & {
|
|
147
|
+
export type EnumEntityType<T extends EntityEnum | VirtualEntityEnum> = (T extends EntityEnum.BILLING ? IBillingEntity : T extends EntityEnum.BILLING_TIMESHEET ? IBillingTimesheetEntity : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? IBillingReimbursementExpenseEntity : 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_PAYMENT ? IBillingPaymentEntity : T extends EntityEnum.BILLING_TRANSACTION ? IBillingTransactionEntity : 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.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.TO_DO_LIST ? IToDoListEntity : T extends EntityEnum.CRON_JOBS ? ICronJobsEntity : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : T extends VirtualEntityEnum.USER_LEAVE ? IUserLeaveVirtualEntity : T extends EntityEnum.BANK_HISTORY ? IBankHistoryEntity : T extends EntityEnum.LEAVE_HISTORY ? ILeaveHistoryEntity : T extends EntityEnum.WORK_FROM_HOME_HISTORY ? IWorkFromHomeHistoryEntity : T extends EntityEnum.TIMESHEET_HISTORY ? ITimesheetHistoryEntity : never) & {
|
|
115
148
|
id: number;
|
|
116
149
|
};
|
|
117
150
|
export type EntityRelationConfig<T extends EntityEnum | VirtualEntityEnum> = {
|
|
@@ -155,6 +188,7 @@ export type IEntityFilterData<T extends EnumEntityType<EntityEnum | VirtualEntit
|
|
|
155
188
|
virtualRelations?: ISearchIncludeEntity<VirtualEntityEnum>[];
|
|
156
189
|
};
|
|
157
190
|
export type ISearchIncludeEntity<T extends EntityEnum | VirtualEntityEnum> = {
|
|
191
|
+
id?: number[];
|
|
158
192
|
name: T;
|
|
159
193
|
relations?: ISearchIncludeEntity<EntityRelations[EntityEnum]>[];
|
|
160
194
|
entities?: ISearchIncludeEntity<EntityRelations[EntityEnum]>[];
|
|
@@ -1,12 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VirtualEntityEnum = exports.EntityEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* EntityEnum
|
|
6
|
+
*
|
|
7
|
+
* Centralized registry of **entity identifiers** used across the application.
|
|
8
|
+
*
|
|
9
|
+
* Purpose:
|
|
10
|
+
* - Provides a single source of truth for entity names.
|
|
11
|
+
* - Ensures consistency across backend, frontend, and shared packages.
|
|
12
|
+
* - In the backend, these values are also used as TypeORM table names.
|
|
13
|
+
*
|
|
14
|
+
* Rules:
|
|
15
|
+
* - Whenever a new entity (domain object / database table) is introduced,
|
|
16
|
+
* its corresponding entry MUST be added here.
|
|
17
|
+
* - Backend entities must always use `@Entity(EntityEnum.XYZ)` instead of string literals.
|
|
18
|
+
*
|
|
19
|
+
* Example (backend):
|
|
20
|
+
* ```ts
|
|
21
|
+
* @Entity(EntityEnum.USER)
|
|
22
|
+
* export class UserEntity { ... }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Example (frontend / service):
|
|
26
|
+
* ```ts
|
|
27
|
+
* if (entity === EntityEnum.USER) {
|
|
28
|
+
* // handle user entity logic
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* Do not duplicate or hardcode entity names in different layers.
|
|
33
|
+
*/
|
|
4
34
|
var EntityEnum;
|
|
5
35
|
(function (EntityEnum) {
|
|
6
36
|
EntityEnum["BILLING"] = "billing";
|
|
7
37
|
EntityEnum["BILLING_HISTORY"] = "billing_history";
|
|
8
38
|
EntityEnum["BILLING_TIMESHEET"] = "billing_timesheet";
|
|
39
|
+
EntityEnum["BILLING_REIMBURSEMENT_EXPENSE"] = "billing_reimbursement_expense";
|
|
9
40
|
EntityEnum["BILLING_TIMESHEET_HISTORY"] = "billing_timesheet_history";
|
|
41
|
+
EntityEnum["BILLING_REIMBURESMENT_EXPENSE_HISTORY"] = "billing_reimbursement_expense_history";
|
|
10
42
|
EntityEnum["TIMESHEET"] = "timesheet";
|
|
11
43
|
EntityEnum["TIMESHEET_HISTORY"] = "timesheet_history";
|
|
12
44
|
EntityEnum["USER"] = "user";
|
|
@@ -212,3 +212,32 @@ export declare function areDecimalNumbersEqual(firstValue: number, secondValue:
|
|
|
212
212
|
export declare function formatIndianNumber(amount: number | string): string;
|
|
213
213
|
export declare function findDuplicateIds(ids: number[]): number[];
|
|
214
214
|
export declare function getDecimalNumberFromString(value: string | number, placesAfterDecimal?: number): number;
|
|
215
|
+
/**
|
|
216
|
+
* Recursively checks if a specified property exists in an object or its nested objects.
|
|
217
|
+
* Skips properties with array values and does not check their contents.
|
|
218
|
+
* The property is considered present if it exists in the object and its value is not undefined.
|
|
219
|
+
*
|
|
220
|
+
* @template T - The type of the input object, constrained to be an object.
|
|
221
|
+
* @param obj - The object to check for the property. Can be null or undefined.
|
|
222
|
+
* @param propName - The name of the property to search for.
|
|
223
|
+
* @returns True if the property exists in the object or any nested non-array object and is not undefined; false otherwise.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* interface MyObject {
|
|
228
|
+
* name?: string;
|
|
229
|
+
* details?: { age?: number; tags?: string[] };
|
|
230
|
+
* }
|
|
231
|
+
*
|
|
232
|
+
* const obj: MyObject = {
|
|
233
|
+
* name: "Alice",
|
|
234
|
+
* details: { age: 30, tags: ["test"] }
|
|
235
|
+
* };
|
|
236
|
+
*
|
|
237
|
+
* console.log(hasProperty(obj, "name")); // true
|
|
238
|
+
* console.log(hasProperty(obj, "age")); // true (nested in details)
|
|
239
|
+
* console.log(hasProperty(obj, "tags")); // false (tags is an array, skipped)
|
|
240
|
+
* console.log(hasProperty(obj, "unknown")); // false
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
export declare function hasProperty<T extends object>(obj: T | null | undefined, propName: string): boolean;
|
|
@@ -37,6 +37,7 @@ exports.areDecimalNumbersEqual = areDecimalNumbersEqual;
|
|
|
37
37
|
exports.formatIndianNumber = formatIndianNumber;
|
|
38
38
|
exports.findDuplicateIds = findDuplicateIds;
|
|
39
39
|
exports.getDecimalNumberFromString = getDecimalNumberFromString;
|
|
40
|
+
exports.hasProperty = hasProperty;
|
|
40
41
|
const util_constants_1 = require("../constants/util.constants");
|
|
41
42
|
const error_key_enum_1 = require("../enums/error.key.enum");
|
|
42
43
|
const exceptions_1 = require("../exceptions");
|
|
@@ -467,3 +468,54 @@ function getDecimalNumberFromString(value, placesAfterDecimal = 2) {
|
|
|
467
468
|
// this method should internally handle if the value is number or string
|
|
468
469
|
return Number(Number(value).toFixed(placesAfterDecimal));
|
|
469
470
|
}
|
|
471
|
+
/**
|
|
472
|
+
* Recursively checks if a specified property exists in an object or its nested objects.
|
|
473
|
+
* Skips properties with array values and does not check their contents.
|
|
474
|
+
* The property is considered present if it exists in the object and its value is not undefined.
|
|
475
|
+
*
|
|
476
|
+
* @template T - The type of the input object, constrained to be an object.
|
|
477
|
+
* @param obj - The object to check for the property. Can be null or undefined.
|
|
478
|
+
* @param propName - The name of the property to search for.
|
|
479
|
+
* @returns True if the property exists in the object or any nested non-array object and is not undefined; false otherwise.
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* ```typescript
|
|
483
|
+
* interface MyObject {
|
|
484
|
+
* name?: string;
|
|
485
|
+
* details?: { age?: number; tags?: string[] };
|
|
486
|
+
* }
|
|
487
|
+
*
|
|
488
|
+
* const obj: MyObject = {
|
|
489
|
+
* name: "Alice",
|
|
490
|
+
* details: { age: 30, tags: ["test"] }
|
|
491
|
+
* };
|
|
492
|
+
*
|
|
493
|
+
* console.log(hasProperty(obj, "name")); // true
|
|
494
|
+
* console.log(hasProperty(obj, "age")); // true (nested in details)
|
|
495
|
+
* console.log(hasProperty(obj, "tags")); // false (tags is an array, skipped)
|
|
496
|
+
* console.log(hasProperty(obj, "unknown")); // false
|
|
497
|
+
* ```
|
|
498
|
+
*/
|
|
499
|
+
function hasProperty(obj, propName) {
|
|
500
|
+
if (!obj || typeof obj !== "object" || Array.isArray(obj)) {
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
// Check if the property exists at the current level
|
|
504
|
+
if (propName in obj && obj[propName] !== undefined) {
|
|
505
|
+
return true;
|
|
506
|
+
}
|
|
507
|
+
// Recursively check all nested objects, skipping arrays
|
|
508
|
+
for (const key in obj) {
|
|
509
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
510
|
+
const value = obj[key];
|
|
511
|
+
if (typeof value === "object" &&
|
|
512
|
+
value !== null &&
|
|
513
|
+
!Array.isArray(value)) {
|
|
514
|
+
if (hasProperty(value, propName)) {
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return false;
|
|
521
|
+
}
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "law-common",
|
|
3
|
-
"version": "10.17.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist/**/*"
|
|
8
|
-
],
|
|
9
|
-
"scripts": {
|
|
10
|
-
"clean": "rm -rf dist",
|
|
11
|
-
"build": "npm run clean && tsc",
|
|
12
|
-
"publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
|
|
13
|
-
"publish:patch": "npm version patch && git push && npm run build && npm publish",
|
|
14
|
-
"publish:minor": "npm version minor && git push && npm run build && npm publish",
|
|
15
|
-
"publish:major": "npm version major && git push && npm run build && npm publish",
|
|
16
|
-
"link": "npm run build && npm link",
|
|
17
|
-
"test": "jest"
|
|
18
|
-
},
|
|
19
|
-
"keywords": [],
|
|
20
|
-
"author": "",
|
|
21
|
-
"license": "ISC",
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@types/jest": "^29.5.13",
|
|
24
|
-
"@types/node": "^22.6.1",
|
|
25
|
-
"jest": "^29.7.0",
|
|
26
|
-
"ts-jest": "^29.2.5",
|
|
27
|
-
"ts-node": "^10.9.2",
|
|
28
|
-
"typescript": "^5.6.2"
|
|
29
|
-
},
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@types/express": "^5.0.0",
|
|
32
|
-
"@types/multer": "^1.4.12",
|
|
33
|
-
"date-fns": "^4.1.0"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "law-common",
|
|
3
|
+
"version": "10.17.1-beta.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/**/*"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "rm -rf dist",
|
|
11
|
+
"build": "npm run clean && tsc",
|
|
12
|
+
"publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
|
|
13
|
+
"publish:patch": "npm version patch && git push && npm run build && npm publish",
|
|
14
|
+
"publish:minor": "npm version minor && git push && npm run build && npm publish",
|
|
15
|
+
"publish:major": "npm version major && git push && npm run build && npm publish",
|
|
16
|
+
"link": "npm run build && npm link",
|
|
17
|
+
"test": "jest"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/jest": "^29.5.13",
|
|
24
|
+
"@types/node": "^22.6.1",
|
|
25
|
+
"jest": "^29.7.0",
|
|
26
|
+
"ts-jest": "^29.2.5",
|
|
27
|
+
"ts-node": "^10.9.2",
|
|
28
|
+
"typescript": "^5.6.2"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@types/express": "^5.0.0",
|
|
32
|
+
"@types/multer": "^1.4.12",
|
|
33
|
+
"date-fns": "^4.1.0"
|
|
34
|
+
}
|
|
35
|
+
}
|