law-common 10.16.1 → 10.17.1-beta.0

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.
Files changed (30) hide show
  1. package/dist/src/api/index.d.ts +1 -0
  2. package/dist/src/api/index.js +1 -0
  3. package/dist/src/api/interface/billing-reimbursement-expense-history.api.d.ts +4 -0
  4. package/dist/src/api/interface/billing-reimbursement-expense-history.api.js +2 -0
  5. package/dist/src/api/interface/billing.create.dto.interface.d.ts +6 -1
  6. package/dist/src/api/interface/billing.update.dto.interface.d.ts +2 -1
  7. package/dist/src/constants/entity_constants.d.ts +1 -0
  8. package/dist/src/constants/entity_constants.js +7 -1
  9. package/dist/src/entities/enums/billing-reimbursement-expense-change-status.enum.d.ts +5 -0
  10. package/dist/src/entities/enums/billing-reimbursement-expense-change-status.enum.js +9 -0
  11. package/dist/src/entities/enums/billing-type.enum.d.ts +5 -0
  12. package/dist/src/entities/enums/billing-type.enum.js +9 -0
  13. package/dist/src/entities/index.d.ts +4 -0
  14. package/dist/src/entities/index.js +4 -0
  15. package/dist/src/entities/interface/billing-reimbursement-expense-history.entity.interface.d.ts +7 -0
  16. package/dist/src/entities/interface/billing-reimbursement-expense-history.entity.interface.js +2 -0
  17. package/dist/src/entities/interface/billing-reimbursement-expense.entity.interface.d.ts +19 -0
  18. package/dist/src/entities/interface/billing-reimbursement-expense.entity.interface.js +2 -0
  19. package/dist/src/entities/interface/billing.entity.interface.d.ts +6 -6
  20. package/dist/src/entities/interface/billing_timesheet.entity.interface.d.ts +2 -1
  21. package/dist/src/entities/interface/entity.utils.interface.d.ts +35 -1
  22. package/dist/src/entities/interface/entity.utils.interface.js +32 -0
  23. package/dist/src/entities/interface/project.entity.interface.d.ts +5 -3
  24. package/dist/src/enums/time.unit.enum.d.ts +1 -0
  25. package/dist/src/enums/time.unit.enum.js +7 -3
  26. package/dist/src/utils/helper.fn.util.d.ts +65 -0
  27. package/dist/src/utils/helper.fn.util.js +126 -0
  28. package/dist/src/utils/models/date-code.model.util.d.ts +2 -0
  29. package/dist/src/utils/models/date-code.model.util.js +15 -2
  30. package/package.json +1 -1
@@ -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";
@@ -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[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { BillingImpactEnum, BillingStatusEnum, IBillingEntity, IEntityCreateDto } from "../../entities";
1
+ import { BillingImpactEnum, 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;
@@ -24,3 +24,8 @@ export interface IBillingTimesheetsDto {
24
24
  updateDetails: IBillingTimesheetUpdateDeleteDetailDto[];
25
25
  deleteDetails: IBillingTimesheetUpdateDeleteDetailDto[];
26
26
  }
27
+ export interface IBillingEntityCreateDtoValidationData {
28
+ projectEntity: IProjectEntity;
29
+ billingTimesheetEntities: IBillingTimesheetEntity[];
30
+ timesheetEntities: ITimesheetEntity[];
31
+ }
@@ -1,4 +1,5 @@
1
- import { BillingActionsEnum, IBillingEntity, IBillingEntityCreateDtoValidationData, IBillingTimesheetUpdateDto, IEntityUpdateDto } from "../../entities";
1
+ import { BillingActionsEnum, IBillingEntity, IBillingTimesheetUpdateDto, IEntityUpdateDto } from "../../entities";
2
+ import { IBillingEntityCreateDtoValidationData } from "./billing.create.dto.interface";
2
3
  export interface IBillingUpdateDto extends IEntityUpdateDto<IBillingEntity> {
3
4
  }
4
5
  export interface IUpdateBillingDto extends IBillingUpdateDto {
@@ -11,3 +11,4 @@ export declare const usersToExcludeFromSearchResponse: string[];
11
11
  export declare const systemUsers: string[];
12
12
  export declare const reimbursementExpenseProjectUserInactiveBuffer: number;
13
13
  export declare const annualPaidLeaves = 24;
14
+ export declare const designationPriorityOrder: Record<string, number>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.annualPaidLeaves = exports.reimbursementExpenseProjectUserInactiveBuffer = exports.systemUsers = exports.usersToExcludeFromSearchResponse = exports.freezeTimesheetAfterBillingStatus = exports.leaveImplicitDays = exports.reimbursementPaymentProcessorPermissionName = exports.toDoListMinimumEstimatedDuration = exports.timesheetMinimumTotalDuration = exports.timesheetEnterThreshold = exports.timesheetThreshold = exports.timesheetViewThreshold = void 0;
3
+ exports.designationPriorityOrder = exports.annualPaidLeaves = exports.reimbursementExpenseProjectUserInactiveBuffer = exports.systemUsers = exports.usersToExcludeFromSearchResponse = exports.freezeTimesheetAfterBillingStatus = exports.leaveImplicitDays = exports.reimbursementPaymentProcessorPermissionName = exports.toDoListMinimumEstimatedDuration = exports.timesheetMinimumTotalDuration = exports.timesheetEnterThreshold = exports.timesheetThreshold = exports.timesheetViewThreshold = void 0;
4
4
  const entities_1 = require("../entities");
5
5
  exports.timesheetViewThreshold = "timesheetViewThreshold";
6
6
  exports.timesheetThreshold = "timesheetThreshold";
@@ -14,3 +14,9 @@ exports.usersToExcludeFromSearchResponse = ["DB migration"];
14
14
  exports.systemUsers = ["DB migration"];
15
15
  exports.reimbursementExpenseProjectUserInactiveBuffer = 24 * 60;
16
16
  exports.annualPaidLeaves = 24;
17
+ exports.designationPriorityOrder = {
18
+ seniorPartner: 1,
19
+ partner: 2,
20
+ seniorAssociate: 3,
21
+ associate: 4,
22
+ };
@@ -0,0 +1,5 @@
1
+ export declare enum BillingReimbursementChangedStatusEnum {
2
+ UNCHANGED = "unchanged",
3
+ UPDATED = "updated",
4
+ DELETED = "deleted"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BillingReimbursementChangedStatusEnum = void 0;
4
+ var BillingReimbursementChangedStatusEnum;
5
+ (function (BillingReimbursementChangedStatusEnum) {
6
+ BillingReimbursementChangedStatusEnum["UNCHANGED"] = "unchanged";
7
+ BillingReimbursementChangedStatusEnum["UPDATED"] = "updated";
8
+ BillingReimbursementChangedStatusEnum["DELETED"] = "deleted";
9
+ })(BillingReimbursementChangedStatusEnum || (exports.BillingReimbursementChangedStatusEnum = BillingReimbursementChangedStatusEnum = {}));
@@ -0,0 +1,5 @@
1
+ export declare enum BillingTypeEnum {
2
+ DEBIT_NOTE = "debitNote",
3
+ INVOICE = "invoice",
4
+ BOTH = "both"
5
+ }
@@ -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,7 @@ 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";
@@ -91,3 +91,7 @@ __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);
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { BillingReimbursementChangedStatusEnum } from "../enums/billing-reimbursement-expense-change-status.enum";
2
+ import { IAuditColumnEntity } from "./audit-column.entity.interface";
3
+ import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
4
+ export interface IBillingReimbursementExpenseEntity extends IAuditColumnEntity {
5
+ id: number;
6
+ billingId: number;
7
+ userId: number;
8
+ reimbursement_expense_id: number;
9
+ projectId: number;
10
+ expenseType: string;
11
+ totalAmount: number;
12
+ changedStatus: BillingReimbursementChangedStatusEnum;
13
+ }
14
+ export interface IBillingReimbursementExpenseCreateDto extends IEntityCreateDto<IBillingReimbursementExpenseEntity> {
15
+ }
16
+ export interface IBillingReimbursementExpenseUpdateDto extends IEntityUpdateDto<IBillingReimbursementExpenseEntity> {
17
+ }
18
+ export interface IBillingReimbursementExpenseFilterData extends IEntityFilterData<IBillingReimbursementExpenseEntity> {
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,10 @@
1
+ import { CurrencyEnum } from "../../enums";
2
+ import { BillingTypeEnum } from "../enums/billing-type.enum";
1
3
  import { BillingStatusEnum } from "../enums/billing.status.enum";
2
4
  import { BillingInvoiceTypeEnum } from "../enums/billing_invoice_type.enum";
3
5
  import { PaymentStatusEnum } from "../enums/payment_status.enum";
4
6
  import { IAuditColumnEntity } from "./audit-column.entity.interface";
5
7
  import { EntityEnum, IEntityFilterData } from "./entity.utils.interface";
6
- import { IProjectEntity } from "./project.entity.interface";
7
- import { ITimesheetEntity } from "./timesheet.entity.interface";
8
8
  export interface IBillingEntity extends IAuditColumnEntity {
9
9
  id: number;
10
10
  startDate: string;
@@ -24,12 +24,12 @@ export interface IBillingEntity extends IAuditColumnEntity {
24
24
  invoicePdfUrl?: string | null;
25
25
  invoiceContactName: string;
26
26
  bankId: number;
27
+ conversionRate?: number;
28
+ particulars: string;
29
+ currency: CurrencyEnum;
30
+ type: BillingTypeEnum;
27
31
  }
28
32
  export interface IBillingEntityFilterDto extends IEntityFilterData<IBillingEntity> {
29
33
  }
30
- export interface IBillingEntityCreateDtoValidationData {
31
- projectEntity: IProjectEntity;
32
- timesheetEntities: ITimesheetEntity[];
33
- }
34
34
  export declare const billingRelations: EntityEnum[];
35
35
  export declare const billingEntities: EntityEnum[];
@@ -39,7 +39,8 @@ export interface IBillingTimesheetDetailsArray extends Array<IBillingTimesheetDe
39
39
  export interface IBillingTimesheetEntityFilterDto extends IEntityFilterData<IBillingTimesheetEntity> {
40
40
  }
41
41
  export interface IBillingTimesheetEntityCreateDtoValidationResult {
42
- timesheets: ITimesheetEntity[];
42
+ billingTimesheetEntities: IBillingTimesheetEntity[];
43
+ timesheetEntities: ITimesheetEntity[];
43
44
  }
44
45
  export interface IBillingTimesheetUpdateDto extends IEntityUpdateDto<IBillingTimesheetEntity> {
45
46
  }
@@ -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";
@@ -37,17 +37,19 @@ export interface IProjectHourlyRate {
37
37
  rate: number;
38
38
  unit: TimeUnitEnum.HOUR;
39
39
  }
40
- export interface IProjectFixedMonthlyRate {
40
+ export interface IProjectFixedTypeRate {
41
41
  rate: number;
42
- unit: TimeUnitEnum.MONTH;
42
+ unit: TimeUnitEnum;
43
43
  maxEstimatedHours: number;
44
+ extraHoursRate: number;
44
45
  }
45
46
  export interface IProjectAdhocRate {
46
47
  rate: number;
47
48
  maxEstimatedHours: number;
49
+ extraHoursRate: number;
48
50
  }
49
51
  export interface IProjectCreateDtoExtra {
50
- projectBillingRate: IProjectHourlyRate[] | IProjectFixedMonthlyRate | IProjectAdhocRate;
52
+ projectBillingRate: IProjectHourlyRate[] | IProjectFixedTypeRate | IProjectAdhocRate;
51
53
  }
52
54
  export interface IProjectEntityCreateDto extends Omit<IEntityCreateDto<IProjectEntity>, IProjectExclude>, IProjectEntityDependent, IProjectCreateDtoExtra {
53
55
  }
@@ -5,6 +5,7 @@ export declare enum TimeUnitEnum {
5
5
  DAY = "DAY",
6
6
  WEEK = "WEEK",
7
7
  MONTH = "MONTH",
8
+ QUARTER = "QUARTER",
8
9
  YEAR = "YEAR"
9
10
  }
10
11
  export declare namespace TimeUnitEnum {
@@ -11,6 +11,7 @@ var TimeUnitEnum;
11
11
  TimeUnitEnum["DAY"] = "DAY";
12
12
  TimeUnitEnum["WEEK"] = "WEEK";
13
13
  TimeUnitEnum["MONTH"] = "MONTH";
14
+ TimeUnitEnum["QUARTER"] = "QUARTER";
14
15
  TimeUnitEnum["YEAR"] = "YEAR";
15
16
  })(TimeUnitEnum || (exports.TimeUnitEnum = TimeUnitEnum = {}));
16
17
  (function (TimeUnitEnum) {
@@ -28,6 +29,8 @@ var TimeUnitEnum;
28
29
  return 60 * 24 * 7;
29
30
  case TimeUnitEnum.MONTH:
30
31
  return 60 * 24 * 30;
32
+ case TimeUnitEnum.QUARTER:
33
+ return 60 * 24 * 30 * 3;
31
34
  case TimeUnitEnum.YEAR:
32
35
  return 60 * 24 * 365;
33
36
  }
@@ -55,15 +58,16 @@ var TimeUnitEnum;
55
58
  return TimeUnitEnum.YEAR;
56
59
  default:
57
60
  throw new exceptions_1.AppBadRequestException({
58
- message: [`Invalid time unit: ${value}. Valid values are: ${TimeUnitEnum.getNames().join(", ")}`],
61
+ message: [
62
+ `Invalid time unit: ${value}. Valid values are: ${TimeUnitEnum.getNames().join(", ")}`,
63
+ ],
59
64
  key: error_key_enum_1.ErrorKeyEnum.TIME_UNIT,
60
65
  });
61
66
  }
62
67
  }
63
68
  TimeUnitEnum.parse = parse;
64
69
  function getNames() {
65
- return Object.values(TimeUnitEnum).filter(value => typeof value === 'string');
66
- ;
70
+ return Object.values(TimeUnitEnum).filter((value) => typeof value === "string");
67
71
  }
68
72
  TimeUnitEnum.getNames = getNames;
69
73
  })(TimeUnitEnum || (exports.TimeUnitEnum = TimeUnitEnum = {}));
@@ -176,3 +176,68 @@ export declare function transformDate<T extends {
176
176
  export declare function capitalizeFirstWord(str: string): string;
177
177
  export declare function getEntitiesFromSearchV2Response<E extends EntityEnum, // Enum key like EntityEnum.USER, EntityEnum.PROJECT, etc.
178
178
  T extends EnumEntityType<E>>(searchResponseV2: IBaseEntityServiceResponse<EnumEntityType<EntityEnum>>, entityEnumKey: E, EntityClass: new () => T): T[];
179
+ /**
180
+ * Checks if two decimal numbers are approximately equal within a given tolerance.
181
+ *
182
+ * @param {number} firstValue - The first number to compare.
183
+ * @param {number} secondValue - The second number to compare.
184
+ * @param {number} allowedDifference - The maximum difference allowed for the numbers
185
+ * to be considered equal.
186
+ *
187
+ * @returns {boolean} Returns `true` if the numbers are within the allowed difference;
188
+ * otherwise, returns `false`.
189
+ *
190
+ * @example
191
+ * areDecimalNumbersEqual(5483.86, 5483.87, 0.5); // true
192
+ * areDecimalNumbersEqual(5483.86, 5484.5, 0.5); // false
193
+ */
194
+ export declare function areDecimalNumbersEqual(firstValue: number, secondValue: number, allowedDifference?: number): boolean;
195
+ /**
196
+ * Formats a number into the Indian numbering system with commas.
197
+ *
198
+ * - Ensures **two decimal places**.
199
+ * - Applies Indian digit grouping: last 3 digits, then groups of 2 (e.g., 1,23,456.00).
200
+ * - Accepts both `number` and `string` input.
201
+ * - Returns an empty string if the input is not a valid number.
202
+ *
203
+ * @param {number | string} amount - The number or numeric string to format.
204
+ * @returns {string} The formatted number as a string in Indian number format.
205
+ *
206
+ * @example
207
+ * formatIndianNumber(123456); // "1,23,456.00"
208
+ * formatIndianNumber(1891250); // "18,91,250.00"
209
+ * formatIndianNumber("21250"); // "21,250.00"
210
+ * formatIndianNumber("abc"); // ""
211
+ */
212
+ export declare function formatIndianNumber(amount: number | string): string;
213
+ export declare function findDuplicateIds(ids: number[]): number[];
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;
@@ -33,6 +33,11 @@ exports.createKeyLabelMap = createKeyLabelMap;
33
33
  exports.transformDate = transformDate;
34
34
  exports.capitalizeFirstWord = capitalizeFirstWord;
35
35
  exports.getEntitiesFromSearchV2Response = getEntitiesFromSearchV2Response;
36
+ exports.areDecimalNumbersEqual = areDecimalNumbersEqual;
37
+ exports.formatIndianNumber = formatIndianNumber;
38
+ exports.findDuplicateIds = findDuplicateIds;
39
+ exports.getDecimalNumberFromString = getDecimalNumberFromString;
40
+ exports.hasProperty = hasProperty;
36
41
  const util_constants_1 = require("../constants/util.constants");
37
42
  const error_key_enum_1 = require("../enums/error.key.enum");
38
43
  const exceptions_1 = require("../exceptions");
@@ -393,3 +398,124 @@ function getEntitiesFromSearchV2Response(searchResponseV2, entityEnumKey, Entity
393
398
  }
394
399
  return (((_a = searchResponseV2.relatedEntities[entityEnumKey]) === null || _a === void 0 ? void 0 : _a.baseEntities) || []).map((entity) => Object.assign(new EntityClass(), entity));
395
400
  }
401
+ /**
402
+ * Checks if two decimal numbers are approximately equal within a given tolerance.
403
+ *
404
+ * @param {number} firstValue - The first number to compare.
405
+ * @param {number} secondValue - The second number to compare.
406
+ * @param {number} allowedDifference - The maximum difference allowed for the numbers
407
+ * to be considered equal.
408
+ *
409
+ * @returns {boolean} Returns `true` if the numbers are within the allowed difference;
410
+ * otherwise, returns `false`.
411
+ *
412
+ * @example
413
+ * areDecimalNumbersEqual(5483.86, 5483.87, 0.5); // true
414
+ * areDecimalNumbersEqual(5483.86, 5484.5, 0.5); // false
415
+ */
416
+ function areDecimalNumbersEqual(firstValue, secondValue, allowedDifference = 0.5) {
417
+ // Calculate the absolute difference between both values
418
+ const actualDifference = Math.abs(firstValue - secondValue);
419
+ // Return true if the actual difference is less than or equal to the allowed difference
420
+ return actualDifference <= allowedDifference;
421
+ }
422
+ /**
423
+ * Formats a number into the Indian numbering system with commas.
424
+ *
425
+ * - Ensures **two decimal places**.
426
+ * - Applies Indian digit grouping: last 3 digits, then groups of 2 (e.g., 1,23,456.00).
427
+ * - Accepts both `number` and `string` input.
428
+ * - Returns an empty string if the input is not a valid number.
429
+ *
430
+ * @param {number | string} amount - The number or numeric string to format.
431
+ * @returns {string} The formatted number as a string in Indian number format.
432
+ *
433
+ * @example
434
+ * formatIndianNumber(123456); // "1,23,456.00"
435
+ * formatIndianNumber(1891250); // "18,91,250.00"
436
+ * formatIndianNumber("21250"); // "21,250.00"
437
+ * formatIndianNumber("abc"); // ""
438
+ */
439
+ function formatIndianNumber(amount) {
440
+ let num = Number(amount);
441
+ if (isNaN(num))
442
+ return "";
443
+ // Ensure 2 decimal places
444
+ let [integerPart, decimalPart] = num.toFixed(2).split(".");
445
+ // Indian grouping: last 3 digits, then groups of 2
446
+ let lastThree = integerPart.slice(-3);
447
+ let otherNumbers = integerPart.slice(0, -3);
448
+ if (otherNumbers !== "") {
449
+ lastThree = "," + lastThree;
450
+ }
451
+ let formattedInt = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;
452
+ return formattedInt + "." + decimalPart;
453
+ }
454
+ function findDuplicateIds(ids) {
455
+ const seen = new Set();
456
+ const duplicates = new Set();
457
+ for (const id of ids) {
458
+ if (seen.has(id)) {
459
+ duplicates.add(id);
460
+ }
461
+ else {
462
+ seen.add(id);
463
+ }
464
+ }
465
+ return Array.from(duplicates);
466
+ }
467
+ function getDecimalNumberFromString(value, placesAfterDecimal = 2) {
468
+ // this method should internally handle if the value is number or string
469
+ return Number(Number(value).toFixed(placesAfterDecimal));
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
+ }
@@ -34,4 +34,6 @@ export declare class DateCodeModel {
34
34
  isSame(dateCodeModel: DateCodeModel): boolean;
35
35
  getWeekday(): Weekday;
36
36
  getDateInIST(): Date;
37
+ static getDaysInCurrentMonth(): number;
38
+ getDaysInMonth(dateCode?: string): number;
37
39
  }
@@ -98,8 +98,8 @@ class DateCodeModel {
98
98
  }
99
99
  const dateRange = startModel.getRange(endModel);
100
100
  const excludeDayPredicates = (dateModel) => !dateModel.isDayPresent(excludeDays);
101
- const excludeDatePredicates = (dateModel) => !excludeDateCodes.some(d => d.isSame(dateModel));
102
- return dateRange.filter((dateModel => excludeDayPredicates(dateModel) && excludeDatePredicates(dateModel))).length;
101
+ const excludeDatePredicates = (dateModel) => !excludeDateCodes.some((d) => d.isSame(dateModel));
102
+ return dateRange.filter((dateModel) => excludeDayPredicates(dateModel) && excludeDatePredicates(dateModel)).length;
103
103
  }
104
104
  static getByPredicates(models, includePredicates, excludePredicates) {
105
105
  return models.filter((model) => includePredicates.every((predicate) => predicate(model)) &&
@@ -209,5 +209,18 @@ class DateCodeModel {
209
209
  billDateIST.setHours(nowIST.getHours(), nowIST.getMinutes(), nowIST.getSeconds(), nowIST.getMilliseconds());
210
210
  return billDateIST;
211
211
  }
212
+ static getDaysInCurrentMonth() {
213
+ const today = new Date();
214
+ const lastDay = (0, date_fns_1.lastDayOfMonth)(today); // Gives last day of current month
215
+ return lastDay.getDate(); // Number of days in that month
216
+ }
217
+ getDaysInMonth(dateCode) {
218
+ // If a dateCode is provided, use that; otherwise use this instance's dateCode
219
+ const model = dateCode ? new DateCodeModel(dateCode) : this;
220
+ // Reuse existing parsing/normalization via getDate()
221
+ const date = model.getDate();
222
+ // Number of days in that month
223
+ return (0, date_fns_1.lastDayOfMonth)(date).getDate();
224
+ }
212
225
  }
213
226
  exports.DateCodeModel = DateCodeModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "10.16.1",
3
+ "version": "10.17.1-beta.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [