law-common 11.3.3-beta.1 → 11.3.3-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.
- package/README.md +1 -1
- package/dist/src/entities/enums/billing.timesheet.change.status.enum.d.ts +1 -2
- package/dist/src/entities/enums/billing.timesheet.change.status.enum.js +0 -1
- package/dist/src/entities/enums/timesheet.classification.status.enum.d.ts +10 -0
- package/dist/src/entities/enums/timesheet.classification.status.enum.js +28 -0
- package/dist/src/entities/index.d.ts +1 -0
- package/dist/src/entities/index.js +1 -0
- package/dist/src/entities/interface/timesheet.entity.interface.d.ts +7 -1
- package/dist/src/entities/model/timesheet.entity.model.d.ts +8 -1
- package/dist/src/entities/model/timesheet.entity.model.js +12 -0
- package/dist/src/model/entities/timesheet.model.d.ts +5 -1
- package/dist/src/model/entities/timesheet.model.js +1 -0
- package/dist/src/utils/models/date-code.model.util.d.ts +4 -0
- package/dist/src/utils/models/date-code.model.util.js +13 -0
- package/package.json +47 -47
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# law-common
|
|
1
|
+
# law-common
|
|
@@ -6,5 +6,4 @@ var BillingTimesheetStatusEnum;
|
|
|
6
6
|
BillingTimesheetStatusEnum["UNCHANGED"] = "unchanged";
|
|
7
7
|
BillingTimesheetStatusEnum["UPDATED"] = "updated";
|
|
8
8
|
BillingTimesheetStatusEnum["DELETED"] = "deleted";
|
|
9
|
-
BillingTimesheetStatusEnum["NEW"] = "new";
|
|
10
9
|
})(BillingTimesheetStatusEnum || (exports.BillingTimesheetStatusEnum = BillingTimesheetStatusEnum = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare enum TimesheetClassificationStatusEnum {
|
|
2
|
+
PENDING = "pending",
|
|
3
|
+
CLASSIFIED = "classified",
|
|
4
|
+
AUTO_CLASSIFIED = "auto_classified",
|
|
5
|
+
CORRECTED = "corrected"
|
|
6
|
+
}
|
|
7
|
+
export declare namespace TimesheetClassificationStatusEnum {
|
|
8
|
+
function getNames(): string[];
|
|
9
|
+
function parse(value: string): TimesheetClassificationStatusEnum;
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimesheetClassificationStatusEnum = void 0;
|
|
4
|
+
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
5
|
+
const exceptions_1 = require("../../exceptions");
|
|
6
|
+
var TimesheetClassificationStatusEnum;
|
|
7
|
+
(function (TimesheetClassificationStatusEnum) {
|
|
8
|
+
TimesheetClassificationStatusEnum["PENDING"] = "pending";
|
|
9
|
+
TimesheetClassificationStatusEnum["CLASSIFIED"] = "classified";
|
|
10
|
+
TimesheetClassificationStatusEnum["AUTO_CLASSIFIED"] = "auto_classified";
|
|
11
|
+
TimesheetClassificationStatusEnum["CORRECTED"] = "corrected";
|
|
12
|
+
})(TimesheetClassificationStatusEnum || (exports.TimesheetClassificationStatusEnum = TimesheetClassificationStatusEnum = {}));
|
|
13
|
+
(function (TimesheetClassificationStatusEnum) {
|
|
14
|
+
function getNames() {
|
|
15
|
+
return Object.values(TimesheetClassificationStatusEnum).filter((value) => typeof value === "string");
|
|
16
|
+
}
|
|
17
|
+
TimesheetClassificationStatusEnum.getNames = getNames;
|
|
18
|
+
function parse(value) {
|
|
19
|
+
if (Object.values(TimesheetClassificationStatusEnum).includes(value)) {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
throw new exceptions_1.AppBadRequestException({
|
|
23
|
+
key: error_key_enum_1.ErrorKeyEnum.TIMESHEET_STATUS,
|
|
24
|
+
message: ["Invalid timesheet classification status"],
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
TimesheetClassificationStatusEnum.parse = parse;
|
|
28
|
+
})(TimesheetClassificationStatusEnum || (exports.TimesheetClassificationStatusEnum = TimesheetClassificationStatusEnum = {}));
|
|
@@ -39,6 +39,7 @@ export * from "./interface/billing_timesheet_history.entity.interface";
|
|
|
39
39
|
export * from "./enums/history_operation.enum";
|
|
40
40
|
export * from "./enums/timesheet.action.enum";
|
|
41
41
|
export * from "./enums/timesheet.status.enum";
|
|
42
|
+
export * from "./enums/timesheet.classification.status.enum";
|
|
42
43
|
export * from "./enums/billing.action.enum";
|
|
43
44
|
export * from "./enums/configuration.type.enum";
|
|
44
45
|
export * from "./enums/project_user_status.enum";
|
|
@@ -55,6 +55,7 @@ __exportStar(require("./interface/billing_timesheet_history.entity.interface"),
|
|
|
55
55
|
__exportStar(require("./enums/history_operation.enum"), exports);
|
|
56
56
|
__exportStar(require("./enums/timesheet.action.enum"), exports);
|
|
57
57
|
__exportStar(require("./enums/timesheet.status.enum"), exports);
|
|
58
|
+
__exportStar(require("./enums/timesheet.classification.status.enum"), exports);
|
|
58
59
|
__exportStar(require("./enums/billing.action.enum"), exports);
|
|
59
60
|
__exportStar(require("./enums/configuration.type.enum"), exports);
|
|
60
61
|
__exportStar(require("./enums/project_user_status.enum"), exports);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TimesheetActionEnum } from "../enums/timesheet.action.enum";
|
|
2
|
+
import { TimesheetClassificationStatusEnum } from "../enums/timesheet.classification.status.enum";
|
|
2
3
|
import { TimesheetStatusEnum } from "../enums/timesheet.status.enum";
|
|
3
4
|
import { ProjectUserMappingEntityModel } from "../model/project-user-mapping.entity.model";
|
|
4
5
|
import { TimesheetEntityModel } from "../model/timesheet.entity.model";
|
|
@@ -16,10 +17,15 @@ export interface ITimesheetEntity extends IEntityAuditColumn {
|
|
|
16
17
|
status: TimesheetStatusEnum;
|
|
17
18
|
remark?: string;
|
|
18
19
|
billingId?: number;
|
|
20
|
+
billedDuration?: number;
|
|
21
|
+
notBilledDuration?: number;
|
|
22
|
+
classificationStatus: TimesheetClassificationStatusEnum;
|
|
23
|
+
classifiedBy?: number;
|
|
19
24
|
}
|
|
20
|
-
export type ITimesheetEntityExclude = "status";
|
|
25
|
+
export type ITimesheetEntityExclude = "status" | "billedDuration" | "notBilledDuration" | "classificationStatus" | "classifiedBy";
|
|
21
26
|
export interface ITimesheetEntityCreateDto extends Omit<IEntityCreateDto<ITimesheetEntity>, ITimesheetEntityExclude> {
|
|
22
27
|
status?: TimesheetStatusEnum;
|
|
28
|
+
classificationStatus?: TimesheetClassificationStatusEnum;
|
|
23
29
|
}
|
|
24
30
|
export interface ITimesheetEntityCreateDtoValidationData {
|
|
25
31
|
projectUserMappingEntities: ProjectUserMappingEntityModel[];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CurrencyEnum } from "../../enums";
|
|
2
|
+
import { TimesheetClassificationStatusEnum } from "../enums/timesheet.classification.status.enum";
|
|
2
3
|
import { TimesheetStatusEnum } from "../enums/timesheet.status.enum";
|
|
3
4
|
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
4
5
|
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
5
6
|
import { ITimesheetEntity } from "../interface/timesheet.entity.interface";
|
|
6
7
|
import { BaseEntityModel } from "./base.entity.model";
|
|
8
|
+
import { ProjectEntityModel } from "./project.entity.model";
|
|
7
9
|
import { TimesheetHistoryEntityModel } from "./timesheet_history.entity.model";
|
|
8
10
|
import { UserEntityModel } from "./user.entity.model";
|
|
9
11
|
export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIMESHEET> implements ITimesheetEntity {
|
|
@@ -17,15 +19,20 @@ export declare class TimesheetEntityModel extends BaseEntityModel<EntityEnum.TIM
|
|
|
17
19
|
status: TimesheetStatusEnum;
|
|
18
20
|
remark?: string;
|
|
19
21
|
billingId?: number;
|
|
22
|
+
billedDuration?: number;
|
|
23
|
+
notBilledDuration?: number;
|
|
24
|
+
classificationStatus: TimesheetClassificationStatusEnum;
|
|
25
|
+
classifiedBy?: number;
|
|
20
26
|
createdBy: number;
|
|
21
27
|
updatedBy: number;
|
|
22
28
|
createdOn: number;
|
|
23
29
|
updatedOn: number;
|
|
24
30
|
user?: UserEntityModel;
|
|
25
31
|
history?: TimesheetHistoryEntityModel[];
|
|
32
|
+
project?: ProjectEntityModel;
|
|
26
33
|
static fromEntity(entity: ITimesheetEntity): TimesheetEntityModel;
|
|
27
34
|
getRelationConfigs(): any[];
|
|
28
|
-
static relationConfigs: RelationConfigs<[EntityEnum.USER, EntityEnum.TIMESHEET_HISTORY], EntityEnum.TIMESHEET>;
|
|
35
|
+
static relationConfigs: RelationConfigs<[EntityEnum.USER, EntityEnum.TIMESHEET_HISTORY, EntityEnum.PROJECT], EntityEnum.TIMESHEET>;
|
|
29
36
|
getTimesheetAmount(projectCurrency: CurrencyEnum): number;
|
|
30
37
|
get formattedDate(): string;
|
|
31
38
|
get userName(): string | undefined;
|
|
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TimesheetEntityModel = void 0;
|
|
4
4
|
const utils_1 = require("../../utils");
|
|
5
5
|
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
6
|
+
const timesheet_classification_status_enum_1 = require("../enums/timesheet.classification.status.enum");
|
|
6
7
|
const timesheet_status_enum_1 = require("../enums/timesheet.status.enum");
|
|
7
8
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
8
9
|
const base_entity_model_1 = require("./base.entity.model");
|
|
10
|
+
// Use this mdoel for UI & BACKEND
|
|
9
11
|
class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
10
12
|
constructor() {
|
|
11
13
|
super(...arguments);
|
|
@@ -16,6 +18,7 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
|
16
18
|
this.dateCode = "";
|
|
17
19
|
this.totalDuration = 0;
|
|
18
20
|
this.status = timesheet_status_enum_1.TimesheetStatusEnum.CREATE_APPROVAL;
|
|
21
|
+
this.classificationStatus = timesheet_classification_status_enum_1.TimesheetClassificationStatusEnum.PENDING;
|
|
19
22
|
this.createdBy = 0;
|
|
20
23
|
this.updatedBy = 0;
|
|
21
24
|
this.createdOn = 0;
|
|
@@ -74,4 +77,13 @@ TimesheetEntityModel.relationConfigs = [
|
|
|
74
77
|
key: "id",
|
|
75
78
|
},
|
|
76
79
|
},
|
|
80
|
+
{
|
|
81
|
+
name: entity_utils_interface_1.EntityEnum.PROJECT,
|
|
82
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
83
|
+
key: "project",
|
|
84
|
+
mapKeyConfig: {
|
|
85
|
+
relationKey: "id",
|
|
86
|
+
key: "projectId",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
77
89
|
];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ITimesheetEntity, TimesheetStatusEnum } from "../../entities";
|
|
1
|
+
import { ITimesheetEntity, TimesheetClassificationStatusEnum, TimesheetStatusEnum } from "../../entities";
|
|
2
2
|
import { ITimesheetEntityModel } from "./interface/timesheet.model.interface";
|
|
3
3
|
export declare class TimesheetEntityModel implements ITimesheetEntityModel {
|
|
4
4
|
id: number;
|
|
@@ -14,6 +14,10 @@ export declare class TimesheetEntityModel implements ITimesheetEntityModel {
|
|
|
14
14
|
updatedOn: number;
|
|
15
15
|
status: TimesheetStatusEnum;
|
|
16
16
|
billingId?: number;
|
|
17
|
+
billedDuration?: number;
|
|
18
|
+
notBilledDuration?: number;
|
|
19
|
+
classificationStatus: TimesheetClassificationStatusEnum;
|
|
20
|
+
classifiedBy?: number;
|
|
17
21
|
/**
|
|
18
22
|
* @param timesheets - Array of TimesheetModel instances
|
|
19
23
|
* @return - Array of Timesheet Model
|
|
@@ -17,6 +17,7 @@ class TimesheetEntityModel {
|
|
|
17
17
|
this.updatedOn = 0;
|
|
18
18
|
this.status = entities_1.TimesheetStatusEnum.CREATE_APPROVAL;
|
|
19
19
|
this.billingId = 0;
|
|
20
|
+
this.classificationStatus = entities_1.TimesheetClassificationStatusEnum.PENDING;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* @param timesheets - Array of TimesheetModel instances
|
|
@@ -67,6 +67,10 @@ export declare class DateCodeModel {
|
|
|
67
67
|
currFY: string;
|
|
68
68
|
};
|
|
69
69
|
static getCurrentTimestampCode(): string;
|
|
70
|
+
static getTodayISTEpochRange(): {
|
|
71
|
+
epochStartTime: number;
|
|
72
|
+
epochEndTime: number;
|
|
73
|
+
};
|
|
70
74
|
/**
|
|
71
75
|
* Creates a DateCodeModel instance directly from a JavaScript Date object.
|
|
72
76
|
* Internally formats the date to "yyyyMMdd" and constructs the model.
|
|
@@ -331,6 +331,19 @@ class DateCodeModel {
|
|
|
331
331
|
const minutes = String(nowIST.getUTCMinutes()).padStart(2, "0");
|
|
332
332
|
return `${year}${month}${day} ${hours}${minutes}`;
|
|
333
333
|
}
|
|
334
|
+
static getTodayISTEpochRange() {
|
|
335
|
+
const istOffsetMs = 5.5 * 60 * 60 * 1000;
|
|
336
|
+
const nowUTC = new Date();
|
|
337
|
+
const nowIST = new Date(nowUTC.getTime() + istOffsetMs);
|
|
338
|
+
const year = nowIST.getUTCFullYear();
|
|
339
|
+
const month = nowIST.getUTCMonth();
|
|
340
|
+
const date = nowIST.getUTCDate();
|
|
341
|
+
const startOfTodayUTC = new Date(Date.UTC(year, month, date, 0, 0, 0, 0));
|
|
342
|
+
const epochStartTime = Math.floor((startOfTodayUTC.getTime() - istOffsetMs) / 1000);
|
|
343
|
+
const endOfTodayUTC = new Date(Date.UTC(year, month, date, 23, 59, 59, 999));
|
|
344
|
+
const epochEndTime = Math.floor((endOfTodayUTC.getTime() - istOffsetMs) / 1000);
|
|
345
|
+
return { epochStartTime, epochEndTime };
|
|
346
|
+
}
|
|
334
347
|
/**
|
|
335
348
|
* Creates a DateCodeModel instance directly from a JavaScript Date object.
|
|
336
349
|
* Internally formats the date to "yyyyMMdd" and constructs the model.
|
package/package.json
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "law-common",
|
|
3
|
-
"version": "11.3.3-beta.
|
|
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 run build && npm version prerelease --preid beta && git push && npm publish --tag beta",
|
|
13
|
-
"publish:beta:link": "npm run build && npm version prerelease --preid beta && git push && npm publish --tag beta && npm run link",
|
|
14
|
-
"publish:patch": "npm version patch && git push && npm run build && npm publish",
|
|
15
|
-
"publish:minor": "npm version minor && git push && npm run build && npm publish",
|
|
16
|
-
"publish:major": "npm verYsion major && git push && npm run build && npm publish",
|
|
17
|
-
"link": "npm run build && npm link",
|
|
18
|
-
"test": "jest",
|
|
19
|
-
"format": "prettier --write .",
|
|
20
|
-
"check-format": "prettier --check .",
|
|
21
|
-
"pull:link": "git pull && npm run link",
|
|
22
|
-
"check-version": "npm view law-common versions --json | jq -r '.[-1]'",
|
|
23
|
-
"script:publish": "node scripts/publish.js",
|
|
24
|
-
"script:publish:latest:beta": "npm run build && node scripts/publish.js prerelease beta && git push",
|
|
25
|
-
"script:publish:latest:patch": "npm run build && node scripts/publish.js patch && git push"
|
|
26
|
-
},
|
|
27
|
-
"keywords": [],
|
|
28
|
-
"author": "",
|
|
29
|
-
"license": "ISC",
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/jest": "^29.5.13",
|
|
32
|
-
"@types/lodash": "^4.17.21",
|
|
33
|
-
"@types/node": "^22.6.1",
|
|
34
|
-
"jest": "^29.7.0",
|
|
35
|
-
"prettier": "3.8.1",
|
|
36
|
-
"semver": "^7.8.1",
|
|
37
|
-
"ts-jest": "^29.2.5",
|
|
38
|
-
"ts-node": "^10.9.2",
|
|
39
|
-
"typescript": "^5.6.2"
|
|
40
|
-
},
|
|
41
|
-
"dependencies": {
|
|
42
|
-
"@types/express": "^5.0.0",
|
|
43
|
-
"@types/multer": "^1.4.12",
|
|
44
|
-
"date-fns": "^4.1.0",
|
|
45
|
-
"lodash": "4.17.21"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "law-common",
|
|
3
|
+
"version": "11.3.3-beta.3",
|
|
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 run build && npm version prerelease --preid beta && git push && npm publish --tag beta",
|
|
13
|
+
"publish:beta:link": "npm run build && npm version prerelease --preid beta && git push && npm publish --tag beta && npm run link",
|
|
14
|
+
"publish:patch": "npm version patch && git push && npm run build && npm publish",
|
|
15
|
+
"publish:minor": "npm version minor && git push && npm run build && npm publish",
|
|
16
|
+
"publish:major": "npm verYsion major && git push && npm run build && npm publish",
|
|
17
|
+
"link": "npm run build && npm link",
|
|
18
|
+
"test": "jest",
|
|
19
|
+
"format": "prettier --write .",
|
|
20
|
+
"check-format": "prettier --check .",
|
|
21
|
+
"pull:link": "git pull && npm run link",
|
|
22
|
+
"check-version": "npm view law-common versions --json | jq -r '.[-1]'",
|
|
23
|
+
"script:publish": "node scripts/publish.js",
|
|
24
|
+
"script:publish:latest:beta": "npm run build && node scripts/publish.js prerelease beta && git push",
|
|
25
|
+
"script:publish:latest:patch": "npm run build && node scripts/publish.js patch && git push"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [],
|
|
28
|
+
"author": "",
|
|
29
|
+
"license": "ISC",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/jest": "^29.5.13",
|
|
32
|
+
"@types/lodash": "^4.17.21",
|
|
33
|
+
"@types/node": "^22.6.1",
|
|
34
|
+
"jest": "^29.7.0",
|
|
35
|
+
"prettier": "3.8.1",
|
|
36
|
+
"semver": "^7.8.1",
|
|
37
|
+
"ts-jest": "^29.2.5",
|
|
38
|
+
"ts-node": "^10.9.2",
|
|
39
|
+
"typescript": "^5.6.2"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@types/express": "^5.0.0",
|
|
43
|
+
"@types/multer": "^1.4.12",
|
|
44
|
+
"date-fns": "^4.1.0",
|
|
45
|
+
"lodash": "4.17.21"
|
|
46
|
+
}
|
|
47
|
+
}
|