law-common 10.18.1 → 10.18.2-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.
@@ -6,6 +6,9 @@ import { HistoryOperationEnum } from "../enums/history_operation.enum";
6
6
  import { BillingReimbursementExpneseEntityModel } from "../model/billing-reimbursement-expense.entity.model";
7
7
  import { BillingEntityModel } from "../model/billing.entity.model";
8
8
  import { ClientEntityModel } from "../model/client.entity.model";
9
+ import { HolidayEntityModel } from "../model/holiday.entity.model";
10
+ import { LeaveEntityModel } from "../model/leave.entity.model";
11
+ import { LeaveCountVirtualEntityModel } from "../model/leave_count.entity.model";
9
12
  import { ProjectUserMappingEntityModel } from "../model/project-user-mapping.entity.model";
10
13
  import { ProjectEntityModel } from "../model/project.entity.model";
11
14
  import { ReimbursementExpenseEntityModel } from "../model/reimbursement-expense.entity.model";
@@ -275,12 +278,12 @@ export declare enum VirtualEntityEnum {
275
278
  }
276
279
  export type IHistoryConstraintSearchResponse<T> = IBaseResponse<IHistoryEntitySearchByConstraintResponse<T>[]>;
277
280
  export type IHistoryConstraintSearchServiceResponse<T> = IHistoryEntitySearchByConstraintResponse<T>[];
278
- export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.PROJECT ? ProjectEntityModel : T extends EntityEnum.PROJECT_USER_MAPPING ? ProjectUserMappingEntityModel : T extends EntityEnum.REIMBURSEMENT ? ReimbursementEntityModel : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? ReimbursementExpenseEntityModel : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? BillingReimbursementExpneseEntityModel : UserEntityModel;
281
+ export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.PROJECT ? ProjectEntityModel : T extends EntityEnum.PROJECT_USER_MAPPING ? ProjectUserMappingEntityModel : T extends EntityEnum.REIMBURSEMENT ? ReimbursementEntityModel : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? ReimbursementExpenseEntityModel : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? BillingReimbursementExpneseEntityModel : T extends EntityEnum.LEAVE ? LeaveEntityModel : T extends EntityEnum.HOLIDAY ? HolidayEntityModel : T extends VirtualEntityEnum.LEAVE_COUNT ? LeaveCountVirtualEntityModel : UserEntityModel;
279
282
  export type EntityMap = {
280
- [key in EntityEnum]: EnumToModel<key>[];
283
+ [key in EntityEnum | VirtualEntityEnum]: EnumToModel<key>[];
281
284
  };
282
285
  export type EntityIndexMap = {
283
- [key in EntityEnum]: {
286
+ [key in EntityEnum | VirtualEntityEnum]: {
284
287
  [id: number]: EnumToModel<key>;
285
288
  };
286
289
  };
@@ -1,8 +1,8 @@
1
- import { EntityEnum, EntityIndexMap, EntityMap, EnumEntityType, IBaseEntityApiResponse } from "../interface/entity.utils.interface";
1
+ import { EntityEnum, EntityIndexMap, EntityMap, EnumEntityType, IBaseEntityApiResponse, VirtualEntityEnum } from "../interface/entity.utils.interface";
2
2
  export declare function mapToIndex(entityMap: EntityMap): EntityIndexMap;
3
3
  export declare function getEntityIndexMap<T extends EntityEnum>(data: IBaseEntityApiResponse<EnumEntityType<T>>, baseEntity: T, reusedConfig?: {
4
4
  existingEntityIndexMap: EntityIndexMap;
5
5
  enumEntities: EntityEnum[];
6
6
  }): EntityIndexMap;
7
7
  export declare function populateRelationsFor(entityIndexMap: EntityIndexMap, enumEntities: EntityEnum[]): void;
8
- export declare function parseEntities<T extends EnumEntityType<EntityEnum>>(json: IBaseEntityApiResponse<T>, baseEntity: EntityEnum, entityMap: EntityMap): EntityMap;
8
+ export declare function parseEntities<T extends EnumEntityType<EntityEnum | VirtualEntityEnum>>(json: IBaseEntityApiResponse<T>, baseEntity: EntityEnum | VirtualEntityEnum, entityMap: EntityMap): EntityMap;
@@ -9,6 +9,9 @@ const base_entity_model_1 = require("./base.entity.model");
9
9
  const billing_reimbursement_expense_entity_model_1 = require("./billing-reimbursement-expense.entity.model");
10
10
  const billing_entity_model_1 = require("./billing.entity.model");
11
11
  const client_entity_model_1 = require("./client.entity.model");
12
+ const holiday_entity_model_1 = require("./holiday.entity.model");
13
+ const leave_entity_model_1 = require("./leave.entity.model");
14
+ const leave_count_entity_model_1 = require("./leave_count.entity.model");
12
15
  const project_user_mapping_entity_model_1 = require("./project-user-mapping.entity.model");
13
16
  const project_entity_model_1 = require("./project.entity.model");
14
17
  const reimbursement_expense_entity_model_1 = require("./reimbursement-expense.entity.model");
@@ -52,6 +55,10 @@ function parseEntities(json, baseEntity, entityMap) {
52
55
  [entity_utils_interface_1.EntityEnum.REIMBURSEMENT]: reimbursement_entity_model_1.ReimbursementEntityModel.fromApiEntity,
53
56
  [entity_utils_interface_1.EntityEnum.REIMBURSEMENT_EXPENSE]: reimbursement_expense_entity_model_1.ReimbursementExpenseEntityModel.fromApiEntity,
54
57
  [entity_utils_interface_1.EntityEnum.BILLING_REIMBURSEMENT_EXPENSE]: billing_reimbursement_expense_entity_model_1.BillingReimbursementExpneseEntityModel.fromApiEntity,
58
+ [entity_utils_interface_1.EntityEnum.HOLIDAY]: holiday_entity_model_1.HolidayEntityModel.fromApiEntity,
59
+ [entity_utils_interface_1.EntityEnum.LEAVE]: leave_entity_model_1.LeaveEntityModel.fromApiEntity,
60
+ [entity_utils_interface_1.VirtualEntityEnum.LEAVE_COUNT]: leave_count_entity_model_1.LeaveCountVirtualEntityModel.fromApiEntity,
61
+ // Add other entities here as needed
55
62
  };
56
63
  if (!(baseEntity in entityFromJsonMappings)) {
57
64
  throw new Error(`Unknown entity: ${baseEntity}`);
@@ -1,7 +1,7 @@
1
1
  import { IHolidayApiEntity } from "../../api";
2
2
  import { EntityEnum } from "../interface/entity.utils.interface";
3
3
  import { BaseEntityModel } from "./base.entity.model";
4
- export declare class HolidayEntity extends BaseEntityModel<EntityEnum.HOLIDAY> implements IHolidayApiEntity {
4
+ export declare class HolidayEntityModel extends BaseEntityModel<EntityEnum.HOLIDAY> implements IHolidayApiEntity {
5
5
  id: number;
6
6
  holidayListId: number;
7
7
  dateCode: string;
@@ -10,5 +10,5 @@ export declare class HolidayEntity extends BaseEntityModel<EntityEnum.HOLIDAY> i
10
10
  createdOn: string;
11
11
  updatedOn: string;
12
12
  getRelationConfigs(): never[];
13
- static fromApiEntity(apiEntity: IHolidayApiEntity): HolidayEntity;
13
+ static fromApiEntity(apiEntity: IHolidayApiEntity): HolidayEntityModel;
14
14
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HolidayEntity = void 0;
3
+ exports.HolidayEntityModel = void 0;
4
4
  const entity_utils_interface_1 = require("../interface/entity.utils.interface");
5
5
  const base_entity_model_1 = require("./base.entity.model");
6
6
  // import { IHolidayApiEntity } from "law-common/dist/src/api";
7
- class HolidayEntity extends base_entity_model_1.BaseEntityModel {
7
+ class HolidayEntityModel extends base_entity_model_1.BaseEntityModel {
8
8
  constructor() {
9
9
  super(...arguments);
10
10
  this.id = 0;
@@ -19,9 +19,9 @@ class HolidayEntity extends base_entity_model_1.BaseEntityModel {
19
19
  return [];
20
20
  }
21
21
  static fromApiEntity(apiEntity) {
22
- const entity = new HolidayEntity(entity_utils_interface_1.EntityEnum.HOLIDAY);
22
+ const entity = new HolidayEntityModel(entity_utils_interface_1.EntityEnum.HOLIDAY);
23
23
  Object.assign(entity, apiEntity);
24
24
  return entity;
25
25
  }
26
26
  }
27
- exports.HolidayEntity = HolidayEntity;
27
+ exports.HolidayEntityModel = HolidayEntityModel;
@@ -7,6 +7,7 @@ import { RelationType } from "../enums/relation-type.enum";
7
7
  import { EntityEnum, VirtualEntityEnum } from "../interface/entity.utils.interface";
8
8
  import { BaseEntityModel } from "./base.entity.model";
9
9
  import { LeaveCountVirtualEntityModel } from "./leave_count.entity.model";
10
+ import { UserEntityModel } from "./user.entity.model";
10
11
  export declare class LeaveEntityModel extends BaseEntityModel<EntityEnum.LEAVE> implements ILeaveApiEntity {
11
12
  id: number;
12
13
  employeeId: number;
@@ -22,6 +23,9 @@ export declare class LeaveEntityModel extends BaseEntityModel<EntityEnum.LEAVE>
22
23
  createdBy: number;
23
24
  updatedBy: number;
24
25
  leaveCount?: LeaveCountVirtualEntityModel;
26
+ createdByUser?: UserEntityModel;
27
+ updatedByUser?: UserEntityModel;
28
+ user?: UserEntityModel;
25
29
  private constructor();
26
30
  static fromEntity(data: ILeaveApiEntity): LeaveEntityModel;
27
31
  getLeaveDuration(excludeWeekdays?: Weekday[], excludeDates?: DateCodeModel[]): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "10.18.1",
3
+ "version": "10.18.2-beta.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [