law-common 1.2.58-beta.12 → 1.2.58-beta.14
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/index.d.ts +5 -0
- package/dist/src/api/index.js +5 -0
- package/dist/src/api/interface/billing.create.dto.interface.d.ts +1 -0
- package/dist/src/api/interface/billing.flow.update.dto.d.ts +3 -0
- package/dist/src/api/interface/billing.flow.update.dto.js +2 -0
- package/dist/src/api/interface/billing.transaction.create.dto.interface.d.ts +3 -0
- package/dist/src/api/interface/billing.transaction.create.dto.interface.js +2 -0
- package/dist/src/api/interface/billing.transaction.entity.response.d.ts +3 -0
- package/dist/src/api/interface/billing.transaction.entity.response.js +2 -0
- package/dist/src/api/interface/billing.transaction.update.dto.interface.d.ts +3 -0
- package/dist/src/api/interface/billing.transaction.update.dto.interface.js +2 -0
- package/dist/src/api/interface/billing.update.dto.interface.d.ts +2 -11
- package/dist/src/api/interface/role.permission.mapping.delete.dto.interface.d.ts +3 -0
- package/dist/src/api/interface/role.permission.mapping.delete.dto.interface.js +2 -0
- package/dist/src/entities/enums/billing.status.enum.d.ts +15 -0
- package/dist/src/entities/enums/billing.status.enum.js +17 -1
- package/dist/src/entities/enums/billing.transaction.enum.d.ts +6 -0
- package/dist/src/entities/enums/billing.transaction.enum.js +10 -0
- package/dist/src/entities/index.d.ts +2 -0
- package/dist/src/entities/index.js +2 -0
- package/dist/src/entities/interface/billing_transaction.entity.interface.d.ts +11 -0
- package/dist/src/entities/interface/billing_transaction.entity.interface.js +2 -0
- package/dist/src/entities/interface/user.entity.interface.d.ts +1 -0
- package/dist/src/utils/helper.fn.util.d.ts +28 -0
- package/dist/src/utils/helper.fn.util.js +80 -0
- package/package.json +1 -1
package/dist/src/api/index.d.ts
CHANGED
|
@@ -53,3 +53,8 @@ export * from "./interface/role.permission.mapping.create.dto.interface";
|
|
|
53
53
|
export * from "./interface/role.permission.mapping.entity.api";
|
|
54
54
|
export * from "./interface/role.permission.mapping.update.dto.interface";
|
|
55
55
|
export * from "./interface/role.permission.mapping.response";
|
|
56
|
+
export * from "./interface/role.permission.mapping.delete.dto.interface";
|
|
57
|
+
export * from "./interface/billing.transaction.create.dto.interface";
|
|
58
|
+
export * from "./interface/billing.transaction.update.dto.interface";
|
|
59
|
+
export * from "./interface/billing.transaction.entity.response";
|
|
60
|
+
export * from "./interface/billing.flow.update.dto";
|
package/dist/src/api/index.js
CHANGED
|
@@ -69,3 +69,8 @@ __exportStar(require("./interface/role.permission.mapping.create.dto.interface")
|
|
|
69
69
|
__exportStar(require("./interface/role.permission.mapping.entity.api"), exports);
|
|
70
70
|
__exportStar(require("./interface/role.permission.mapping.update.dto.interface"), exports);
|
|
71
71
|
__exportStar(require("./interface/role.permission.mapping.response"), exports);
|
|
72
|
+
__exportStar(require("./interface/role.permission.mapping.delete.dto.interface"), exports);
|
|
73
|
+
__exportStar(require("./interface/billing.transaction.create.dto.interface"), exports);
|
|
74
|
+
__exportStar(require("./interface/billing.transaction.update.dto.interface"), exports);
|
|
75
|
+
__exportStar(require("./interface/billing.transaction.entity.response"), exports);
|
|
76
|
+
__exportStar(require("./interface/billing.flow.update.dto"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BillingImpactEnum, BillingTimesheetStatusEnum, IBillingEntity, IBillingTimesheetEntity, IEntityUpdateDto
|
|
1
|
+
import { BillingImpactEnum, BillingTimesheetStatusEnum, IBillingEntity, IBillingTimesheetEntity, IEntityUpdateDto } from "../../entities";
|
|
2
2
|
export interface IBillingUpdateDto extends IEntityUpdateDto<IBillingEntity> {
|
|
3
3
|
}
|
|
4
4
|
export interface IBillingTimesheetUpdateDto extends IEntityUpdateDto<IBillingTimesheetEntity> {
|
|
@@ -15,15 +15,6 @@ export interface IBillingTimesheetDeleteDto extends Partial<IBillingTimesheetEnt
|
|
|
15
15
|
id: number;
|
|
16
16
|
changedStatus: BillingTimesheetStatusEnum;
|
|
17
17
|
}
|
|
18
|
-
export interface IUpdateBillingDto {
|
|
19
|
-
startDate?: string;
|
|
20
|
-
endDate?: string;
|
|
21
|
-
projectId?: number;
|
|
22
|
-
totalAmount?: number;
|
|
23
|
-
totalMinutes?: number;
|
|
24
|
-
paymentStatus?: PaymentStatusEnum;
|
|
25
|
-
status?: StatusEnum;
|
|
26
|
-
invoiceNumber?: number;
|
|
27
|
-
writeoffAmount?: number;
|
|
18
|
+
export interface IUpdateBillingDto extends IBillingUpdateDto {
|
|
28
19
|
timesheets?: IBillingTimesheetUpdateDto[];
|
|
29
20
|
}
|
|
@@ -11,3 +11,18 @@ export declare enum StatusEnum {
|
|
|
11
11
|
PENDING_PAYMENT = "PENDING_PAYMENT",
|
|
12
12
|
PAYMENT_DONE = "PAYMENT_DONE"
|
|
13
13
|
}
|
|
14
|
+
export declare enum BillingStatusActions {
|
|
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.StatusEnum = void 0;
|
|
3
|
+
exports.BillingStatusActions = exports.StatusEnum = void 0;
|
|
4
4
|
var StatusEnum;
|
|
5
5
|
(function (StatusEnum) {
|
|
6
6
|
StatusEnum["PENDING_APPROVAL"] = "PENDING_APPROVAL";
|
|
@@ -15,3 +15,19 @@ var StatusEnum;
|
|
|
15
15
|
StatusEnum["PENDING_PAYMENT"] = "PENDING_PAYMENT";
|
|
16
16
|
StatusEnum["PAYMENT_DONE"] = "PAYMENT_DONE";
|
|
17
17
|
})(StatusEnum || (exports.StatusEnum = StatusEnum = {}));
|
|
18
|
+
var BillingStatusActions;
|
|
19
|
+
(function (BillingStatusActions) {
|
|
20
|
+
BillingStatusActions["APPROVE"] = "approve";
|
|
21
|
+
BillingStatusActions["REJECT"] = "reject";
|
|
22
|
+
BillingStatusActions["EDIT"] = "edit";
|
|
23
|
+
BillingStatusActions["REQUEST_FOR_CHANGES"] = "requestForChanges";
|
|
24
|
+
BillingStatusActions["SENT_FOR_APPROVAL"] = "sentForApproval";
|
|
25
|
+
BillingStatusActions["SEND_FOR_CLIENT_REVIEW"] = "sendForClientReview";
|
|
26
|
+
BillingStatusActions["CLIENT_REVISION"] = "clientRevision";
|
|
27
|
+
BillingStatusActions["SEND_INVOICE"] = "sendInvoice";
|
|
28
|
+
BillingStatusActions["APPROVAL"] = "approval";
|
|
29
|
+
BillingStatusActions["UPDATE_PAYMENT"] = "updatePayment";
|
|
30
|
+
BillingStatusActions["CREDIT_NOTE"] = "creditNote";
|
|
31
|
+
BillingStatusActions["WRITE_OFF"] = "writeOff";
|
|
32
|
+
BillingStatusActions["TDS"] = "tds";
|
|
33
|
+
})(BillingStatusActions || (exports.BillingStatusActions = BillingStatusActions = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillingTransactionType = void 0;
|
|
4
|
+
var BillingTransactionType;
|
|
5
|
+
(function (BillingTransactionType) {
|
|
6
|
+
BillingTransactionType["TDS"] = "TDS";
|
|
7
|
+
BillingTransactionType["WRITE_OFF"] = "WRITE_OFF";
|
|
8
|
+
BillingTransactionType["CREDIT_NOTE"] = "CREDIT_NOTE";
|
|
9
|
+
BillingTransactionType["PAYMENT"] = "PAYMENT";
|
|
10
|
+
})(BillingTransactionType || (exports.BillingTransactionType = BillingTransactionType = {}));
|
|
@@ -32,3 +32,5 @@ export * from "./interface/client_affiliate_entity.interface";
|
|
|
32
32
|
export * from "./interface/role.entity.interface";
|
|
33
33
|
export * from "./interface/permission.entity.interface";
|
|
34
34
|
export * from "./interface/role.permission.mapping.entity.interface";
|
|
35
|
+
export * from "./interface/billing_transaction.entity.interface";
|
|
36
|
+
export * from "./enums/billing.transaction.enum";
|
|
@@ -48,3 +48,5 @@ __exportStar(require("./interface/client_affiliate_entity.interface"), exports);
|
|
|
48
48
|
__exportStar(require("./interface/role.entity.interface"), exports);
|
|
49
49
|
__exportStar(require("./interface/permission.entity.interface"), exports);
|
|
50
50
|
__exportStar(require("./interface/role.permission.mapping.entity.interface"), exports);
|
|
51
|
+
__exportStar(require("./interface/billing_transaction.entity.interface"), exports);
|
|
52
|
+
__exportStar(require("./enums/billing.transaction.enum"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BillingTransactionType } from "../enums/billing.transaction.enum";
|
|
2
|
+
import { IAuditColumnEntity } from "./audit-column.entity.interface";
|
|
3
|
+
import { IEntityFilterData } from "./entity.utils.interface";
|
|
4
|
+
export interface IBillingTransactionEntity extends IAuditColumnEntity {
|
|
5
|
+
id: number;
|
|
6
|
+
billingId: number;
|
|
7
|
+
type: BillingTransactionType;
|
|
8
|
+
amount: number;
|
|
9
|
+
details: string;
|
|
10
|
+
}
|
|
11
|
+
export type IBillingTransactionEntityFilterData = IEntityFilterData<IBillingTransactionEntity>;
|
|
@@ -36,5 +36,6 @@ export interface IUserEntity extends IAuditColumnEntity {
|
|
|
36
36
|
secondEmergencyContactName?: string;
|
|
37
37
|
secondaryEmergencyContactNo?: string;
|
|
38
38
|
secondaryEmergencyContactRelation?: string;
|
|
39
|
+
permissions?: string[];
|
|
39
40
|
}
|
|
40
41
|
export type IUserEntityFilterData = IEntityFilterData<IUserEntity>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IEntityFilterData } from "../entities";
|
|
1
2
|
export declare function groupByFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T[]>;
|
|
2
3
|
export declare function groupByOneToOneFunction<T, K>(list: T[], keyGetter: (input: T) => K): Map<K, T>;
|
|
3
4
|
export declare function convertMapToObject<K, T>(map: Map<K, T>): {
|
|
@@ -81,9 +82,36 @@ export declare function arrayIntersectionWith<T>(source: T[], target: T[], compa
|
|
|
81
82
|
*/
|
|
82
83
|
export declare function arrayUnion<T>(source: T[], target: T[]): T[];
|
|
83
84
|
export declare function sumArray<T>(array: T[], key: keyof T): number;
|
|
85
|
+
/**
|
|
86
|
+
* Compares existing and incoming arrays and returns the added, deleted, and present elements.
|
|
87
|
+
*
|
|
88
|
+
* @template T - The type of elements in the arrays.
|
|
89
|
+
* @param {T[]} existing - The existing array.
|
|
90
|
+
* @param {T[]} incoming - The incoming array.
|
|
91
|
+
* @returns {{ added: T[]; deleted: T[]; present: T[] }} An object containing arrays of added, deleted, and present elements.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* const existing = [1, 2, 3];
|
|
95
|
+
* const incoming = [2, 3, 4];
|
|
96
|
+
* const result = newRemoved(existing, incoming);
|
|
97
|
+
* console.log(result); // Output: { added: [4], deleted: [1], present: [2, 3, 4] }
|
|
98
|
+
*/
|
|
84
99
|
export declare function newRemoved<T>(existing: T[], incoming: T[]): {
|
|
85
100
|
added: T[];
|
|
86
101
|
deleted: T[];
|
|
87
102
|
present: T[];
|
|
88
103
|
};
|
|
89
104
|
export declare function getEnumNames(enumType: object): string[];
|
|
105
|
+
export declare function getFilterByPermission<T>(permissionFilterConfig: {
|
|
106
|
+
[key: string]: IEntityFilterData<T>;
|
|
107
|
+
}, propertyName: keyof T, userPermission: string, filterDto: IEntityFilterData<T>, emptyValue?: any): {
|
|
108
|
+
[x: string]: any;
|
|
109
|
+
};
|
|
110
|
+
export declare function getFilterByPermissionFn<T>(permissionFilterConfig: {
|
|
111
|
+
[key: string]: () => Promise<IEntityFilterData<T>>;
|
|
112
|
+
}, propertyName: keyof T, userPermission: string, filterDto: IEntityFilterData<T>, emptyValue?: any): Promise<{
|
|
113
|
+
[x: string]: any;
|
|
114
|
+
}>;
|
|
115
|
+
export declare function getPropertyFilterByPermissionFn<T>(permissionFilterConfig: {
|
|
116
|
+
[key: string]: () => Promise<IEntityFilterData<T>>;
|
|
117
|
+
}, propertyNames: (keyof T)[], userPermission: string, filterDto: IEntityFilterData<T>, emptyValue?: any): Promise<IEntityFilterData<T>>;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.groupByFunction = groupByFunction;
|
|
4
13
|
exports.groupByOneToOneFunction = groupByOneToOneFunction;
|
|
@@ -12,6 +21,9 @@ exports.arrayUnion = arrayUnion;
|
|
|
12
21
|
exports.sumArray = sumArray;
|
|
13
22
|
exports.newRemoved = newRemoved;
|
|
14
23
|
exports.getEnumNames = getEnumNames;
|
|
24
|
+
exports.getFilterByPermission = getFilterByPermission;
|
|
25
|
+
exports.getFilterByPermissionFn = getFilterByPermissionFn;
|
|
26
|
+
exports.getPropertyFilterByPermissionFn = getPropertyFilterByPermissionFn;
|
|
15
27
|
function groupByFunction(list, keyGetter) {
|
|
16
28
|
const map = new Map();
|
|
17
29
|
list.forEach((item) => {
|
|
@@ -138,6 +150,20 @@ function arrayUnion(source, target) {
|
|
|
138
150
|
function sumArray(array, key) {
|
|
139
151
|
return array.reduce((acc, item) => acc + Number(item[key]), 0);
|
|
140
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Compares existing and incoming arrays and returns the added, deleted, and present elements.
|
|
155
|
+
*
|
|
156
|
+
* @template T - The type of elements in the arrays.
|
|
157
|
+
* @param {T[]} existing - The existing array.
|
|
158
|
+
* @param {T[]} incoming - The incoming array.
|
|
159
|
+
* @returns {{ added: T[]; deleted: T[]; present: T[] }} An object containing arrays of added, deleted, and present elements.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* const existing = [1, 2, 3];
|
|
163
|
+
* const incoming = [2, 3, 4];
|
|
164
|
+
* const result = newRemoved(existing, incoming);
|
|
165
|
+
* console.log(result); // Output: { added: [4], deleted: [1], present: [2, 3, 4] }
|
|
166
|
+
*/
|
|
141
167
|
function newRemoved(existing, incoming) {
|
|
142
168
|
existing = existing || [];
|
|
143
169
|
incoming = incoming || [];
|
|
@@ -149,3 +175,57 @@ function newRemoved(existing, incoming) {
|
|
|
149
175
|
function getEnumNames(enumType) {
|
|
150
176
|
return Object.values(enumType).filter((value) => typeof value === "string");
|
|
151
177
|
}
|
|
178
|
+
function getFilterByPermission(permissionFilterConfig, propertyName, userPermission, filterDto, emptyValue = []) {
|
|
179
|
+
const dtoFilter = filterDto[propertyName];
|
|
180
|
+
const permissionFilter = permissionFilterConfig[userPermission][propertyName];
|
|
181
|
+
const isDtoFilterIdPresent = dtoFilter && dtoFilter.length > 0;
|
|
182
|
+
const isPermissionFilterIdPresent = permissionFilter && permissionFilter.length > 0;
|
|
183
|
+
return {
|
|
184
|
+
[propertyName]: isPermissionFilterIdPresent
|
|
185
|
+
? isDtoFilterIdPresent
|
|
186
|
+
? arrayIntersection(permissionFilter, dtoFilter).length > 0
|
|
187
|
+
? arrayIntersection(permissionFilter, dtoFilter)
|
|
188
|
+
: emptyValue
|
|
189
|
+
: permissionFilter
|
|
190
|
+
: dtoFilter,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function getFilterByPermissionFn(permissionFilterConfig_1, propertyName_1, userPermission_1, filterDto_1) {
|
|
194
|
+
return __awaiter(this, arguments, void 0, function* (permissionFilterConfig, propertyName, userPermission, filterDto, emptyValue = []) {
|
|
195
|
+
const filterData = yield permissionFilterConfig[userPermission]();
|
|
196
|
+
const dtoFilter = filterDto[propertyName];
|
|
197
|
+
const permissionFilter = filterData[propertyName];
|
|
198
|
+
const isDtoFilterIdPresent = dtoFilter && dtoFilter.length > 0;
|
|
199
|
+
const isPermissionFilterIdPresent = permissionFilter && permissionFilter.length > 0;
|
|
200
|
+
return {
|
|
201
|
+
[propertyName]: isPermissionFilterIdPresent
|
|
202
|
+
? isDtoFilterIdPresent
|
|
203
|
+
? arrayIntersection(permissionFilter, dtoFilter).length > 0
|
|
204
|
+
? arrayIntersection(permissionFilter, dtoFilter)
|
|
205
|
+
: emptyValue
|
|
206
|
+
: permissionFilter
|
|
207
|
+
: dtoFilter,
|
|
208
|
+
};
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function getPropertyFilterByPermissionFn(permissionFilterConfig_1, propertyNames_1, userPermission_1, filterDto_1) {
|
|
212
|
+
return __awaiter(this, arguments, void 0, function* (permissionFilterConfig, propertyNames, userPermission, filterDto, emptyValue = []) {
|
|
213
|
+
const filterData = yield permissionFilterConfig[userPermission]();
|
|
214
|
+
const result = {};
|
|
215
|
+
for (const propertyName of propertyNames) {
|
|
216
|
+
const dtoFilter = filterDto[propertyName];
|
|
217
|
+
const permissionFilter = filterData[propertyName];
|
|
218
|
+
const isDtoFilterIdPresent = dtoFilter && dtoFilter.length > 0;
|
|
219
|
+
const isPermissionFilterIdPresent = permissionFilter && permissionFilter.length > 0;
|
|
220
|
+
result[propertyName] =
|
|
221
|
+
isPermissionFilterIdPresent
|
|
222
|
+
? isDtoFilterIdPresent
|
|
223
|
+
? arrayIntersection(permissionFilter, dtoFilter).length > 0
|
|
224
|
+
? arrayIntersection(permissionFilter, dtoFilter)
|
|
225
|
+
: emptyValue
|
|
226
|
+
: permissionFilter
|
|
227
|
+
: dtoFilter;
|
|
228
|
+
}
|
|
229
|
+
return result;
|
|
230
|
+
});
|
|
231
|
+
}
|