law-common 1.2.18 → 1.2.20

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.
@@ -15,3 +15,4 @@ export * from "./interface/industry.entity.response";
15
15
  export * from "./interface/configuration.entity.response";
16
16
  export * from "./interface/rate.entity.response";
17
17
  export * from "./interface/client.entity.response";
18
+ export * from "./interface/project.entity.response";
package/dist/api/index.js CHANGED
@@ -31,3 +31,4 @@ __exportStar(require("./interface/industry.entity.response"), exports);
31
31
  __exportStar(require("./interface/configuration.entity.response"), exports);
32
32
  __exportStar(require("./interface/rate.entity.response"), exports);
33
33
  __exportStar(require("./interface/client.entity.response"), exports);
34
+ __exportStar(require("./interface/project.entity.response"), exports);
@@ -0,0 +1,11 @@
1
+ import { IApiEntity, IProjectEntity, IProjectEntityDependent } from "../../entities";
2
+ import { IUserApiEntity } from "./user.entity.api";
3
+ export type IProjectApiEntity = IApiEntity<IProjectEntity>;
4
+ export type IProjectApiEntityArray = IProjectApiEntity[];
5
+ export type IProjectApiEntityDependent = IProjectApiEntity & IProjectEntityDependent;
6
+ export type IProjectEntityGet = {
7
+ projects: IProjectApiEntityDependent[];
8
+ users: {
9
+ [key: string]: IUserApiEntity;
10
+ };
11
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ export declare enum ProjectBillingTypeEnum {
2
+ HOURLY = "HOURLY",
3
+ FIXED = "FIXED",
4
+ ADHOC = "ADHOC"
5
+ }
6
+ export declare enum ProjectStatusEnum {
7
+ ACTIVE = "ACTIVE",
8
+ INACTIVE = "INACTIVE",
9
+ DELETED = "DELETED",
10
+ COMPLETED = "COMPLETED",
11
+ ON_HOLD = "ON_HOLD",
12
+ SUSPENDED = "SUSPENDED",
13
+ CANCELLED = "CANCELLED",
14
+ ARCHIVED = "ARCHIVED"
15
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProjectStatusEnum = exports.ProjectBillingTypeEnum = void 0;
4
+ var ProjectBillingTypeEnum;
5
+ (function (ProjectBillingTypeEnum) {
6
+ ProjectBillingTypeEnum["HOURLY"] = "HOURLY";
7
+ ProjectBillingTypeEnum["FIXED"] = "FIXED";
8
+ ProjectBillingTypeEnum["ADHOC"] = "ADHOC";
9
+ })(ProjectBillingTypeEnum || (exports.ProjectBillingTypeEnum = ProjectBillingTypeEnum = {}));
10
+ var ProjectStatusEnum;
11
+ (function (ProjectStatusEnum) {
12
+ ProjectStatusEnum["ACTIVE"] = "ACTIVE";
13
+ ProjectStatusEnum["INACTIVE"] = "INACTIVE";
14
+ ProjectStatusEnum["DELETED"] = "DELETED";
15
+ ProjectStatusEnum["COMPLETED"] = "COMPLETED";
16
+ ProjectStatusEnum["ON_HOLD"] = "ON_HOLD";
17
+ ProjectStatusEnum["SUSPENDED"] = "SUSPENDED";
18
+ ProjectStatusEnum["CANCELLED"] = "CANCELLED";
19
+ ProjectStatusEnum["ARCHIVED"] = "ARCHIVED";
20
+ })(ProjectStatusEnum || (exports.ProjectStatusEnum = ProjectStatusEnum = {}));
@@ -13,3 +13,4 @@ export * from "./interface/industry.entity.interface";
13
13
  export * from "./interface/configuration.entity.interface";
14
14
  export * from "./interface/rate.entity.interface";
15
15
  export * from "./interface/client.entity.interface";
16
+ export * from "./interface/project.entity.interface";
@@ -29,3 +29,4 @@ __exportStar(require("./interface/industry.entity.interface"), exports);
29
29
  __exportStar(require("./interface/configuration.entity.interface"), exports);
30
30
  __exportStar(require("./interface/rate.entity.interface"), exports);
31
31
  __exportStar(require("./interface/client.entity.interface"), exports);
32
+ __exportStar(require("./interface/project.entity.interface"), exports);
@@ -0,0 +1,52 @@
1
+ import { CurrencyEnum, TimeUnitEnum } from "../../enums";
2
+ import { ProjectBillingTypeEnum, ProjectStatusEnum } from "../enums/project.entity.enum";
3
+ import { UserRoleEnum } from "../enums/user.entity.enum";
4
+ import { IAuditColumnEntity } from "./audit-column.entity.interface";
5
+ import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
6
+ export interface IProjectEntity extends IAuditColumnEntity {
7
+ id: number;
8
+ name: string;
9
+ clientId: number;
10
+ startDate: string;
11
+ currency: CurrencyEnum;
12
+ billingType: ProjectBillingTypeEnum;
13
+ billingRate: string;
14
+ status: ProjectStatusEnum;
15
+ organizationId: number;
16
+ description?: string;
17
+ expectedEndDate?: string;
18
+ actualEndDate?: string;
19
+ }
20
+ export interface IProjectEntityDependent {
21
+ partnerIds: number[];
22
+ resourceIds: number[];
23
+ }
24
+ export type IProjectExclude = "organizationId" | "billingRate";
25
+ export interface IProjectHourlyRate {
26
+ id: number;
27
+ rate: number;
28
+ unit: TimeUnitEnum.HOUR;
29
+ }
30
+ export type IProjectHourlyRates = IProjectHourlyRate[];
31
+ export interface IProjectFixedMonthlyRate {
32
+ rate: number;
33
+ unit: TimeUnitEnum.MONTH;
34
+ maxEstimatedHours: number;
35
+ }
36
+ export interface IProjectAdhocRate {
37
+ rate: number;
38
+ maxEstimatedHours: number;
39
+ }
40
+ export interface IProjectEntityCreateDto extends Omit<IEntityCreateDto<IProjectEntity>, IProjectExclude>, IProjectEntityDependent {
41
+ projectBillingRate?: IProjectHourlyRates | IProjectFixedMonthlyRate | IProjectAdhocRate;
42
+ }
43
+ export interface IProjectEntityUpdateDto extends Omit<IEntityUpdateDto<IProjectEntity>, IProjectExclude>, Partial<IProjectEntityDependent> {
44
+ }
45
+ export interface IProjectEntityFilterDto extends IEntityFilterData<IProjectEntity> {
46
+ }
47
+ export interface IProjectUserMappingEntity extends IAuditColumnEntity {
48
+ id: number;
49
+ projectId: number;
50
+ userId: number;
51
+ role: UserRoleEnum;
52
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -80,3 +80,9 @@ export declare function arrayIntersectionWith<T>(source: T[], target: T[], compa
80
80
  * console.log(result); // Output: [1, 2, 3, 4]
81
81
  */
82
82
  export declare function arrayUnion<T>(source: T[], target: T[]): T[];
83
+ export declare function newRemoved<T>(existing: T[], incoming: T[]): {
84
+ added: T[];
85
+ deleted: T[];
86
+ present: T[];
87
+ };
88
+ export declare function getEnumNames(enumType: object): string[];
@@ -9,6 +9,8 @@ exports.arrayDifference = arrayDifference;
9
9
  exports.arrayIntersection = arrayIntersection;
10
10
  exports.arrayIntersectionWith = arrayIntersectionWith;
11
11
  exports.arrayUnion = arrayUnion;
12
+ exports.newRemoved = newRemoved;
13
+ exports.getEnumNames = getEnumNames;
12
14
  function groupByFunction(list, keyGetter) {
13
15
  const map = new Map();
14
16
  list.forEach((item) => {
@@ -128,3 +130,14 @@ function arrayIntersectionWith(source, target, comparator) {
128
130
  function arrayUnion(source, target) {
129
131
  return [...new Set([...source, ...target])];
130
132
  }
133
+ function newRemoved(existing, incoming) {
134
+ existing = existing || [];
135
+ incoming = incoming || [];
136
+ const added = arrayDifference(existing, incoming);
137
+ const deleted = arrayDifference(incoming, existing);
138
+ const present = arrayUnion(arrayIntersection(existing, incoming), added);
139
+ return { added, deleted, present };
140
+ }
141
+ function getEnumNames(enumType) {
142
+ return Object.values(enumType).filter((value) => typeof value === "string");
143
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "1.2.18",
3
+ "version": "1.2.20",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [