law-common 2.5.1-beta.3 → 2.5.1-beta.6
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/dist/src/api/interface/timesheet.entity.response.interface.d.ts +5 -5
- package/dist/src/entities/enums/billing.action.enum.d.ts +15 -0
- package/dist/src/entities/enums/billing.action.enum.js +19 -0
- package/dist/src/entities/enums/billing.status.enum.d.ts +0 -15
- package/dist/src/entities/enums/billing.status.enum.js +1 -17
- package/dist/src/entities/enums/configuration.type.enum.d.ts +4 -0
- package/dist/src/entities/enums/configuration.type.enum.js +8 -0
- package/dist/src/entities/enums/timesheet.action.enum.d.ts +12 -0
- package/dist/src/entities/enums/timesheet.action.enum.js +43 -0
- package/dist/src/entities/enums/timesheet.status.enum.d.ts +0 -8
- package/dist/src/entities/enums/timesheet.status.enum.js +1 -10
- package/dist/src/entities/index.d.ts +3 -0
- package/dist/src/entities/index.js +3 -0
- package/dist/src/entities/interface/billing.entity.interface.d.ts +14 -0
- package/dist/src/entities/interface/configuration.entity.interface.d.ts +5 -1
- package/dist/src/entities/interface/timesheet.entity.interface.d.ts +2 -1
- package/dist/src/enums/error.key.enum.d.ts +2 -1
- package/dist/src/enums/error.key.enum.js +1 -0
- package/dist/src/utils/date.util.d.ts +1 -0
- package/dist/src/utils/date.util.js +7 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/models/date-code.model.util.d.ts +1 -0
- package/dist/src/utils/models/date-code.model.util.js +8 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IApiEntity, ITimesheetEntity, ITimesheetEntityUpdateDto, TimesheetActionEnum, TimesheetStatusEnum
|
|
1
|
+
import { IApiEntity, ITimesheetEntity, ITimesheetEntityUpdateDto, TimesheetActionEnum, TimesheetStatusEnum } from "../../entities";
|
|
2
2
|
import { IBaseResponse } from "./base.response.interface";
|
|
3
3
|
import { IClientApiEntityDependent } from "./client.entity.response";
|
|
4
4
|
import { IProjectApiEntityDependent } from "./project.entity.response";
|
|
@@ -21,13 +21,13 @@ export type ITimesheetEntityGet = {
|
|
|
21
21
|
tasks: string[];
|
|
22
22
|
};
|
|
23
23
|
export type ITimesheetFlowConfig = {
|
|
24
|
-
[key in TimesheetStatusEnum]?:
|
|
25
|
-
roles: UserRoleEnum[];
|
|
24
|
+
[key in TimesheetStatusEnum]?: {
|
|
26
25
|
actions: {
|
|
27
26
|
[key in TimesheetActionEnum]?: {
|
|
27
|
+
permissions: string[];
|
|
28
28
|
label: string;
|
|
29
|
-
next: (currentTimesheet?: ITimesheetEntity, dto?: ITimesheetEntityUpdateDto) => TimesheetStatusEnum;
|
|
29
|
+
next: (currentTimesheet?: ITimesheetEntity, buffer?: number, dto?: ITimesheetEntityUpdateDto) => TimesheetStatusEnum;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
}
|
|
32
|
+
};
|
|
33
33
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum BillingActionsEnum {
|
|
2
|
+
APPROVE = "approve",
|
|
3
|
+
REJECT = "reject",
|
|
4
|
+
EDIT = "edit",
|
|
5
|
+
REQUEST_FOR_CHANGES = "requestForChanges",
|
|
6
|
+
SENT_FOR_APPROVAL = "sentForApproval",
|
|
7
|
+
SEND_FOR_CLIENT_REVIEW = "sendForClientReview",
|
|
8
|
+
CLIENT_REVISION = "clientRevision",
|
|
9
|
+
SEND_INVOICE = "sendInvoice",
|
|
10
|
+
APPROVAL = "approval",
|
|
11
|
+
UPDATE_PAYMENT = "updatePayment",
|
|
12
|
+
CREDIT_NOTE = "creditNote",
|
|
13
|
+
WRITE_OFF = "writeOff",
|
|
14
|
+
TDS = "tds"
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillingActionsEnum = void 0;
|
|
4
|
+
var BillingActionsEnum;
|
|
5
|
+
(function (BillingActionsEnum) {
|
|
6
|
+
BillingActionsEnum["APPROVE"] = "approve";
|
|
7
|
+
BillingActionsEnum["REJECT"] = "reject";
|
|
8
|
+
BillingActionsEnum["EDIT"] = "edit";
|
|
9
|
+
BillingActionsEnum["REQUEST_FOR_CHANGES"] = "requestForChanges";
|
|
10
|
+
BillingActionsEnum["SENT_FOR_APPROVAL"] = "sentForApproval";
|
|
11
|
+
BillingActionsEnum["SEND_FOR_CLIENT_REVIEW"] = "sendForClientReview";
|
|
12
|
+
BillingActionsEnum["CLIENT_REVISION"] = "clientRevision";
|
|
13
|
+
BillingActionsEnum["SEND_INVOICE"] = "sendInvoice";
|
|
14
|
+
BillingActionsEnum["APPROVAL"] = "approval";
|
|
15
|
+
BillingActionsEnum["UPDATE_PAYMENT"] = "updatePayment";
|
|
16
|
+
BillingActionsEnum["CREDIT_NOTE"] = "creditNote";
|
|
17
|
+
BillingActionsEnum["WRITE_OFF"] = "writeOff";
|
|
18
|
+
BillingActionsEnum["TDS"] = "tds";
|
|
19
|
+
})(BillingActionsEnum || (exports.BillingActionsEnum = BillingActionsEnum = {}));
|
|
@@ -11,18 +11,3 @@ export declare enum BillingStatusEnum {
|
|
|
11
11
|
PENDING_PAYMENT = "PENDING_PAYMENT",
|
|
12
12
|
PAYMENT_DONE = "PAYMENT_DONE"
|
|
13
13
|
}
|
|
14
|
-
export declare enum BillingActionsEnum {
|
|
15
|
-
APPROVE = "approve",
|
|
16
|
-
REJECT = "reject",
|
|
17
|
-
EDIT = "edit",
|
|
18
|
-
REQUEST_FOR_CHANGES = "requestForChanges",
|
|
19
|
-
SENT_FOR_APPROVAL = "sentForApproval",
|
|
20
|
-
SEND_FOR_CLIENT_REVIEW = "sendForClientReview",
|
|
21
|
-
CLIENT_REVISION = "clientRevision",
|
|
22
|
-
SEND_INVOICE = "sendInvoice",
|
|
23
|
-
APPROVAL = "approval",
|
|
24
|
-
UPDATE_PAYMENT = "updatePayment",
|
|
25
|
-
CREDIT_NOTE = "creditNote",
|
|
26
|
-
WRITE_OFF = "writeOff",
|
|
27
|
-
TDS = "tds"
|
|
28
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BillingStatusEnum = void 0;
|
|
4
4
|
var BillingStatusEnum;
|
|
5
5
|
(function (BillingStatusEnum) {
|
|
6
6
|
BillingStatusEnum["PENDING_APPROVAL"] = "PENDING_APPROVAL";
|
|
@@ -15,19 +15,3 @@ var BillingStatusEnum;
|
|
|
15
15
|
BillingStatusEnum["PENDING_PAYMENT"] = "PENDING_PAYMENT";
|
|
16
16
|
BillingStatusEnum["PAYMENT_DONE"] = "PAYMENT_DONE";
|
|
17
17
|
})(BillingStatusEnum || (exports.BillingStatusEnum = BillingStatusEnum = {}));
|
|
18
|
-
var BillingActionsEnum;
|
|
19
|
-
(function (BillingActionsEnum) {
|
|
20
|
-
BillingActionsEnum["APPROVE"] = "approve";
|
|
21
|
-
BillingActionsEnum["REJECT"] = "reject";
|
|
22
|
-
BillingActionsEnum["EDIT"] = "edit";
|
|
23
|
-
BillingActionsEnum["REQUEST_FOR_CHANGES"] = "requestForChanges";
|
|
24
|
-
BillingActionsEnum["SENT_FOR_APPROVAL"] = "sentForApproval";
|
|
25
|
-
BillingActionsEnum["SEND_FOR_CLIENT_REVIEW"] = "sendForClientReview";
|
|
26
|
-
BillingActionsEnum["CLIENT_REVISION"] = "clientRevision";
|
|
27
|
-
BillingActionsEnum["SEND_INVOICE"] = "sendInvoice";
|
|
28
|
-
BillingActionsEnum["APPROVAL"] = "approval";
|
|
29
|
-
BillingActionsEnum["UPDATE_PAYMENT"] = "updatePayment";
|
|
30
|
-
BillingActionsEnum["CREDIT_NOTE"] = "creditNote";
|
|
31
|
-
BillingActionsEnum["WRITE_OFF"] = "writeOff";
|
|
32
|
-
BillingActionsEnum["TDS"] = "tds";
|
|
33
|
-
})(BillingActionsEnum || (exports.BillingActionsEnum = BillingActionsEnum = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationTypeEnum = void 0;
|
|
4
|
+
var ConfigurationTypeEnum;
|
|
5
|
+
(function (ConfigurationTypeEnum) {
|
|
6
|
+
ConfigurationTypeEnum["INTEGER"] = "integer";
|
|
7
|
+
ConfigurationTypeEnum["STRING"] = "string";
|
|
8
|
+
})(ConfigurationTypeEnum || (exports.ConfigurationTypeEnum = ConfigurationTypeEnum = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum TimesheetActionEnum {
|
|
2
|
+
VIEW = "view",
|
|
3
|
+
EDIT = "edit",
|
|
4
|
+
DELETE = "delete",
|
|
5
|
+
CREATE = "create",
|
|
6
|
+
APPROVE = "approve",
|
|
7
|
+
REJECT = "reject",
|
|
8
|
+
RECALL = "recall"
|
|
9
|
+
}
|
|
10
|
+
export declare namespace TimesheetActionEnum {
|
|
11
|
+
function getLabel(action: TimesheetActionEnum): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimesheetActionEnum = void 0;
|
|
4
|
+
const error_key_enum_1 = require("../../enums/error.key.enum");
|
|
5
|
+
const exceptions_1 = require("../../exceptions");
|
|
6
|
+
var TimesheetActionEnum;
|
|
7
|
+
(function (TimesheetActionEnum) {
|
|
8
|
+
TimesheetActionEnum["VIEW"] = "view";
|
|
9
|
+
TimesheetActionEnum["EDIT"] = "edit";
|
|
10
|
+
TimesheetActionEnum["DELETE"] = "delete";
|
|
11
|
+
TimesheetActionEnum["CREATE"] = "create";
|
|
12
|
+
TimesheetActionEnum["APPROVE"] = "approve";
|
|
13
|
+
TimesheetActionEnum["REJECT"] = "reject";
|
|
14
|
+
TimesheetActionEnum["RECALL"] = "recall";
|
|
15
|
+
})(TimesheetActionEnum || (exports.TimesheetActionEnum = TimesheetActionEnum = {}));
|
|
16
|
+
(function (TimesheetActionEnum) {
|
|
17
|
+
const actionLabelMap = {
|
|
18
|
+
[TimesheetActionEnum.APPROVE]: "Approve",
|
|
19
|
+
[TimesheetActionEnum.VIEW]: "View",
|
|
20
|
+
[TimesheetActionEnum.EDIT]: "Edit",
|
|
21
|
+
[TimesheetActionEnum.DELETE]: "Delete",
|
|
22
|
+
[TimesheetActionEnum.CREATE]: "Create",
|
|
23
|
+
[TimesheetActionEnum.REJECT]: "Reject",
|
|
24
|
+
[TimesheetActionEnum.RECALL]: "Recall",
|
|
25
|
+
};
|
|
26
|
+
function getLabel(action) {
|
|
27
|
+
if (!Object.values(TimesheetActionEnum).includes(action)) {
|
|
28
|
+
throw new exceptions_1.AppBadRequestException({
|
|
29
|
+
key: error_key_enum_1.ErrorKeyEnum.TIMESHEET_FLOW_ACTION,
|
|
30
|
+
message: ["Invalid action value"],
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const label = actionLabelMap[action];
|
|
34
|
+
if (!label) {
|
|
35
|
+
throw new exceptions_1.AppBadRequestException({
|
|
36
|
+
key: error_key_enum_1.ErrorKeyEnum.TIMESHEET_FLOW_ACTION,
|
|
37
|
+
message: ["Invalid action value"],
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return label;
|
|
41
|
+
}
|
|
42
|
+
TimesheetActionEnum.getLabel = getLabel;
|
|
43
|
+
})(TimesheetActionEnum || (exports.TimesheetActionEnum = TimesheetActionEnum = {}));
|
|
@@ -8,14 +8,6 @@ export declare enum TimesheetStatusEnum {
|
|
|
8
8
|
APPROVED = "approved",
|
|
9
9
|
DELETED = "deleted"
|
|
10
10
|
}
|
|
11
|
-
export declare enum TimesheetActionEnum {
|
|
12
|
-
VIEW = "view",
|
|
13
|
-
EDIT = "edit",
|
|
14
|
-
DELETE = "delete",
|
|
15
|
-
CREATE = "create",
|
|
16
|
-
APPROVE = "approve",
|
|
17
|
-
REJECT = "reject"
|
|
18
|
-
}
|
|
19
11
|
export declare namespace TimesheetStatusEnum {
|
|
20
12
|
function getNames(): string[];
|
|
21
13
|
function parse(value: string): TimesheetStatusEnum;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TimesheetStatusEnum = void 0;
|
|
4
4
|
var TimesheetStatusEnum;
|
|
5
5
|
(function (TimesheetStatusEnum) {
|
|
6
6
|
TimesheetStatusEnum["ONTIME"] = "ontime";
|
|
@@ -12,15 +12,6 @@ var TimesheetStatusEnum;
|
|
|
12
12
|
TimesheetStatusEnum["APPROVED"] = "approved";
|
|
13
13
|
TimesheetStatusEnum["DELETED"] = "deleted";
|
|
14
14
|
})(TimesheetStatusEnum || (exports.TimesheetStatusEnum = TimesheetStatusEnum = {}));
|
|
15
|
-
var TimesheetActionEnum;
|
|
16
|
-
(function (TimesheetActionEnum) {
|
|
17
|
-
TimesheetActionEnum["VIEW"] = "view";
|
|
18
|
-
TimesheetActionEnum["EDIT"] = "edit";
|
|
19
|
-
TimesheetActionEnum["DELETE"] = "delete";
|
|
20
|
-
TimesheetActionEnum["CREATE"] = "create";
|
|
21
|
-
TimesheetActionEnum["APPROVE"] = "approve";
|
|
22
|
-
TimesheetActionEnum["REJECT"] = "reject";
|
|
23
|
-
})(TimesheetActionEnum || (exports.TimesheetActionEnum = TimesheetActionEnum = {}));
|
|
24
15
|
(function (TimesheetStatusEnum) {
|
|
25
16
|
function getNames() {
|
|
26
17
|
return Object.values(TimesheetStatusEnum).filter((value) => typeof value === "string");
|
|
@@ -40,3 +40,6 @@ export * from "./interface/billing_history.entity.interface";
|
|
|
40
40
|
export * from "./interface/billing_timesheet_history.entity.interface";
|
|
41
41
|
export * from "./enums/history_operation.enum";
|
|
42
42
|
export * from "./enums/timesheet.status.enum";
|
|
43
|
+
export * from "./enums/timesheet.action.enum";
|
|
44
|
+
export * from "./enums/billing.action.enum";
|
|
45
|
+
export * from "./enums/configuration.type.enum";
|
|
@@ -56,3 +56,6 @@ __exportStar(require("./interface/billing_history.entity.interface"), exports);
|
|
|
56
56
|
__exportStar(require("./interface/billing_timesheet_history.entity.interface"), exports);
|
|
57
57
|
__exportStar(require("./enums/history_operation.enum"), exports);
|
|
58
58
|
__exportStar(require("./enums/timesheet.status.enum"), exports);
|
|
59
|
+
__exportStar(require("./enums/timesheet.action.enum"), exports);
|
|
60
|
+
__exportStar(require("./enums/billing.action.enum"), exports);
|
|
61
|
+
__exportStar(require("./enums/configuration.type.enum"), exports);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { IUpdateBillingDto } from "../../api";
|
|
2
|
+
import { BillingActionsEnum } from "../enums/billing.action.enum";
|
|
1
3
|
import { BillingImpactEnum } from "../enums/billing.impact.enum";
|
|
2
4
|
import { BillingStatusEnum } from "../enums/billing.status.enum";
|
|
3
5
|
import { BillingTimesheetStatusEnum } from "../enums/billing.timesheet.change.status.enum";
|
|
4
6
|
import { PaymentStatusEnum } from "../enums/payment_status.enum";
|
|
7
|
+
import { UserRoleEnum } from "../enums/user.entity.enum";
|
|
5
8
|
import { IAuditColumnEntity } from "./audit-column.entity.interface";
|
|
6
9
|
import { IEntityCreateDto, IEntityFilterData } from "./entity.utils.interface";
|
|
7
10
|
export interface IBillingEntity extends IAuditColumnEntity {
|
|
@@ -56,3 +59,14 @@ export interface IBillingEntityFilterDto extends IEntityFilterData<IBillingEntit
|
|
|
56
59
|
}
|
|
57
60
|
export interface IBillingTimesheetEntityFilterDto extends IEntityFilterData<IBillingTimesheetEntity> {
|
|
58
61
|
}
|
|
62
|
+
export type IBillingFlowConfig = {
|
|
63
|
+
[key in BillingStatusEnum]?: Array<{
|
|
64
|
+
roles: UserRoleEnum[];
|
|
65
|
+
actions: {
|
|
66
|
+
[key in BillingActionsEnum]?: {
|
|
67
|
+
label: string;
|
|
68
|
+
next: (currentBilling?: IBillingEntity, dto?: IUpdateBillingDto) => BillingStatusEnum;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { ConfigurationTypeEnum } from "../enums/configuration.type.enum";
|
|
1
2
|
import { IAuditColumnEntity } from "./audit-column.entity.interface";
|
|
2
3
|
import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
|
|
3
4
|
export interface IConfigurationEntity extends IAuditColumnEntity {
|
|
4
5
|
id: number;
|
|
5
6
|
key: string;
|
|
6
7
|
value: string;
|
|
8
|
+
organizationId: number;
|
|
9
|
+
label: string;
|
|
10
|
+
type: ConfigurationTypeEnum;
|
|
7
11
|
description?: string;
|
|
8
12
|
}
|
|
9
13
|
export interface IConfigurationEntityCreateDto extends IEntityCreateDto<IConfigurationEntity> {
|
|
10
14
|
}
|
|
11
|
-
export interface IConfigurationEntityUpdateDto extends IEntityUpdateDto<IConfigurationEntity> {
|
|
15
|
+
export interface IConfigurationEntityUpdateDto extends Omit<IEntityUpdateDto<IConfigurationEntity>, "key"> {
|
|
12
16
|
}
|
|
13
17
|
export type IConfigurationEntityFilterData = IEntityFilterData<IConfigurationEntity>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { TimesheetActionEnum
|
|
1
|
+
import { TimesheetActionEnum } from "../enums/timesheet.action.enum";
|
|
2
|
+
import { TimesheetStatusEnum } from "../enums/timesheet.status.enum";
|
|
2
3
|
import { IAuditColumnEntity } from "./audit-column.entity.interface";
|
|
3
4
|
import { IEntityCreateDto, IEntityFilterData, IEntityUpdateDto } from "./entity.utils.interface";
|
|
4
5
|
export interface ITimesheetEntity extends IAuditColumnEntity {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function compareDates(recordDate: string, buffer: number): boolean;
|
|
@@ -1 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compareDates = compareDates;
|
|
4
|
+
const date_code_model_util_1 = require("./models/date-code.model.util");
|
|
5
|
+
function compareDates(recordDate, buffer) {
|
|
6
|
+
const recordDateObj = new date_code_model_util_1.DateCodeModel(recordDate);
|
|
7
|
+
return recordDateObj.isWithinOffset(buffer);
|
|
8
|
+
}
|
package/dist/src/utils/index.js
CHANGED
|
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
17
|
+
__exportStar(require("./date.util"), exports);
|
|
18
18
|
__exportStar(require("./helper.fn.util"), exports);
|
|
19
19
|
__exportStar(require("./models/date-code.model.util"), exports);
|
|
@@ -29,9 +29,16 @@ class DateCodeModel {
|
|
|
29
29
|
let dateCodes = [];
|
|
30
30
|
for (let date = start; date <= end; date.setDate(date.getDate() + 1)) {
|
|
31
31
|
// console.log(date);
|
|
32
|
-
dateCodes.push(new DateCodeModel(`${date.getFullYear()}${(date.getMonth() + 1)
|
|
32
|
+
dateCodes.push(new DateCodeModel(`${date.getFullYear()}${(date.getMonth() + 1)
|
|
33
|
+
.toString()
|
|
34
|
+
.padStart(2, "0")}${date.getDate().toString().padStart(2, "0")}`));
|
|
33
35
|
}
|
|
34
36
|
return dateCodes;
|
|
35
37
|
}
|
|
38
|
+
isWithinOffset(offsetInDays) {
|
|
39
|
+
const currentDate = new Date();
|
|
40
|
+
const diffInDays = Math.abs((currentDate.getTime() - this.getDate().getTime()) / (1000 * 3600 * 24));
|
|
41
|
+
return diffInDays <= offsetInDays;
|
|
42
|
+
}
|
|
36
43
|
}
|
|
37
44
|
exports.DateCodeModel = DateCodeModel;
|