law-common 10.72.23 → 10.73.1-beta.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.
package/README.md CHANGED
@@ -1 +1 @@
1
- # law-common
1
+ # law-common
@@ -6,7 +6,7 @@ import { ProjectUserStatusEnum } from "../enums/project_user_status.enum";
6
6
  import { UserRoleEnum } from "../enums/user.entity.enum";
7
7
  import { IClientEntity } from "./client.entity.interface";
8
8
  import { IEntityAuditColumn } from "./entity-audit-columns.interface";
9
- import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
9
+ import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto, Nullable } from "./entity.utils.interface";
10
10
  import { IProjectRevenueSplitMappingEntity } from "./project-revenue-split-mapping.entity";
11
11
  import { IUserEntity } from "./user.entity.interface";
12
12
  export interface IProjectEntity extends IEntityAuditColumn {
@@ -25,6 +25,13 @@ export interface IProjectEntity extends IEntityAuditColumn {
25
25
  billingOverdueDays?: number;
26
26
  billToClientAffiliateId?: number | null;
27
27
  revenueSplit: ProjectRevenueSplit;
28
+ usageNotificationSentPercentage?: Nullable<UsageNotificationThresholdEnum>;
29
+ clientQuoteId?: Nullable<number>;
30
+ }
31
+ export declare enum UsageNotificationThresholdEnum {
32
+ SEVENTY_FIVE = "75",
33
+ NINETY = "90",
34
+ NINETY_FIVE = "95"
28
35
  }
29
36
  export interface IProjectUserDto {
30
37
  id: number;
@@ -35,7 +42,7 @@ export interface IProjectEntityDependent {
35
42
  users: IProjectUserDto[];
36
43
  revenueSplitData: IProjectRevenueSplitData[];
37
44
  }
38
- export type IProjectExclude = "organizationId" | "billingRate";
45
+ export type IProjectExclude = "organizationId" | "billingRate" | "usageNotificationSentPercentage";
39
46
  export interface IProjectExcludeT extends Pick<IProjectEntity, IProjectExclude> {
40
47
  }
41
48
  export interface IProjectHourlyRate {
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UsageNotificationThresholdEnum = void 0;
4
+ var UsageNotificationThresholdEnum;
5
+ (function (UsageNotificationThresholdEnum) {
6
+ UsageNotificationThresholdEnum["SEVENTY_FIVE"] = "75";
7
+ UsageNotificationThresholdEnum["NINETY"] = "90";
8
+ UsageNotificationThresholdEnum["NINETY_FIVE"] = "95";
9
+ })(UsageNotificationThresholdEnum || (exports.UsageNotificationThresholdEnum = UsageNotificationThresholdEnum = {}));
@@ -1,9 +1,9 @@
1
1
  import { EntityEnum } from "../interface/entity.utils.interface";
2
- import { BaseEntityModel } from "./base.entity.model";
3
2
  import { RelationConfigs } from "../interface/relation-config.interface";
4
- import { IClientQuoteEntity } from "../interface/client_quote.entity.interface";
3
+ import { BaseEntityModel } from "./base.entity.model";
5
4
  import { ClientQuoteCurrencyEnum } from "../enums/client_quote_currency_enum";
6
5
  import { ClientQuoteStatusEnum } from "../enums/client_quote_status_enum";
6
+ import { IClientQuoteEntity } from "../interface/client_quote.entity.interface";
7
7
  import { ClientQuoteRateEntityModel } from "./client_quote_rate.entity.model";
8
8
  export declare class ClientQuoteEntityModel extends BaseEntityModel<EntityEnum.CLIENT_QUOTE> implements IClientQuoteEntity {
9
9
  id: number;
@@ -26,4 +26,5 @@ export declare class ClientQuoteEntityModel extends BaseEntityModel<EntityEnum.C
26
26
  static relationConfigs: RelationConfigs<[EntityEnum.CLIENT_QUOTE_RATE], EntityEnum.CLIENT_QUOTE>;
27
27
  static fromEntity(entity: IClientQuoteEntity): ClientQuoteEntityModel;
28
28
  getRelationConfigs(): any[];
29
+ get maxEstimatedHours(): number;
29
30
  }
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClientQuoteEntityModel = void 0;
4
+ const relation_type_enum_1 = require("../enums/relation-type.enum");
4
5
  const entity_utils_interface_1 = require("../interface/entity.utils.interface");
5
6
  const base_entity_model_1 = require("./base.entity.model");
6
- const relation_type_enum_1 = require("../enums/relation-type.enum");
7
+ const utils_1 = require("../../utils");
7
8
  const client_quote_currency_enum_1 = require("../enums/client_quote_currency_enum");
8
9
  const client_quote_status_enum_1 = require("../enums/client_quote_status_enum");
9
10
  class ClientQuoteEntityModel extends base_entity_model_1.BaseEntityModel {
@@ -33,6 +34,11 @@ class ClientQuoteEntityModel extends base_entity_model_1.BaseEntityModel {
33
34
  getRelationConfigs() {
34
35
  return this.constructor.prototype.constructor.relationConfigs || [];
35
36
  }
37
+ get maxEstimatedHours() {
38
+ if (!this.clientQuoteRates)
39
+ return 0;
40
+ return (0, utils_1.sumNormalised)(this.clientQuoteRates, "maxHour");
41
+ }
36
42
  }
37
43
  exports.ClientQuoteEntityModel = ClientQuoteEntityModel;
38
44
  ClientQuoteEntityModel.relationConfigs = [
@@ -1,8 +1,8 @@
1
1
  import { CurrencyEnum } from "../../enums";
2
2
  import { ProjectRevenueSplit } from "../enums/project-revenue-split.enum";
3
3
  import { ProjectBillingTypeEnum, ProjectStatusEnum } from "../enums/project.entity.enum";
4
- import { EntityEnum } from "../interface/entity.utils.interface";
5
- import { IProjectEntity, IProjectUserDto } from "../interface/project.entity.interface";
4
+ import { EntityEnum, Nullable } from "../interface/entity.utils.interface";
5
+ import { IProjectEntity, IProjectUserDto, UsageNotificationThresholdEnum } from "../interface/project.entity.interface";
6
6
  import { RelationConfigs } from "../interface/relation-config.interface";
7
7
  import { BaseEntityModel } from "./base.entity.model";
8
8
  import { ClientEntityModel } from "./client.entity.model";
@@ -27,6 +27,8 @@ export declare class ProjectEntityModel extends BaseEntityModel<EntityEnum.PROJE
27
27
  updatedOn: number;
28
28
  billToClientAffiliateId?: number | null;
29
29
  revenueSplit: ProjectRevenueSplit;
30
+ usageNotificationSentPercentage?: Nullable<UsageNotificationThresholdEnum>;
31
+ clientQuoteId?: Nullable<number>;
30
32
  users?: IProjectUserDto[];
31
33
  billingOverdueDays?: number;
32
34
  userMappings?: (UserEntityModel & ProjectUserMappingEntityModel)[];
@@ -37,4 +39,6 @@ export declare class ProjectEntityModel extends BaseEntityModel<EntityEnum.PROJE
37
39
  populateUsers(users: UserEntityModel[], projectUserMapping: ProjectUserMappingEntityModel[]): void;
38
40
  getRelationConfigs(): [import("../interface/relation-config.interface").IRelationConfig<EntityEnum.PROJECT_USER_MAPPING, EntityEnum.PROJECT>, import("../interface/relation-config.interface").IRelationConfig<EntityEnum.CLIENT, EntityEnum.PROJECT>];
39
41
  isForeignCurrencyProjoect(): boolean;
42
+ get parsedBillingRate(): any;
43
+ isHourlyProject(): boolean;
40
44
  }
@@ -25,6 +25,8 @@ class ProjectEntityModel extends base_entity_model_1.BaseEntityModel {
25
25
  this.updatedOn = 0;
26
26
  this.billToClientAffiliateId = null;
27
27
  this.revenueSplit = project_revenue_split_enum_1.ProjectRevenueSplit.NO;
28
+ this.usageNotificationSentPercentage = null;
29
+ this.clientQuoteId = null;
28
30
  this.users = [];
29
31
  this.client = {};
30
32
  }
@@ -49,6 +51,8 @@ class ProjectEntityModel extends base_entity_model_1.BaseEntityModel {
49
51
  result.billingOverdueDays = entity.billingOverdueDays;
50
52
  result.billToClientAffiliateId = entity.billingOverdueDays;
51
53
  result.revenueSplit = entity.revenueSplit;
54
+ result.usageNotificationSentPercentage = entity.usageNotificationSentPercentage;
55
+ result.clientQuoteId = result.clientQuoteId;
52
56
  return result;
53
57
  }
54
58
  populateUsers(users, projectUserMapping) {
@@ -89,6 +93,12 @@ class ProjectEntityModel extends base_entity_model_1.BaseEntityModel {
89
93
  isForeignCurrencyProjoect() {
90
94
  return this.currency !== enums_1.CurrencyEnum.INR;
91
95
  }
96
+ get parsedBillingRate() {
97
+ return this.billingRate ? JSON.parse(this.billingRate) : null;
98
+ }
99
+ isHourlyProject() {
100
+ return this.billingType === project_entity_enum_1.ProjectBillingTypeEnum.HOURLY;
101
+ }
92
102
  }
93
103
  exports.ProjectEntityModel = ProjectEntityModel;
94
104
  ProjectEntityModel.relationConfigs = [
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "name": "law-common",
3
- "version": "10.72.23",
4
- "description": "",
5
- "main": "dist/index.js",
6
- "files": [
7
- "dist/**/*"
8
- ],
9
- "scripts": {
10
- "clean": "rm -rf dist",
11
- "build": "npm run clean && tsc",
12
- "publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta && npm run link",
13
- "publish:patch": "npm version patch && git push && npm run build && npm publish",
14
- "publish:minor": "npm version minor && git push && npm run build && npm publish",
15
- "publish:major": "npm version major && git push && npm run build && npm publish",
16
- "link": "npm run build && npm link",
17
- "test": "jest",
18
- "format": "prettier --write .",
19
- "check-format": "prettier --check .",
20
- "pull:link": "git pull && npm run link"
21
- },
22
- "keywords": [],
23
- "author": "",
24
- "license": "ISC",
25
- "devDependencies": {
26
- "@types/jest": "^29.5.13",
27
- "@types/lodash": "^4.17.21",
28
- "@types/node": "^22.6.1",
29
- "jest": "^29.7.0",
30
- "prettier": "3.8.1",
31
- "ts-jest": "^29.2.5",
32
- "ts-node": "^10.9.2",
33
- "typescript": "^5.6.2"
34
- },
35
- "dependencies": {
36
- "@types/express": "^5.0.0",
37
- "@types/multer": "^1.4.12",
38
- "date-fns": "^4.1.0",
39
- "lodash": "4.17.21"
40
- }
41
- }
1
+ {
2
+ "name": "law-common",
3
+ "version": "10.73.1-beta.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist/**/*"
8
+ ],
9
+ "scripts": {
10
+ "clean": "rm -rf dist",
11
+ "build": "npm run clean && tsc",
12
+ "publish:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta && npm run link",
13
+ "publish:patch": "npm version patch && git push && npm run build && npm publish",
14
+ "publish:minor": "npm version minor && git push && npm run build && npm publish",
15
+ "publish:major": "npm version major && git push && npm run build && npm publish",
16
+ "link": "npm run build && npm link",
17
+ "test": "jest",
18
+ "format": "prettier --write .",
19
+ "check-format": "prettier --check .",
20
+ "pull:link": "git pull && npm run link"
21
+ },
22
+ "keywords": [],
23
+ "author": "",
24
+ "license": "ISC",
25
+ "devDependencies": {
26
+ "@types/jest": "^29.5.13",
27
+ "@types/lodash": "^4.17.21",
28
+ "@types/node": "^22.6.1",
29
+ "jest": "^29.7.0",
30
+ "prettier": "3.8.1",
31
+ "ts-jest": "^29.2.5",
32
+ "ts-node": "^10.9.2",
33
+ "typescript": "^5.6.2"
34
+ },
35
+ "dependencies": {
36
+ "@types/express": "^5.0.0",
37
+ "@types/multer": "^1.4.12",
38
+ "date-fns": "^4.1.0",
39
+ "lodash": "4.17.21"
40
+ }
41
+ }