law-common 10.0.0 → 10.0.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.
@@ -75,3 +75,5 @@ export * from "./interface/work_from_home_history.api";
75
75
  export * from "./interface/country.entity.response";
76
76
  export * from "./interface/organization.entity.api";
77
77
  export * from "./interface/intermediary.bank.entity.response";
78
+ export * from "./interface/holiday.entity.response";
79
+ export * from "./interface/holiday-list.entity.response";
@@ -91,3 +91,5 @@ __exportStar(require("./interface/work_from_home_history.api"), exports);
91
91
  __exportStar(require("./interface/country.entity.response"), exports);
92
92
  __exportStar(require("./interface/organization.entity.api"), exports);
93
93
  __exportStar(require("./interface/intermediary.bank.entity.response"), exports);
94
+ __exportStar(require("./interface/holiday.entity.response"), exports);
95
+ __exportStar(require("./interface/holiday-list.entity.response"), exports);
@@ -0,0 +1,3 @@
1
+ import { IApiEntity, IHolidayListEntity } from "../../entities";
2
+ export type IHolidayListApiEntity = IApiEntity<IHolidayListEntity>;
3
+ export type IHolidayListApiEntityArray = IHolidayListApiEntity[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { IApiEntity, IHolidayEntity } from "../../entities";
2
+ export type IHolidayApiEntity = IApiEntity<IHolidayEntity>;
3
+ export type IHolidayApiEntityArray = IHolidayApiEntity[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -65,3 +65,5 @@ export * from "./enums/billing_invoice_type.enum";
65
65
  export * from "./interface/billing_timesheet.entity.interface";
66
66
  export * from "./interface/intermediary_bank.entity.interface";
67
67
  export * from "./enums/leave-type.enum";
68
+ export * from "./interface/holiday-list.entity.interface";
69
+ export * from "./interface/holiday.entity.interface";
@@ -82,3 +82,5 @@ __exportStar(require("./enums/billing_invoice_type.enum"), exports);
82
82
  __exportStar(require("./interface/billing_timesheet.entity.interface"), exports);
83
83
  __exportStar(require("./interface/intermediary_bank.entity.interface"), exports);
84
84
  __exportStar(require("./enums/leave-type.enum"), exports);
85
+ __exportStar(require("./interface/holiday-list.entity.interface"), exports);
86
+ __exportStar(require("./interface/holiday.entity.interface"), exports);
@@ -15,6 +15,8 @@ import { IConfigurationEntity } from "./configuration.entity.interface";
15
15
  import { ICountryEntity } from "./country.entity.interface";
16
16
  import { IDesignationEntity } from "./designation.entity.interface";
17
17
  import { IExpenseTypeEntity } from "./expense_type.entity.interface";
18
+ import { IHolidayListEntity } from "./holiday-list.entity.interface";
19
+ import { IHolidayEntity } from "./holiday.entity.interface";
18
20
  import { IIndustryEntity } from "./industry.entity.interface";
19
21
  import { IIntermediaryBankEntity } from "./intermediary_bank.entity.interface";
20
22
  import { ILeaveEntity } from "./leave.entity.interface";
@@ -70,7 +72,9 @@ export declare enum EntityEnum {
70
72
  ROLE = "role",
71
73
  PROJECT_USER_MAPPING = "project_user_mapping",
72
74
  CLIENT_USER_MAPPING = "client_user_mapping",
73
- ROLE_PERMISSION_MAPPING = "role_permission_mapping"
75
+ ROLE_PERMISSION_MAPPING = "role_permission_mapping",
76
+ HOLIDAY = "holiday",
77
+ HOLIDAY_LIST = "holiday_list"
74
78
  }
75
79
  export type EntityRelations = {
76
80
  [K in EntityEnum]: K;
@@ -100,7 +104,7 @@ export type IBaseEntityApiResponse<T extends {
100
104
  [K in EntityEnum]?: IBaseEntityApiResponse<EnumEntityType<K>>;
101
105
  };
102
106
  };
103
- export type EnumEntityType<T extends EntityEnum> = (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.BANK_HISTORY ? IBankHistoryEntity : 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.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.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : never) & {
107
+ export type EnumEntityType<T extends EntityEnum> = (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.BANK_HISTORY ? IBankHistoryEntity : 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.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : never) & {
104
108
  id: number;
105
109
  };
106
110
  export type EntityRelationConfig<T extends EntityEnum> = {
@@ -33,4 +33,6 @@ var EntityEnum;
33
33
  EntityEnum["PROJECT_USER_MAPPING"] = "project_user_mapping";
34
34
  EntityEnum["CLIENT_USER_MAPPING"] = "client_user_mapping";
35
35
  EntityEnum["ROLE_PERMISSION_MAPPING"] = "role_permission_mapping";
36
+ EntityEnum["HOLIDAY"] = "holiday";
37
+ EntityEnum["HOLIDAY_LIST"] = "holiday_list";
36
38
  })(EntityEnum || (exports.EntityEnum = EntityEnum = {}));
@@ -0,0 +1,12 @@
1
+ import { IAuditColumnEntity } from "./audit-column.entity.interface";
2
+ import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
3
+ export interface IHolidayListEntity extends IAuditColumnEntity {
4
+ id: number;
5
+ description: string;
6
+ }
7
+ export interface IHolidayListCreateDto extends IEntityCreateDto<IHolidayListEntity> {
8
+ }
9
+ export interface IHolidayListUpdateDto extends IEntityUpdateDto<IHolidayListEntity> {
10
+ }
11
+ export interface IHolidayListFilterDto extends IEntityFilterData<IHolidayListEntity> {
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { IAuditColumnEntity } from "./audit-column.entity.interface";
2
+ import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
3
+ export interface IHolidayEntity extends IAuditColumnEntity {
4
+ id: number;
5
+ holidayListId: number;
6
+ dateCode: string;
7
+ }
8
+ export interface IHolidayCreateDto extends IEntityCreateDto<IHolidayEntity> {
9
+ }
10
+ export interface IHolidayUpdateDto extends IEntityUpdateDto<IHolidayEntity> {
11
+ }
12
+ export interface IHolidayFilterDto extends IEntityFilterData<IHolidayEntity> {
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  import { EntityEnum, EnumEntityType, IEntityFilterData } from "../entities";
2
+ import { DateCodeModel } from "./models/date-code.model.util";
2
3
  export declare function groupByFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T[]>;
3
4
  export declare function groupByOneToOneFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T>;
4
5
  export declare function convertMapToObject<K, T>(map: Map<K, T>): {
@@ -167,3 +168,7 @@ export declare function numberToWordsIndian(numStr: string): string;
167
168
  */
168
169
  export declare function minutesToHoursMinutes(totalMinutes: number): string;
169
170
  export declare function createKeyLabelMap<Entity>(): Record<keyof Entity, string>;
171
+ export declare function getFinancialYearRange(dateCodeModel: DateCodeModel): {
172
+ startDate: string;
173
+ endDate: string;
174
+ };
@@ -30,7 +30,9 @@ exports.setResponseValue = setResponseValue;
30
30
  exports.numberToWordsIndian = numberToWordsIndian;
31
31
  exports.minutesToHoursMinutes = minutesToHoursMinutes;
32
32
  exports.createKeyLabelMap = createKeyLabelMap;
33
+ exports.getFinancialYearRange = getFinancialYearRange;
33
34
  const util_constants_1 = require("../constants/util.constants");
35
+ const date_code_model_util_1 = require("./models/date-code.model.util");
34
36
  function groupByFunction(list, keyGetter) {
35
37
  const map = new Map();
36
38
  list.forEach((item) => {
@@ -367,3 +369,16 @@ function createKeyLabelMap() {
367
369
  },
368
370
  });
369
371
  }
372
+ function getFinancialYearRange(dateCodeModel) {
373
+ const date = dateCodeModel.getDate();
374
+ const year = date.getFullYear();
375
+ const month = date.getMonth() + 1; // 1-based
376
+ const fyStartYear = month < 4 ? year - 1 : year;
377
+ const fyEndYear = month < 4 ? year : year + 1;
378
+ const start = new Date(fyStartYear, 3, 1); // April 1
379
+ const end = new Date(fyEndYear, 2, 31); // March 31
380
+ return {
381
+ startDate: date_code_model_util_1.DateCodeModel.fromDate(start),
382
+ endDate: date_code_model_util_1.DateCodeModel.fromDate(end),
383
+ };
384
+ }
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "law-common",
3
- "version": "10.0.0",
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.0.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
+ }