law-common 7.0.1-beta.1 → 8.0.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.
@@ -1,3 +1,5 @@
1
- import { IBankEntity, IEntityCreateDto } from "../../entities";
2
- export interface IBankCreateDto extends IEntityCreateDto<IBankEntity> {
1
+ import { BankStatusEnum, IBankEntity, IEntityCreateDto } from "../../entities";
2
+ export interface IBankCreateDto extends Omit<IEntityCreateDto<IBankEntity>, IBankExclude> {
3
+ status?: BankStatusEnum;
3
4
  }
5
+ export type IBankExclude = "status";
@@ -1,3 +1,5 @@
1
- import { IEntityCreateDto, ILeaveEntity } from "../../entities";
2
- export interface ILeaveCreateDto extends IEntityCreateDto<ILeaveEntity> {
1
+ import { IEntityCreateDto, ILeaveEntity, LeaveStatusEnum } from "../../entities";
2
+ export type ILeaveExclude = "status";
3
+ export interface ILeaveCreateDto extends Omit<IEntityCreateDto<ILeaveEntity>, ILeaveExclude> {
4
+ status?: LeaveStatusEnum;
3
5
  }
@@ -31,8 +31,8 @@ export type ITimesheetFlowConfig = {
31
31
  };
32
32
  };
33
33
  export type ITimesheetFlowContextData = {
34
- currentTimesheet?: ITimesheetEntity;
35
- projectUserMapping?: IProjectUserMappingEntity;
36
- buffer?: number;
37
- dto?: ITimesheetEntityUpdateDto;
34
+ currentTimesheet: ITimesheetEntity;
35
+ projectUserMapping: IProjectUserMappingEntity;
36
+ buffer: number;
37
+ dto: ITimesheetEntityUpdateDto;
38
38
  };
@@ -1,4 +1,6 @@
1
- import { IEntityCreateDto } from "../../entities";
1
+ import { IEntityCreateDto, WorkFromHomeStatusEnum } from "../../entities";
2
2
  import { IWorkFromHomeEntity } from "../../entities/interface/work_from_home.entity.interface";
3
- export interface IWorkFromHomeCreateDto extends IEntityCreateDto<IWorkFromHomeEntity> {
3
+ export interface IWorkFromHomeCreateDto extends Omit<IEntityCreateDto<IWorkFromHomeEntity>, IWorkFromHomeExclude> {
4
+ status?: WorkFromHomeStatusEnum;
4
5
  }
6
+ export type IWorkFromHomeExclude = "status";
@@ -1,4 +1,5 @@
1
1
  export declare enum ConfigurationTypeEnum {
2
2
  INTEGER = "integer",
3
+ INTEGER_POSITIVE = "integer_positive",
3
4
  STRING = "string"
4
5
  }
@@ -4,5 +4,6 @@ exports.ConfigurationTypeEnum = void 0;
4
4
  var ConfigurationTypeEnum;
5
5
  (function (ConfigurationTypeEnum) {
6
6
  ConfigurationTypeEnum["INTEGER"] = "integer";
7
+ ConfigurationTypeEnum["INTEGER_POSITIVE"] = "integer_positive";
7
8
  ConfigurationTypeEnum["STRING"] = "string";
8
9
  })(ConfigurationTypeEnum || (exports.ConfigurationTypeEnum = ConfigurationTypeEnum = {}));
@@ -12,7 +12,7 @@ export interface IBankEntity extends IAuditColumnEntity {
12
12
  micrCode: string;
13
13
  ifscCode: string;
14
14
  emailForPaymentInfoCsv: string;
15
- status?: BankStatusEnum;
15
+ status: BankStatusEnum;
16
16
  remark?: string;
17
17
  }
18
18
  export interface IBankActionDataDto {
@@ -37,7 +37,6 @@ export interface IBillingTimesheetEntity extends IAuditColumnEntity {
37
37
  export interface IBillingTimesheetEntityCreateDto extends IEntityCreateDto<IBillingTimesheetEntity> {
38
38
  }
39
39
  export interface IBillingTimesheetDetail extends IAuditColumnEntity {
40
- id: number;
41
40
  timesheetId: number;
42
41
  totalAmount: number;
43
42
  changedStatus: BillingTimesheetStatusEnum;
@@ -10,7 +10,8 @@ export interface IConfigurationEntity extends IAuditColumnEntity {
10
10
  type: ConfigurationTypeEnum;
11
11
  description?: string;
12
12
  }
13
- export interface IConfigurationEntityCreateDto extends IEntityCreateDto<IConfigurationEntity> {
13
+ export type IConfigurationExclude = "organizationId";
14
+ export interface IConfigurationEntityCreateDto extends Omit<IEntityCreateDto<IConfigurationEntity>, IConfigurationExclude> {
14
15
  }
15
16
  export interface IConfigurationEntityUpdateDto extends Omit<IEntityUpdateDto<IConfigurationEntity>, "key"> {
16
17
  }
@@ -30,6 +30,7 @@ export type IEntityFilterData<T> = ConvertToArray<IEntityUpdateDto<T>> & {
30
30
  lessThan?: {
31
31
  [key in keyof T]?: T[key];
32
32
  };
33
+ [key: string]: any;
33
34
  };
34
35
  export type IEntityHistoryParsed = {
35
36
  parsedData: any;
@@ -7,7 +7,7 @@ export interface ILeaveEntity extends IAuditColumnEntity {
7
7
  fromDate: string;
8
8
  toDate: string;
9
9
  reason: string;
10
- status?: LeaveStatusEnum;
10
+ status: LeaveStatusEnum;
11
11
  remark?: string;
12
12
  }
13
13
  export type ILeaveEntityFilterData = IEntityFilterData<ILeaveEntity>;
@@ -8,12 +8,14 @@ export interface IReimbursementExpenseEntity extends IAuditColumnEntity {
8
8
  projectId: number;
9
9
  expenseType: string;
10
10
  amount: number;
11
- state?: ReimbursementExpenseState;
11
+ state: ReimbursementExpenseState;
12
12
  remark?: string;
13
13
  sanctionedBy?: number;
14
14
  }
15
- export interface IReimbursementExpenseEntityCreateDto extends IEntityCreateDto<IReimbursementExpenseEntity> {
15
+ export type IReimbursementExpenseExclude = "state";
16
+ export interface IReimbursementExpenseEntityCreateDto extends Omit<IEntityCreateDto<IReimbursementExpenseEntity>, IReimbursementExpenseExclude> {
16
17
  id?: number;
18
+ state?: ReimbursementExpenseState;
17
19
  }
18
20
  export interface IReimbursementExpenseEntityUpdateDto extends IEntityUpdateDto<IReimbursementExpenseEntity> {
19
21
  id?: number;
@@ -1,5 +1,6 @@
1
1
  import { TaskStatusEnum, TaskTypeEnum } from "../enums/task.entity.enum";
2
2
  import { IAuditColumnEntity } from "./audit-column.entity.interface";
3
+ import { IEntityFilterData } from "./entity.utils.interface";
3
4
  export interface ITaskEntity extends IAuditColumnEntity {
4
5
  id: number;
5
6
  name: string;
@@ -7,3 +8,5 @@ export interface ITaskEntity extends IAuditColumnEntity {
7
8
  status: TaskStatusEnum;
8
9
  type: TaskTypeEnum;
9
10
  }
11
+ export interface ITaskEntityFilterDto extends IEntityFilterData<ITaskEntity> {
12
+ }
@@ -10,10 +10,11 @@ export interface ITimesheetEntity extends IAuditColumnEntity {
10
10
  description?: string;
11
11
  dateCode: string;
12
12
  totalDuration: number;
13
- status?: TimesheetStatusEnum;
13
+ status: TimesheetStatusEnum;
14
14
  remark?: string;
15
15
  }
16
- export interface ITimesheetEntityCreateDto extends IEntityCreateDto<ITimesheetEntity> {
16
+ export type ITimesheetEntityExclude = "status";
17
+ export interface ITimesheetEntityCreateDto extends Omit<IEntityCreateDto<ITimesheetEntity>, ITimesheetEntityExclude> {
17
18
  status?: TimesheetStatusEnum;
18
19
  }
19
20
  export interface IActionDataDto {
@@ -7,7 +7,8 @@ export interface IWorkFromHomeEntity extends IAuditColumnEntity {
7
7
  fromDate: string;
8
8
  toDate: string;
9
9
  reason: string;
10
- status?: WorkFromHomeStatusEnum;
10
+ status: WorkFromHomeStatusEnum;
11
11
  remark?: string;
12
12
  }
13
- export type IWorkFromHomeEntityFilterData = IEntityFilterData<IWorkFromHomeEntity>;
13
+ export interface IWorkFromHomeEntityFilterDto extends IEntityFilterData<IWorkFromHomeEntity> {
14
+ }
@@ -117,3 +117,23 @@ export declare function getFilterByPermissionFn<T>(permissionFilterConfig: {
117
117
  export declare function getPropertyFilterByPermissionFn<T>(permissionFilterConfig: {
118
118
  [key: string]: () => Promise<IEntityFilterData<T>>;
119
119
  }, propertyNames: (keyof T)[], userPermission: string, filterDto: IEntityFilterData<T>, emptyValue?: any): Promise<IEntityFilterData<T>>;
120
+ /**
121
+ * Sets a property value on an object with proper TypeScript type safety.
122
+ *
123
+ * @template T - The type of the target object.
124
+ * @template K - The type of the key, constrained to the keys of T.
125
+ * @param {T} obj - The object on which the value should be set.
126
+ * @param {K} key - The key of the property to update.
127
+ * @param {T[K]} value - The new value to assign to the property.
128
+ *
129
+ * @example
130
+ * interface User {
131
+ * name: string;
132
+ * age: number;
133
+ * }
134
+ *
135
+ * const user: User = { name: 'Alice', age: 25 };
136
+ * setResponseValue(user, 'age', 30);
137
+ * console.log(user); // Output: { name: 'Alice', age: 30 }
138
+ */
139
+ export declare function setResponseValue<K extends keyof T, T>(obj: T, key: K, value: T[K]): void;
@@ -26,6 +26,7 @@ exports.getEnumNames = getEnumNames;
26
26
  exports.getFilterByPermission = getFilterByPermission;
27
27
  exports.getFilterByPermissionFn = getFilterByPermissionFn;
28
28
  exports.getPropertyFilterByPermissionFn = getPropertyFilterByPermissionFn;
29
+ exports.setResponseValue = setResponseValue;
29
30
  function groupByFunction(list, keyGetter) {
30
31
  const map = new Map();
31
32
  list.forEach((item) => {
@@ -258,3 +259,25 @@ function getPropertyFilterByPermissionFn(permissionFilterConfig_1, propertyNames
258
259
  return result;
259
260
  });
260
261
  }
262
+ /**
263
+ * Sets a property value on an object with proper TypeScript type safety.
264
+ *
265
+ * @template T - The type of the target object.
266
+ * @template K - The type of the key, constrained to the keys of T.
267
+ * @param {T} obj - The object on which the value should be set.
268
+ * @param {K} key - The key of the property to update.
269
+ * @param {T[K]} value - The new value to assign to the property.
270
+ *
271
+ * @example
272
+ * interface User {
273
+ * name: string;
274
+ * age: number;
275
+ * }
276
+ *
277
+ * const user: User = { name: 'Alice', age: 25 };
278
+ * setResponseValue(user, 'age', 30);
279
+ * console.log(user); // Output: { name: 'Alice', age: 30 }
280
+ */
281
+ function setResponseValue(obj, key, value) {
282
+ obj[key] = value;
283
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "7.0.1-beta.1",
3
+ "version": "8.0.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [