law-common 10.18.1-beta.16 → 10.18.1-beta.18

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,6 +1,7 @@
1
1
  import { IBaseResponse } from "../../api";
2
2
  import { ConvertToArray } from "../../misc";
3
3
  import { Modify } from "../../misc/interface/modify.interface";
4
+ import { TimesheetEntityModel } from "../../model/entities/timesheet.model";
4
5
  import { EntitySearchConstraintTypeEnum } from "../enums/entity_search_constraint_type.enum";
5
6
  import { HistoryOperationEnum } from "../enums/history_operation.enum";
6
7
  import { BankEntityModel } from "../model/bank.entity.model";
@@ -280,7 +281,7 @@ export declare enum VirtualEntityEnum {
280
281
  }
281
282
  export type IHistoryConstraintSearchResponse<T> = IBaseResponse<IHistoryEntitySearchByConstraintResponse<T>[]>;
282
283
  export type IHistoryConstraintSearchServiceResponse<T> = IHistoryEntitySearchByConstraintResponse<T>[];
283
- 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.CLIENT_AFFILIATE ? ClientAffiliateEntityModel : T extends EntityEnum.BANK ? BankEntityModel : T extends EntityEnum.CONFIGURATION ? ConfigurationEntityModel : T extends EntityEnum.TASK ? TaskEntityModel : T extends EntityEnum.BILLING_TIMESHEET ? BillingTimesheetEntityModel : UserEntityModel;
284
+ 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.CLIENT_AFFILIATE ? ClientAffiliateEntityModel : T extends EntityEnum.BANK ? BankEntityModel : T extends EntityEnum.CONFIGURATION ? ConfigurationEntityModel : T extends EntityEnum.TASK ? TaskEntityModel : T extends EntityEnum.BILLING_TIMESHEET ? BillingTimesheetEntityModel : T extends EntityEnum.TIMESHEET ? TimesheetEntityModel : UserEntityModel;
284
285
  export type EntityMap = {
285
286
  [key in EntityEnum]: EnumToModel<key>[];
286
287
  };
@@ -10,6 +10,7 @@ import { RelationConfigs } from "../interface/relation-config.interface";
10
10
  import { BankEntityModel } from "./bank.entity.model";
11
11
  import { BaseEntityModel } from "./base.entity.model";
12
12
  import { BillingReimbursementExpneseEntityModel } from "./billing-reimbursement-expense.entity.model";
13
+ import { BillingTimesheetEntityModel } from "./billing-timesheet.entity.model";
13
14
  import { ClientEntityModel } from "./client.entity.model";
14
15
  import { ProjectEntityModel } from "./project.entity.model";
15
16
  import { ReimbursementExpenseEntityModel } from "./reimbursement-expense.entity.model";
@@ -57,12 +58,14 @@ export declare class BillingEntityModel extends BaseEntityModel<EntityEnum.BILLI
57
58
  billingIdReimbursementExpense?: BillingReimbursementExpneseEntityModel[];
58
59
  reimbursementExpense?: ReimbursementExpenseEntityModel[];
59
60
  bank?: BankEntityModel[];
61
+ billingTimesheets?: BillingTimesheetEntityModel[];
60
62
  static relationConfigs: RelationConfigs<[
61
63
  EntityEnum.PROJECT,
62
64
  EntityEnum.CLIENT,
63
65
  EntityEnum.USER,
64
66
  EntityEnum.REIMBURSEMENT_EXPENSE,
65
67
  EntityEnum.BILLING_REIMBURSEMENT_EXPENSE,
68
+ EntityEnum.BILLING_TIMESHEET,
66
69
  EntityEnum.BANK
67
70
  ], EnumEntityType<EntityEnum.BILLING>>;
68
71
  static fromApiEntity(apiEntity: IBillingApiEntity): BillingEntityModel;
@@ -225,6 +225,15 @@ BillingEntityModel.relationConfigs = [
225
225
  key: "id",
226
226
  },
227
227
  },
228
+ {
229
+ name: entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET,
230
+ relation: relation_type_enum_1.RelationType.MANY,
231
+ key: "billingTimesheets",
232
+ mapKeyConfig: {
233
+ relationKey: "billingId",
234
+ key: "id",
235
+ },
236
+ },
228
237
  {
229
238
  name: entity_utils_interface_1.EntityEnum.BANK,
230
239
  relation: relation_type_enum_1.RelationType.MANY,
@@ -4,6 +4,7 @@ exports.mapToIndex = mapToIndex;
4
4
  exports.getEntityIndexMap = getEntityIndexMap;
5
5
  exports.populateRelationsFor = populateRelationsFor;
6
6
  exports.parseEntities = parseEntities;
7
+ const timesheet_model_1 = require("../../model/entities/timesheet.model");
7
8
  const entity_utils_interface_1 = require("../interface/entity.utils.interface");
8
9
  const bank_entity_model_1 = require("./bank.entity.model");
9
10
  const base_entity_model_1 = require("./base.entity.model");
@@ -48,6 +49,7 @@ function populateRelationsFor(entityIndexMap, enumEntities) {
48
49
  }
49
50
  function parseEntities(json, baseEntity, entityMap) {
50
51
  var _a;
52
+ console.log("baseEntity", baseEntity[0]);
51
53
  const entityFromJsonMappings = {
52
54
  [entity_utils_interface_1.EntityEnum.PROJECT]: project_entity_model_1.ProjectEntityModel.fromApiEntity,
53
55
  [entity_utils_interface_1.EntityEnum.CLIENT]: client_entity_model_1.ClientEntityModel.fromApiEntity,
@@ -62,8 +64,10 @@ function parseEntities(json, baseEntity, entityMap) {
62
64
  [entity_utils_interface_1.EntityEnum.CONFIGURATION]: configuration_model_1.ConfigurationEntityModel.fromApiEntity,
63
65
  [entity_utils_interface_1.EntityEnum.TASK]: task_entity_model_1.TaskEntityModel.fromApiEntity,
64
66
  [entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET]: billing_timesheet_entity_model_1.BillingTimesheetEntityModel.fromApiEntity,
67
+ [entity_utils_interface_1.EntityEnum.TIMESHEET]: timesheet_model_1.TimesheetEntityModel.fromApiEntity,
65
68
  };
66
69
  if (!(baseEntity in entityFromJsonMappings)) {
70
+ console.log("entityFromJsonMappings", entityFromJsonMappings);
67
71
  throw new Error(`Unknown entity: ${baseEntity}`);
68
72
  }
69
73
  entityMap[baseEntity] = ((_a = json["baseEntities"]) !== null && _a !== void 0 ? _a : []).map((e) => entityFromJsonMappings[baseEntity](e));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "10.18.1-beta.16",
3
+ "version": "10.18.1-beta.18",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [