law-common 10.21.2-beta.0 → 10.21.2-beta.2

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.
@@ -49,7 +49,7 @@ function populateRelationsFor(entityIndexMap, enumEntities) {
49
49
  }
50
50
  function parseEntities(json, baseEntity, entityMap, epoch) {
51
51
  var _a;
52
- const nonEpochEntityFromJsonMappings = {
52
+ const entityFromJsonMappings = {
53
53
  [entity_utils_interface_1.EntityEnum.PROJECT]: project_entity_model_1.ProjectEntityModel.fromApiEntity,
54
54
  [entity_utils_interface_1.EntityEnum.CLIENT]: client_entity_model_1.ClientEntityModel.fromApiEntity,
55
55
  [entity_utils_interface_1.EntityEnum.BILLING]: billing_entity_model_1.BillingEntityModel.fromApiEntity,
@@ -61,37 +61,16 @@ function parseEntities(json, baseEntity, entityMap, epoch) {
61
61
  [entity_utils_interface_1.EntityEnum.CLIENT_AFFILIATE]: client_affiliate_entity_model_1.ClientAffiliateEntityModel.fromApiEntity,
62
62
  [entity_utils_interface_1.EntityEnum.BANK]: bank_entity_model_1.BankEntityModel.fromApiEntity,
63
63
  [entity_utils_interface_1.EntityEnum.CONFIGURATION]: configuration_model_1.ConfigurationEntityModel.fromApiEntity,
64
- // [EntityEnum.TASK]: TaskEntityModel.fromApiEntity,
64
+ [entity_utils_interface_1.EntityEnum.TASK]: task_entity_model_1.TaskEntityModel.fromEntity,
65
65
  [entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET]: billing_timesheet_entity_model_1.BillingTimesheetEntityModel.fromApiEntity,
66
66
  [entity_utils_interface_1.EntityEnum.TIMESHEET]: timesheet_entity_model_1.TimesheetEntityModel.fromApiEntity,
67
67
  };
68
- const epochEntityFromJsonMappings = {
69
- // [EntityEnum.PROJECT]: ProjectEntityModel.fromApiEntity,
70
- // [EntityEnum.CLIENT]: ClientEntityModel.fromApiEntity,
71
- // [EntityEnum.BILLING]: BillingEntityModel.fromApiEntity,
72
- // [EntityEnum.USER]: UserEntityModel.fromApiEntity,
73
- // [EntityEnum.PROJECT_USER_MAPPING]:
74
- // ProjectUserMappingEntityModel.fromApiEntity,
75
- // [EntityEnum.REIMBURSEMENT]: ReimbursementEntityModel.fromApiEntity,
76
- // [EntityEnum.REIMBURSEMENT_EXPENSE]:
77
- // ReimbursementExpenseEntityModel.fromApiEntity,
78
- // [EntityEnum.BILLING_REIMBURSEMENT_EXPENSE]:
79
- // BillingReimbursementExpneseEntityModel.fromApiEntity,
80
- // [EntityEnum.CLIENT_AFFILIATE]: ClientAffiliateEntityModel.fromApiEntity,
81
- // [EntityEnum.BANK]: BankEntityModel.fromApiEntity,
82
- // [EntityEnum.CONFIGURATION]: ConfigurationEntityModel.fromApiEntity,
83
- [entity_utils_interface_1.EntityEnum.TASK]: task_entity_model_1.TaskEntityModel.fromApiEntity,
84
- // [EntityEnum.BILLING_TIMESHEET]: BillingTimesheetEntityModel.fromApiEntity,
85
- // [EntityEnum.TIMESHEET]: TimesheetEntityModel.fromApiEntity,
86
- };
87
- let entityFromJsonMappings = nonEpochEntityFromJsonMappings;
88
- if (epoch) {
89
- entityFromJsonMappings = epochEntityFromJsonMappings;
90
- }
91
68
  if (!(baseEntity in entityFromJsonMappings)) {
92
69
  throw new Error(`Unknown entity: ${baseEntity}`);
93
70
  }
94
- entityMap[baseEntity] = ((_a = json["baseEntities"]) !== null && _a !== void 0 ? _a : []).map((e) => entityFromJsonMappings[baseEntity](e));
71
+ entityMap[baseEntity] = ((_a = json["baseEntities"]) !== null && _a !== void 0 ? _a : []).map(
72
+ // REVIEW: Needs to be fixed after audit column type conversion
73
+ (e) => entityFromJsonMappings[baseEntity](e));
95
74
  if (json["relatedEntities"]) {
96
75
  const relatedEntities = json["relatedEntities"];
97
76
  for (const entityName in relatedEntities) {
@@ -12,6 +12,6 @@ export declare class TaskEntityModel extends BaseEntityModel<EntityEnum.TASK> im
12
12
  updatedBy: number;
13
13
  createdOn: number;
14
14
  updatedOn: number;
15
- static fromApiEntity(apiEntity: ITaskEntity): TaskEntityModel;
15
+ static fromEntity(entity: ITaskEntity): TaskEntityModel;
16
16
  getRelationConfigs(): any[];
17
17
  }
@@ -17,10 +17,10 @@ class TaskEntityModel extends base_entity_model_1.BaseEntityModel {
17
17
  this.createdOn = 0;
18
18
  this.updatedOn = 0;
19
19
  }
20
- static fromApiEntity(apiEntity) {
21
- const entity = new TaskEntityModel(entity_utils_interface_1.EntityEnum.TASK);
22
- Object.assign(entity, Object.assign(Object.assign({}, apiEntity), { createdOn: Number(apiEntity.createdOn), updatedOn: Number(apiEntity.updatedOn) }));
23
- return entity;
20
+ static fromEntity(entity) {
21
+ const model = new TaskEntityModel(entity_utils_interface_1.EntityEnum.TASK);
22
+ Object.assign(model, entity);
23
+ return model;
24
24
  }
25
25
  getRelationConfigs() {
26
26
  return this.constructor.prototype.constructor.relationConfigs || [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "10.21.2-beta.0",
3
+ "version": "10.21.2-beta.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [