law-common 10.25.1-beta.2 → 10.25.1-beta.3

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.
@@ -20,6 +20,7 @@ export * from "./interface/billing.entity.response";
20
20
  export * from "./interface/office.location.create.dto.interface";
21
21
  export * from "./interface/office.Location.update.dto.interface";
22
22
  export * from "./interface/office.location.entity.response";
23
+ export * from "./interface/billing.timesheet.entity.api";
23
24
  export * from "./interface/billing.entity.api";
24
25
  export * from "./interface/billing.update.dto.interface";
25
26
  export * from "./interface/bank.create.dto.interface";
@@ -36,6 +36,7 @@ __exportStar(require("./interface/billing.entity.response"), exports);
36
36
  __exportStar(require("./interface/office.location.create.dto.interface"), exports);
37
37
  __exportStar(require("./interface/office.Location.update.dto.interface"), exports);
38
38
  __exportStar(require("./interface/office.location.entity.response"), exports);
39
+ __exportStar(require("./interface/billing.timesheet.entity.api"), exports);
39
40
  __exportStar(require("./interface/billing.entity.api"), exports);
40
41
  __exportStar(require("./interface/billing.update.dto.interface"), exports);
41
42
  __exportStar(require("./interface/bank.create.dto.interface"), exports);
@@ -1,10 +1,11 @@
1
- import { BillingActionsEnum, BillingStatusEnum, IBillingEntity, IBillingTimesheetEntity, IProjectEntity, IUserEntity } from "../../entities";
1
+ import { BillingActionsEnum, BillingStatusEnum, IBillingEntity, IProjectEntity, IUserEntity } from "../../entities";
2
2
  import { IBillingReimbursementExpenseApiEntity } from "./billing-reimbursement-expense.api";
3
3
  import { IBillingApiEntity } from "./billing.entity.api";
4
+ import { IBillingTimesheetApiEntity } from "./billing.timesheet.entity.api";
4
5
  import { IUpdateBillingDto } from "./billing.update.dto.interface";
5
6
  export type IBillingEntityResponse = {
6
7
  billing: IBillingApiEntity;
7
- billingTimesheets?: IBillingTimesheetEntity[];
8
+ billingTimesheets?: IBillingTimesheetApiEntity[];
8
9
  billingReimbursementExpenses?: IBillingReimbursementExpenseApiEntity[];
9
10
  };
10
11
  export interface IUserEntityRelation {
@@ -0,0 +1,3 @@
1
+ import { IApiEntity, IBillingTimesheetEntity } from "../../entities";
2
+ export type IBillingTimesheetApiEntity = IApiEntity<IBillingTimesheetEntity>;
3
+ export type IBillingTimesheetApiEntityArray = IBillingTimesheetApiEntity[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,13 @@
1
- import { IProjectUserMappingEntity, ITimesheetEntity, ITimesheetEntityUpdateDto, IUserEntity, TimesheetActionEnum, TimesheetStatusEnum } from "../../entities";
1
+ import { IApiEntity, IProjectUserMappingEntity, ITimesheetEntity, ITimesheetEntityUpdateDto, IUserEntity, TimesheetActionEnum, TimesheetStatusEnum } from "../../entities";
2
+ import { IBaseResponse } from "./base.response.interface";
2
3
  import { IClientApiEntityDependent } from "./client.entity.response";
3
4
  import { IProjectApiEntityDependent } from "./project.entity.response";
5
+ export type ITimesheetApiEntity = IApiEntity<ITimesheetEntity>;
6
+ export type ITimesheetApiEntityArray = ITimesheetApiEntity[];
7
+ export type ITimesheetApiEntityResponse = IBaseResponse<ITimesheetApiEntity>;
8
+ export type ITimesheetApiEntityResponseArray = IBaseResponse<ITimesheetApiEntity>;
4
9
  export type ITimesheetEntityGet = {
5
- timesheets: ITimesheetEntity[];
10
+ timesheets: ITimesheetApiEntity[];
6
11
  clients: {
7
12
  [key: string]: IClientApiEntityDependent;
8
13
  };
@@ -1,10 +1,7 @@
1
- import { IApiEntity } from "../../entities";
2
1
  import { WorkFromHomeActionEnum } from "../../entities/enums/work.from.home.action.enum";
3
2
  import { WorkFromHomeStatusEnum } from "../../entities/enums/work.from.home.status.enum";
4
3
  import { IWorkFromHomeEntity } from "../../entities/interface/work_from_home.entity.interface";
5
4
  import { IWorkFromHomeUpdateDto } from "./work.from.home.update.interface";
6
- export type IWorkFromHomeApiEntity = IApiEntity<IWorkFromHomeEntity>;
7
- export type IWorkFromHomeApiEntityArray = IWorkFromHomeApiEntity[];
8
5
  export type IWorkFromHomeFlowContextData = {
9
6
  currentTimesheet?: IWorkFromHomeEntity;
10
7
  dto?: IWorkFromHomeUpdateDto;
@@ -1,9 +1,9 @@
1
1
  import { BillingImpactEnum } from "../enums/billing.impact.enum";
2
2
  import { BillingTimesheetStatusEnum } from "../enums/billing.timesheet.change.status.enum";
3
- import { IEntityAuditColumn } from "./entity-audit-columns.interface";
3
+ import { IAuditColumnEntity } from "./audit-column.entity.interface";
4
4
  import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
5
5
  import { ITimesheetEntity } from "./timesheet.entity.interface";
6
- export interface IBillingTimesheetEntity extends IEntityAuditColumn {
6
+ export interface IBillingTimesheetEntity extends IAuditColumnEntity {
7
7
  id: number;
8
8
  billingId: number;
9
9
  dateCode: string;
@@ -20,7 +20,7 @@ export interface IBillingTimesheetEntity extends IEntityAuditColumn {
20
20
  }
21
21
  export interface IBillingTimesheetEntityCreateDto extends IEntityCreateDto<IBillingTimesheetEntity> {
22
22
  }
23
- export interface IBillingTimesheetDetails extends IEntityAuditColumn {
23
+ export interface IBillingTimesheetDetail extends IAuditColumnEntity {
24
24
  timesheetId: number;
25
25
  billingId: number;
26
26
  totalAmount?: number;
@@ -34,7 +34,7 @@ export interface IBillingTimesheetDetails extends IEntityAuditColumn {
34
34
  totalDuration: number;
35
35
  dateCode: string;
36
36
  }
37
- export interface IBillingTimesheetDetailsArray extends Array<IBillingTimesheetDetails> {
37
+ export interface IBillingTimesheetDetailsArray extends Array<IBillingTimesheetDetail> {
38
38
  }
39
39
  export interface IBillingTimesheetEntityFilterDto extends IEntityFilterData<IBillingTimesheetEntity> {
40
40
  }
@@ -1,10 +1,10 @@
1
1
  import { TimesheetActionEnum } from "../enums/timesheet.action.enum";
2
2
  import { TimesheetStatusEnum } from "../enums/timesheet.status.enum";
3
- import { IEntityAuditColumn } from "./entity-audit-columns.interface";
3
+ import { IAuditColumnEntity } from "./audit-column.entity.interface";
4
4
  import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
5
5
  import { IProjectUserMappingEntity } from "./project.entity.interface";
6
6
  import { IUserEntity } from "./user.entity.interface";
7
- export interface ITimesheetEntity extends IEntityAuditColumn {
7
+ export interface ITimesheetEntity extends IAuditColumnEntity {
8
8
  id: number;
9
9
  userId: number;
10
10
  projectId: number;
@@ -1,7 +1,7 @@
1
1
  import { WorkFromHomeStatusEnum } from "../enums/work.from.home.status.enum";
2
- import { IAuditColumnEntity } from "./audit-column.entity.interface";
2
+ import { IEntityAuditColumn } from "./entity-audit-columns.interface";
3
3
  import { IEntityFilterData } from "./entity.utils.interface";
4
- export interface IWorkFromHomeEntity extends IAuditColumnEntity {
4
+ export interface IWorkFromHomeEntity extends IEntityAuditColumn {
5
5
  id: number;
6
6
  employeeId: number;
7
7
  fromDate: string;
@@ -1,9 +1,9 @@
1
+ import { IBillingTimesheetApiEntity } from "../../api";
1
2
  import { BillingImpactEnum } from "../enums/billing.impact.enum";
2
3
  import { BillingTimesheetStatusEnum } from "../enums/billing.timesheet.change.status.enum";
3
- import { IBillingTimesheetEntity } from "../interface/billing_timesheet.entity.interface";
4
4
  import { EntityEnum } from "../interface/entity.utils.interface";
5
5
  import { BaseEntityModel } from "./base.entity.model";
6
- export declare class BillingTimesheetEntityModel extends BaseEntityModel<EntityEnum.BILLING_TIMESHEET> implements IBillingTimesheetEntity {
6
+ export declare class BillingTimesheetEntityModel extends BaseEntityModel<EntityEnum.BILLING_TIMESHEET> implements IBillingTimesheetApiEntity {
7
7
  id: number;
8
8
  billingId: number;
9
9
  dateCode: string;
@@ -17,10 +17,10 @@ export declare class BillingTimesheetEntityModel extends BaseEntityModel<EntityE
17
17
  impact: BillingImpactEnum;
18
18
  amendmentPurpose?: string;
19
19
  changedStatus: BillingTimesheetStatusEnum;
20
- createdOn: number;
21
- updatedOn: number;
20
+ createdOn: string;
21
+ updatedOn: string;
22
22
  createdBy: number;
23
23
  updatedBy: number;
24
24
  getRelationConfigs(): any;
25
- static fromApiEntity(entity: IBillingTimesheetEntity): BillingTimesheetEntityModel;
25
+ static fromApiEntity(apiEntity: IBillingTimesheetApiEntity): BillingTimesheetEntityModel;
26
26
  }
@@ -19,18 +19,18 @@ class BillingTimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
19
19
  this.totalAmount = 0;
20
20
  this.impact = billing_impact_enum_1.BillingImpactEnum.NEUTRAL; // adjust default if needed
21
21
  this.changedStatus = billing_timesheet_change_status_enum_1.BillingTimesheetStatusEnum.UNCHANGED;
22
- this.createdOn = 0;
23
- this.updatedOn = 0;
22
+ this.createdOn = "";
23
+ this.updatedOn = "";
24
24
  this.createdBy = 0;
25
25
  this.updatedBy = 0;
26
26
  }
27
27
  getRelationConfigs() {
28
28
  return this.constructor.prototype.constructor.relationConfigs;
29
29
  }
30
- static fromApiEntity(entity) {
31
- const result = new BillingTimesheetEntityModel(entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET);
32
- Object.assign(result, entity);
33
- return result;
30
+ static fromApiEntity(apiEntity) {
31
+ const entity = new BillingTimesheetEntityModel(entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET);
32
+ Object.assign(entity, apiEntity);
33
+ return entity;
34
34
  }
35
35
  }
36
36
  exports.BillingTimesheetEntityModel = BillingTimesheetEntityModel;
@@ -63,7 +63,7 @@ function parseEntities(json, baseEntity, entityMap) {
63
63
  [entity_utils_interface_1.EntityEnum.CONFIGURATION]: configuration_model_1.ConfigurationEntityModel.fromEntity,
64
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
- [entity_utils_interface_1.EntityEnum.TIMESHEET]: timesheet_entity_model_1.TimesheetEntityModel.fromEntity,
66
+ [entity_utils_interface_1.EntityEnum.TIMESHEET]: timesheet_entity_model_1.TimesheetEntityModel.fromApiEntity,
67
67
  };
68
68
  if (!(baseEntity in entityFromJsonMappings)) {
69
69
  throw new Error(`Unknown entity: ${baseEntity}`);
@@ -1,8 +1,8 @@
1
+ import { ITimesheetApiEntity } from "../../api";
1
2
  import { TimesheetStatusEnum } from "../enums/timesheet.status.enum";
2
3
  import { EntityEnum } from "../interface/entity.utils.interface";
3
- import { ITimesheetEntity } from "../interface/timesheet.entity.interface";
4
4
  import { BaseEntityModel } from "./base.entity.model";
5
- export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIMESHEET> implements ITimesheetEntity {
5
+ export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIMESHEET> implements ITimesheetApiEntity {
6
6
  id: number;
7
7
  userId: number;
8
8
  projectId: number;
@@ -14,8 +14,8 @@ export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIM
14
14
  remark?: string;
15
15
  createdBy: number;
16
16
  updatedBy: number;
17
- createdOn: number;
18
- updatedOn: number;
19
- static fromEntity(entity: ITimesheetEntity): TimesheetEntityModel;
17
+ createdOn: string;
18
+ updatedOn: string;
19
+ static fromApiEntity(apiEntity: ITimesheetApiEntity): TimesheetEntityModel;
20
20
  getRelationConfigs(): any[];
21
21
  }
@@ -16,13 +16,13 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
16
16
  this.status = timesheet_status_enum_1.TimesheetStatusEnum.CREATE_APPROVAL;
17
17
  this.createdBy = 0;
18
18
  this.updatedBy = 0;
19
- this.createdOn = 0;
20
- this.updatedOn = 0;
19
+ this.createdOn = "";
20
+ this.updatedOn = "";
21
21
  }
22
- static fromEntity(entity) {
23
- const result = new TimesheetEntityModel(entity_utils_interface_1.EntityEnum.TIMESHEET);
24
- Object.assign(result, entity);
25
- return result;
22
+ static fromApiEntity(apiEntity) {
23
+ const entity = new TimesheetEntityModel(entity_utils_interface_1.EntityEnum.TIMESHEET);
24
+ Object.assign(entity, apiEntity);
25
+ return entity;
26
26
  }
27
27
  getRelationConfigs() {
28
28
  return this.constructor.prototype.constructor.relationConfigs || [];
@@ -1,3 +1,4 @@
1
+ import { ITimesheetApiEntity } from "../../api";
1
2
  import { ITimesheetEntity, TimesheetStatusEnum } from "../../entities";
2
3
  import { ITimesheetEntityModel } from "./interface/timesheet.model.interface";
3
4
  export declare class TimesheetEntityModel implements ITimesheetEntityModel {
@@ -9,9 +10,9 @@ export declare class TimesheetEntityModel implements ITimesheetEntityModel {
9
10
  dateCode: string;
10
11
  totalDuration: number;
11
12
  createdBy: number;
12
- createdOn: number;
13
+ createdOn: Date;
13
14
  updatedBy: number;
14
- updatedOn: number;
15
+ updatedOn: Date;
15
16
  status: TimesheetStatusEnum;
16
17
  billingId?: number;
17
18
  /**
@@ -24,5 +25,5 @@ export declare class TimesheetEntityModel implements ITimesheetEntityModel {
24
25
  * @returns
25
26
  */
26
27
  static getTotalDuration(timesheets: ITimesheetEntityModel[]): number;
27
- static fromEntity(entity: ITimesheetEntity): TimesheetEntityModel;
28
+ static fromApiEntity(apiEntity: ITimesheetApiEntity): TimesheetEntityModel;
28
29
  }
@@ -12,9 +12,9 @@ class TimesheetEntityModel {
12
12
  this.dateCode = "";
13
13
  this.totalDuration = 0;
14
14
  this.createdBy = 0;
15
- this.createdOn = 0;
15
+ this.createdOn = new Date();
16
16
  this.updatedBy = 1;
17
- this.updatedOn = 0;
17
+ this.updatedOn = new Date();
18
18
  this.status = entities_1.TimesheetStatusEnum.CREATE_APPROVAL;
19
19
  this.billingId = 0;
20
20
  }
@@ -34,10 +34,10 @@ class TimesheetEntityModel {
34
34
  const totalDurationOfEachTimesheet = timesheets.map((timesheet) => timesheet.totalDuration);
35
35
  return totalDurationOfEachTimesheet.reduce((sum, duration) => sum + duration, 0);
36
36
  }
37
- static fromEntity(entity) {
38
- const result = new TimesheetEntityModel();
39
- Object.assign(result, entity);
40
- return result;
37
+ static fromApiEntity(apiEntity) {
38
+ const entity = new TimesheetEntityModel();
39
+ Object.assign(entity, apiEntity);
40
+ return entity;
41
41
  }
42
42
  }
43
43
  exports.TimesheetEntityModel = TimesheetEntityModel;
@@ -270,4 +270,3 @@ export declare function hasProperty<T extends object>(obj: T | null | undefined,
270
270
  */
271
271
  export declare function convertToNumberType<T extends string | number>(value: T): number;
272
272
  export declare function epochToDateTime(epoch: number): string;
273
- export declare function dateTimeToEpoch(dateInput: string | Date): number;
@@ -40,7 +40,6 @@ exports.getDecimalNumberFromString = getDecimalNumberFromString;
40
40
  exports.hasProperty = hasProperty;
41
41
  exports.convertToNumberType = convertToNumberType;
42
42
  exports.epochToDateTime = epochToDateTime;
43
- exports.dateTimeToEpoch = dateTimeToEpoch;
44
43
  const date_fns_1 = require("date-fns");
45
44
  const util_constants_1 = require("../constants/util.constants");
46
45
  const error_key_enum_1 = require("../enums/error.key.enum");
@@ -571,7 +570,3 @@ function epochToDateTime(epoch) {
571
570
  const date = new Date(epoch * 1000); // JS Date expects milliseconds
572
571
  return (0, date_fns_1.format)(date, "yyyy-MM-dd HH:mm:ss");
573
572
  }
574
- function dateTimeToEpoch(dateInput) {
575
- const date = typeof dateInput === "string" ? new Date(dateInput) : dateInput;
576
- return Math.floor(date.getTime() / 1000);
577
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "10.25.1-beta.2",
3
+ "version": "10.25.1-beta.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [