law-common 1.2.5 → 1.2.7
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IApiEntity, IClientEntity } from "../../entities";
|
|
1
|
+
import { IApiEntity, IClientEntity, 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
5
|
export type IGetClientsByFilter = {
|
|
6
|
-
clients:
|
|
6
|
+
clients: (IClientEntity & IClientEntityDependent)[];
|
|
7
7
|
users: {
|
|
8
8
|
[key: string]: IUserApiEntity;
|
|
9
9
|
};
|
|
@@ -15,11 +15,13 @@ export interface IClientEntity extends IAuditColumnEntity {
|
|
|
15
15
|
description?: string;
|
|
16
16
|
organizationId: number;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
19
|
-
export interface IClientEntityCreateDto extends Omit<IEntityCreateDto<IClientEntity>, IClientExclude> {
|
|
18
|
+
export interface IClientEntityDependent {
|
|
20
19
|
partnerIds: number[];
|
|
21
20
|
}
|
|
22
|
-
export
|
|
21
|
+
export type IClientExclude = 'organizationId';
|
|
22
|
+
export interface IClientEntityCreateDto extends Omit<IEntityCreateDto<IClientEntity>, IClientExclude>, IClientEntityDependent {
|
|
23
|
+
}
|
|
24
|
+
export interface IClientEntityUpdateDto extends Omit<IEntityUpdateDto<IClientEntity>, IClientExclude>, Partial<IClientEntityDependent> {
|
|
23
25
|
partnerIds?: number[];
|
|
24
26
|
}
|
|
25
27
|
export interface IClientEntityFilterDto extends IEntityFilterData<IClientEntity> {
|
|
@@ -3,3 +3,5 @@ export declare function groupByOneToOneFunction<T, K>(list: T[], keyGetter: (inp
|
|
|
3
3
|
export declare function convertMapToObject<K, T>(map: Map<K, T>): {
|
|
4
4
|
[key: string]: T;
|
|
5
5
|
};
|
|
6
|
+
export declare function removeSamePropertyValues(source: any, target: any): void;
|
|
7
|
+
export declare function removeElementsFromArray<T>(source: T[], target: T[]): T[];
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.groupByFunction = groupByFunction;
|
|
4
4
|
exports.groupByOneToOneFunction = groupByOneToOneFunction;
|
|
5
5
|
exports.convertMapToObject = convertMapToObject;
|
|
6
|
+
exports.removeSamePropertyValues = removeSamePropertyValues;
|
|
7
|
+
exports.removeElementsFromArray = removeElementsFromArray;
|
|
6
8
|
function groupByFunction(list, keyGetter) {
|
|
7
9
|
const map = new Map();
|
|
8
10
|
list.forEach((item) => {
|
|
@@ -28,3 +30,13 @@ function groupByOneToOneFunction(list, keyGetter) {
|
|
|
28
30
|
function convertMapToObject(map) {
|
|
29
31
|
return Object.fromEntries(map);
|
|
30
32
|
}
|
|
33
|
+
function removeSamePropertyValues(source, target) {
|
|
34
|
+
for (let key in target) {
|
|
35
|
+
if (source[key] && source[key] === target[key]) {
|
|
36
|
+
delete target[key];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function removeElementsFromArray(source, target) {
|
|
41
|
+
return target.filter((element) => !source.includes(element));
|
|
42
|
+
}
|