law-common 10.57.0 → 10.57.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
@@ -1,4 +1,5 @@
1
1
  export * from "./billing_constants";
2
2
  export * from "./constants";
3
3
  export * from "./entity_constants";
4
+ export * from "./timesheet-constants";
4
5
  export * from "./util.constants";
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./billing_constants"), exports);
18
18
  __exportStar(require("./constants"), exports);
19
19
  __exportStar(require("./entity_constants"), exports);
20
+ __exportStar(require("./timesheet-constants"), exports);
20
21
  __exportStar(require("./util.constants"), exports);
@@ -0,0 +1,2 @@
1
+ export declare const MENTION_START_DELIMITER = "__mention";
2
+ export declare const MENTION_END_DELIMITER = "mentionend__";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MENTION_END_DELIMITER = exports.MENTION_START_DELIMITER = void 0;
4
+ exports.MENTION_START_DELIMITER = "__mention";
5
+ exports.MENTION_END_DELIMITER = "mentionend__";
@@ -7,6 +7,7 @@ export interface ITaskEntity extends IEntityAuditColumn {
7
7
  description: string;
8
8
  status: TaskStatusEnum;
9
9
  type: TaskTypeEnum;
10
+ isCollaborativeTask: boolean;
10
11
  }
11
12
  export interface ITaskEntityFilterDto extends IEntityFilterData<ITaskEntity> {
12
13
  }
@@ -12,6 +12,7 @@ export declare class TaskEntityModel extends BaseEntityModel<EntityEnum.TASK> im
12
12
  updatedBy: number;
13
13
  createdOn: number;
14
14
  updatedOn: number;
15
+ isCollaborativeTask: boolean;
15
16
  static fromEntity(entity: ITaskEntity): TaskEntityModel;
16
17
  getRelationConfigs(): any[];
17
18
  }
@@ -16,6 +16,7 @@ class TaskEntityModel extends base_entity_model_1.BaseEntityModel {
16
16
  this.updatedBy = 0;
17
17
  this.createdOn = 0;
18
18
  this.updatedOn = 0;
19
+ this.isCollaborativeTask = false;
19
20
  }
20
21
  static fromEntity(entity) {
21
22
  const model = new TaskEntityModel(entity_utils_interface_1.EntityEnum.TASK);
@@ -1,8 +1,13 @@
1
1
  import { TimesheetStatusEnum } from "../enums/timesheet.status.enum";
2
2
  import { EntityEnum } from "../interface/entity.utils.interface";
3
+ import { RelationConfigs } from "../interface/relation-config.interface";
3
4
  import { ITimesheetEntity } from "../interface/timesheet.entity.interface";
4
5
  import { BaseEntityModel } from "./base.entity.model";
6
+ import { ProjectEntityModel } from "./project.entity.model";
7
+ import { TaskEntityModel } from "./task.entity.model";
8
+ import { UserEntityModel } from "./user.entity.model";
5
9
  export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIMESHEET> implements ITimesheetEntity {
10
+ billingId?: number | undefined;
6
11
  id: number;
7
12
  userId: number;
8
13
  projectId: number;
@@ -16,6 +21,12 @@ export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIM
16
21
  updatedBy: number;
17
22
  createdOn: number;
18
23
  updatedOn: number;
24
+ user?: UserEntityModel;
25
+ project?: ProjectEntityModel;
26
+ taskModel?: TaskEntityModel;
19
27
  static fromEntity(entity: ITimesheetEntity): TimesheetEntityModel;
20
28
  getRelationConfigs(): any[];
29
+ static relationConfigs: RelationConfigs<[EntityEnum.USER, EntityEnum.PROJECT, EntityEnum.TASK], EntityEnum.TIMESHEET>;
30
+ get isCollaborativeTimesheet(): boolean | undefined;
31
+ static getMentionDelimitersLength(): number;
21
32
  }
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TimesheetEntityModel = void 0;
4
+ const constants_1 = require("../../constants");
5
+ const relation_type_enum_1 = require("../enums/relation-type.enum");
4
6
  const timesheet_status_enum_1 = require("../enums/timesheet.status.enum");
5
7
  const entity_utils_interface_1 = require("../interface/entity.utils.interface");
6
8
  const base_entity_model_1 = require("./base.entity.model");
@@ -27,5 +29,41 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
27
29
  getRelationConfigs() {
28
30
  return this.constructor.prototype.constructor.relationConfigs || [];
29
31
  }
32
+ get isCollaborativeTimesheet() {
33
+ var _a;
34
+ return (_a = this.taskModel) === null || _a === void 0 ? void 0 : _a.isCollaborativeTask;
35
+ }
36
+ static getMentionDelimitersLength() {
37
+ return constants_1.MENTION_START_DELIMITER.length + constants_1.MENTION_END_DELIMITER.length;
38
+ }
30
39
  }
31
40
  exports.TimesheetEntityModel = TimesheetEntityModel;
41
+ TimesheetEntityModel.relationConfigs = [
42
+ {
43
+ name: entity_utils_interface_1.EntityEnum.USER,
44
+ relation: relation_type_enum_1.RelationType.ONE,
45
+ key: "user",
46
+ mapKeyConfig: {
47
+ relationKey: "id",
48
+ key: "userId",
49
+ },
50
+ },
51
+ {
52
+ name: entity_utils_interface_1.EntityEnum.PROJECT,
53
+ relation: relation_type_enum_1.RelationType.ONE,
54
+ key: "project",
55
+ mapKeyConfig: {
56
+ relationKey: "id",
57
+ key: "projectId",
58
+ },
59
+ },
60
+ {
61
+ name: entity_utils_interface_1.EntityEnum.TASK,
62
+ relation: relation_type_enum_1.RelationType.ONE,
63
+ key: "taskModel",
64
+ mapKeyConfig: {
65
+ relationKey: "name",
66
+ key: "task",
67
+ },
68
+ },
69
+ ];
@@ -43,7 +43,7 @@ export declare class UserEntityModel extends BaseEntityModel<EntityEnum.USER> im
43
43
  updatedBy: number;
44
44
  createdOn: number;
45
45
  updatedOn: number;
46
- roleModel: RoleEntityModel;
46
+ roleModel?: RoleEntityModel;
47
47
  static relationConfigs: RelationConfigs<[EntityEnum.ROLE], EntityEnum.USER>;
48
48
  getRelationConfigs(): any[];
49
49
  static fromEntity(entity: IUserEntity): UserEntityModel;
@@ -5,3 +5,4 @@ export * from "./interface/upload-multer-file.interface";
5
5
  export * from "./models/dto-validation-type";
6
6
  export * from "./type/arrayed.type";
7
7
  export * from "./type/delete-document-details.type";
8
+ export * from "./interface/timesheet-description-mention.interface";
@@ -21,3 +21,4 @@ __exportStar(require("./interface/upload-multer-file.interface"), exports);
21
21
  __exportStar(require("./models/dto-validation-type"), exports);
22
22
  __exportStar(require("./type/arrayed.type"), exports);
23
23
  __exportStar(require("./type/delete-document-details.type"), exports);
24
+ __exportStar(require("./interface/timesheet-description-mention.interface"), exports);
@@ -0,0 +1,3 @@
1
+ export interface ITimesheetDescriptionMention {
2
+ id: number;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
1
  import { ITimesheetEntity, TimesheetStatusEnum } from "../../entities";
2
2
  import { ITimesheetEntityModel } from "./interface/timesheet.model.interface";
3
- export declare class TimesheetEntityModel implements ITimesheetEntityModel {
3
+ export declare class TimesheetModel implements ITimesheetEntityModel {
4
4
  id: number;
5
5
  userId: number;
6
6
  projectId: number;
@@ -14,15 +14,11 @@ export declare class TimesheetEntityModel implements ITimesheetEntityModel {
14
14
  updatedOn: number;
15
15
  status: TimesheetStatusEnum;
16
16
  billingId?: number;
17
- /**
18
- * @param timesheets - Array of TimesheetModel instances
19
- * @return - Array of Timesheet Model
20
- */
21
17
  static convertToModel(timesheetsEntity: ITimesheetEntity): ITimesheetEntityModel;
22
18
  /**
23
19
  * @param timesheets
24
20
  * @returns
25
21
  */
26
22
  static getTotalDuration(timesheets: ITimesheetEntityModel[]): number;
27
- static fromEntity(entity: ITimesheetEntity): TimesheetEntityModel;
23
+ static fromEntity(entity: ITimesheetEntity): TimesheetModel;
28
24
  }
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimesheetEntityModel = void 0;
3
+ exports.TimesheetModel = void 0;
4
4
  const entities_1 = require("../../entities");
5
- class TimesheetEntityModel {
5
+ class TimesheetModel {
6
6
  constructor() {
7
7
  this.id = 0;
8
8
  this.userId = 0;
@@ -18,10 +18,6 @@ class TimesheetEntityModel {
18
18
  this.status = entities_1.TimesheetStatusEnum.CREATE_APPROVAL;
19
19
  this.billingId = 0;
20
20
  }
21
- /**
22
- * @param timesheets - Array of TimesheetModel instances
23
- * @return - Array of Timesheet Model
24
- */
25
21
  static convertToModel(timesheetsEntity) {
26
22
  const timesheetModel = Object.assign({}, timesheetsEntity);
27
23
  return timesheetModel;
@@ -35,9 +31,9 @@ class TimesheetEntityModel {
35
31
  return totalDurationOfEachTimesheet.reduce((sum, duration) => sum + duration, 0);
36
32
  }
37
33
  static fromEntity(entity) {
38
- const result = new TimesheetEntityModel();
34
+ const result = new TimesheetModel();
39
35
  Object.assign(result, entity);
40
36
  return result;
41
37
  }
42
38
  }
43
- exports.TimesheetEntityModel = TimesheetEntityModel;
39
+ exports.TimesheetModel = TimesheetModel;
package/package.json CHANGED
@@ -1,40 +1,40 @@
1
- {
2
- "name": "law-common",
3
- "version": "10.57.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
- },
21
- "keywords": [],
22
- "author": "",
23
- "license": "ISC",
24
- "devDependencies": {
25
- "@types/jest": "^29.5.13",
26
- "@types/lodash": "^4.17.21",
27
- "@types/node": "^22.6.1",
28
- "jest": "^29.7.0",
29
- "prettier": "3.8.1",
30
- "ts-jest": "^29.2.5",
31
- "ts-node": "^10.9.2",
32
- "typescript": "^5.6.2"
33
- },
34
- "dependencies": {
35
- "@types/express": "^5.0.0",
36
- "@types/multer": "^1.4.12",
37
- "date-fns": "^4.1.0",
38
- "lodash": "4.17.21"
39
- }
40
- }
1
+ {
2
+ "name": "law-common",
3
+ "version": "10.57.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
+ },
21
+ "keywords": [],
22
+ "author": "",
23
+ "license": "ISC",
24
+ "devDependencies": {
25
+ "@types/jest": "^29.5.13",
26
+ "@types/lodash": "^4.17.21",
27
+ "@types/node": "^22.6.1",
28
+ "jest": "^29.7.0",
29
+ "prettier": "3.8.1",
30
+ "ts-jest": "^29.2.5",
31
+ "ts-node": "^10.9.2",
32
+ "typescript": "^5.6.2"
33
+ },
34
+ "dependencies": {
35
+ "@types/express": "^5.0.0",
36
+ "@types/multer": "^1.4.12",
37
+ "date-fns": "^4.1.0",
38
+ "lodash": "4.17.21"
39
+ }
40
+ }