law-common 1.2.37 → 1.2.38
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/client.entity.response.d.ts +2 -2
- package/dist/src/api/interface/timesheet.entity.response.interface.d.ts +15 -0
- package/dist/src/entities/interface/client.entity.interface.d.ts +3 -0
- package/dist/src/utils/helper.fn.util.d.ts +1 -0
- package/dist/src/utils/helper.fn.util.js +4 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IApiEntity, IClientEntity, IClientEntityDependent } from "../../entities";
|
|
1
|
+
import { IApiEntity, IClientEntity, IClientEntityChildren, IClientEntityDependent } from "../../entities";
|
|
2
2
|
import { IUserApiEntity } from "./user.entity.api";
|
|
3
3
|
export type IClientApiEntity = IApiEntity<IClientEntity>;
|
|
4
4
|
export type IClientApiEntityArray = IClientApiEntity[];
|
|
5
|
-
export type IClientApiEntityDependent = IClientApiEntity & IClientEntityDependent;
|
|
5
|
+
export type IClientApiEntityDependent = IClientApiEntity & IClientEntityDependent & IClientEntityChildren;
|
|
6
6
|
export type IClientEntityGet = {
|
|
7
7
|
clients: IClientApiEntityDependent[];
|
|
8
8
|
users: {
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { IApiEntity, ITimesheetEntity } from "../../entities";
|
|
2
2
|
import { IBaseResponse } from "./base.response.interface";
|
|
3
|
+
import { IClientApiEntityDependent } from "./client.entity.response";
|
|
4
|
+
import { IProjectApiEntityDependent } from "./project.entity.response";
|
|
5
|
+
import { IUserApiEntity } from "./user.entity.api";
|
|
3
6
|
export type ITimesheetApiEntity = IApiEntity<ITimesheetEntity>;
|
|
4
7
|
export type ITimesheetApiEntityArray = ITimesheetApiEntity[];
|
|
5
8
|
export type ITimesheetApiEntityResponse = IBaseResponse<ITimesheetApiEntity>;
|
|
6
9
|
export type ITimesheetApiEntityResponseArray = IBaseResponse<ITimesheetApiEntity>;
|
|
10
|
+
export type ITimesheetEntityGet = {
|
|
11
|
+
timesheets: ITimesheetApiEntity[];
|
|
12
|
+
clients: {
|
|
13
|
+
[key: string]: IClientApiEntityDependent;
|
|
14
|
+
};
|
|
15
|
+
projects: {
|
|
16
|
+
[key: string]: IProjectApiEntityDependent;
|
|
17
|
+
};
|
|
18
|
+
users: {
|
|
19
|
+
[key: string]: IUserApiEntity;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -18,6 +18,9 @@ export interface IClientEntity extends IAuditColumnEntity {
|
|
|
18
18
|
export interface IClientEntityDependent {
|
|
19
19
|
partnerIds: number[];
|
|
20
20
|
}
|
|
21
|
+
export interface IClientEntityChildren {
|
|
22
|
+
projectIds?: number[];
|
|
23
|
+
}
|
|
21
24
|
export type IClientExclude = "organizationId";
|
|
22
25
|
export interface IClientEntityCreateDto extends Omit<IEntityCreateDto<IClientEntity>, IClientExclude>, IClientEntityDependent {
|
|
23
26
|
}
|
|
@@ -80,6 +80,7 @@ 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 sumArray<T>(array: T[], key: keyof T): number;
|
|
83
84
|
export declare function newRemoved<T>(existing: T[], incoming: T[]): {
|
|
84
85
|
added: T[];
|
|
85
86
|
deleted: T[];
|
|
@@ -9,6 +9,7 @@ exports.arrayDifference = arrayDifference;
|
|
|
9
9
|
exports.arrayIntersection = arrayIntersection;
|
|
10
10
|
exports.arrayIntersectionWith = arrayIntersectionWith;
|
|
11
11
|
exports.arrayUnion = arrayUnion;
|
|
12
|
+
exports.sumArray = sumArray;
|
|
12
13
|
exports.newRemoved = newRemoved;
|
|
13
14
|
exports.getEnumNames = getEnumNames;
|
|
14
15
|
function groupByFunction(list, keyGetter) {
|
|
@@ -134,6 +135,9 @@ function arrayIntersectionWith(source, target, comparator) {
|
|
|
134
135
|
function arrayUnion(source, target) {
|
|
135
136
|
return [...new Set([...source, ...target])];
|
|
136
137
|
}
|
|
138
|
+
function sumArray(array, key) {
|
|
139
|
+
return array.reduce((acc, item) => acc + Number(item[key]), 0);
|
|
140
|
+
}
|
|
137
141
|
function newRemoved(existing, incoming) {
|
|
138
142
|
existing = existing || [];
|
|
139
143
|
incoming = incoming || [];
|