law-common 1.2.36 → 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/jest.config.d.ts +3 -0
- package/dist/jest.config.js +11 -0
- package/dist/{api → src/api}/interface/client.entity.response.d.ts +2 -2
- package/dist/src/api/interface/timesheet.entity.response.interface.d.ts +21 -0
- package/dist/{entities → src/entities}/interface/client.entity.interface.d.ts +3 -0
- package/dist/{entities → src/entities}/interface/entity.utils.interface.d.ts +9 -0
- package/dist/{utils → src/utils}/helper.fn.util.d.ts +1 -0
- package/dist/{utils → src/utils}/helper.fn.util.js +4 -0
- package/dist/tests/date-code.model.util.spec.d.ts +1 -0
- package/dist/tests/date-code.model.util.spec.js +18 -0
- package/dist/tests/json.generator.spec.d.ts +1 -0
- package/dist/tests/json.generator.spec.js +35 -0
- package/dist/tests/sum.test.spec.d.ts +1 -0
- package/dist/tests/sum.test.spec.js +7 -0
- package/package.json +1 -1
- package/dist/api/interface/timesheet.entity.response.interface.d.ts +0 -6
- /package/dist/{@api.d.ts → src/@api.d.ts} +0 -0
- /package/dist/{@api.js → src/@api.js} +0 -0
- /package/dist/{@entities.d.ts → src/@entities.d.ts} +0 -0
- /package/dist/{@entities.js → src/@entities.js} +0 -0
- /package/dist/{@exceptions.d.ts → src/@exceptions.d.ts} +0 -0
- /package/dist/{@exceptions.js → src/@exceptions.js} +0 -0
- /package/dist/{@misc.d.ts → src/@misc.d.ts} +0 -0
- /package/dist/{@misc.js → src/@misc.js} +0 -0
- /package/dist/{api → src/api}/index.d.ts +0 -0
- /package/dist/{api → src/api}/index.js +0 -0
- /package/dist/{api → src/api}/interface/base.response.interface.d.ts +0 -0
- /package/dist/{api → src/api}/interface/base.response.interface.js +0 -0
- /package/dist/{api → src/api}/interface/client.entity.response.js +0 -0
- /package/dist/{api → src/api}/interface/configuration.entity.response.d.ts +0 -0
- /package/dist/{api → src/api}/interface/configuration.entity.response.js +0 -0
- /package/dist/{api → src/api}/interface/designation.entity.response.d.ts +0 -0
- /package/dist/{api → src/api}/interface/designation.entity.response.js +0 -0
- /package/dist/{api → src/api}/interface/industry.entity.response.d.ts +0 -0
- /package/dist/{api → src/api}/interface/industry.entity.response.js +0 -0
- /package/dist/{api → src/api}/interface/jwt.payload.interface.d.ts +0 -0
- /package/dist/{api → src/api}/interface/jwt.payload.interface.js +0 -0
- /package/dist/{api → src/api}/interface/login.dto.interface.d.ts +0 -0
- /package/dist/{api → src/api}/interface/login.dto.interface.js +0 -0
- /package/dist/{api → src/api}/interface/login.response.interface.d.ts +0 -0
- /package/dist/{api → src/api}/interface/login.response.interface.js +0 -0
- /package/dist/{api → src/api}/interface/project.entity.response.d.ts +0 -0
- /package/dist/{api → src/api}/interface/project.entity.response.js +0 -0
- /package/dist/{api → src/api}/interface/rate.entity.response.d.ts +0 -0
- /package/dist/{api → src/api}/interface/rate.entity.response.js +0 -0
- /package/dist/{api → src/api}/interface/task.create.dto.interface.d.ts +0 -0
- /package/dist/{api → src/api}/interface/task.create.dto.interface.js +0 -0
- /package/dist/{api → src/api}/interface/task.entity.api.d.ts +0 -0
- /package/dist/{api → src/api}/interface/task.entity.api.js +0 -0
- /package/dist/{api → src/api}/interface/task.entity.response.d.ts +0 -0
- /package/dist/{api → src/api}/interface/task.entity.response.js +0 -0
- /package/dist/{api → src/api}/interface/task.update.dto.interface.d.ts +0 -0
- /package/dist/{api → src/api}/interface/task.update.dto.interface.js +0 -0
- /package/dist/{api → src/api}/interface/timesheet.entity.response.interface.js +0 -0
- /package/dist/{api → src/api}/interface/user.create.dto.interace.d.ts +0 -0
- /package/dist/{api → src/api}/interface/user.create.dto.interace.js +0 -0
- /package/dist/{api → src/api}/interface/user.entity.api.d.ts +0 -0
- /package/dist/{api → src/api}/interface/user.entity.api.js +0 -0
- /package/dist/{api → src/api}/interface/user.entity.response.d.ts +0 -0
- /package/dist/{api → src/api}/interface/user.entity.response.js +0 -0
- /package/dist/{api → src/api}/interface/user.update.dto.interface.d.ts +0 -0
- /package/dist/{api → src/api}/interface/user.update.dto.interface.js +0 -0
- /package/dist/{entities → src/entities}/enums/country.entity.enum.d.ts +0 -0
- /package/dist/{entities → src/entities}/enums/country.entity.enum.js +0 -0
- /package/dist/{entities → src/entities}/enums/organization.entity.enum.d.ts +0 -0
- /package/dist/{entities → src/entities}/enums/organization.entity.enum.js +0 -0
- /package/dist/{entities → src/entities}/enums/project.entity.enum.d.ts +0 -0
- /package/dist/{entities → src/entities}/enums/project.entity.enum.js +0 -0
- /package/dist/{entities → src/entities}/enums/task.entity.enum.d.ts +0 -0
- /package/dist/{entities → src/entities}/enums/task.entity.enum.js +0 -0
- /package/dist/{entities → src/entities}/enums/user.entity.enum.d.ts +0 -0
- /package/dist/{entities → src/entities}/enums/user.entity.enum.js +0 -0
- /package/dist/{entities → src/entities}/func/convert-to-common-entity.func.d.ts +0 -0
- /package/dist/{entities → src/entities}/func/convert-to-common-entity.func.js +0 -0
- /package/dist/{entities → src/entities}/index.d.ts +0 -0
- /package/dist/{entities → src/entities}/index.js +0 -0
- /package/dist/{entities → src/entities}/interface/audit-column.entity.interface.d.ts +0 -0
- /package/dist/{entities → src/entities}/interface/audit-column.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/client.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/configuration.entity.interface.d.ts +0 -0
- /package/dist/{entities → src/entities}/interface/configuration.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/designation.entity.interface.d.ts +0 -0
- /package/dist/{entities → src/entities}/interface/designation.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/entity.utils.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/industry.entity.interface.d.ts +0 -0
- /package/dist/{entities → src/entities}/interface/industry.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/organization.entity.interface.d.ts +0 -0
- /package/dist/{entities → src/entities}/interface/organization.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/project.entity.interface.d.ts +0 -0
- /package/dist/{entities → src/entities}/interface/project.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/rate.entity.interface.d.ts +0 -0
- /package/dist/{entities → src/entities}/interface/rate.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/task.entity.interface.d.ts +0 -0
- /package/dist/{entities → src/entities}/interface/task.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/timesheet.entity.interface.d.ts +0 -0
- /package/dist/{entities → src/entities}/interface/timesheet.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/interface/user.entity.interface.d.ts +0 -0
- /package/dist/{entities → src/entities}/interface/user.entity.interface.js +0 -0
- /package/dist/{entities → src/entities}/model/designation.entity.model.d.ts +0 -0
- /package/dist/{entities → src/entities}/model/designation.entity.model.js +0 -0
- /package/dist/{enums → src/enums}/currency.enum.d.ts +0 -0
- /package/dist/{enums → src/enums}/currency.enum.js +0 -0
- /package/dist/{enums → src/enums}/error.key.enum.d.ts +0 -0
- /package/dist/{enums → src/enums}/error.key.enum.js +0 -0
- /package/dist/{enums → src/enums}/index.d.ts +0 -0
- /package/dist/{enums → src/enums}/index.js +0 -0
- /package/dist/{enums → src/enums}/time.unit.enum.d.ts +0 -0
- /package/dist/{enums → src/enums}/time.unit.enum.js +0 -0
- /package/dist/{exceptions → src/exceptions}/impl/app-badrequest.exception.d.ts +0 -0
- /package/dist/{exceptions → src/exceptions}/impl/app-badrequest.exception.js +0 -0
- /package/dist/{exceptions → src/exceptions}/index.d.ts +0 -0
- /package/dist/{exceptions → src/exceptions}/index.js +0 -0
- /package/dist/{exceptions → src/exceptions}/interface/error.response.d.ts +0 -0
- /package/dist/{exceptions → src/exceptions}/interface/error.response.js +0 -0
- /package/dist/{exceptions → src/exceptions}/type/app-bad-request.exception.d.ts +0 -0
- /package/dist/{exceptions → src/exceptions}/type/app-bad-request.exception.js +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{misc → src/misc}/index.d.ts +0 -0
- /package/dist/{misc → src/misc}/index.js +0 -0
- /package/dist/{misc → src/misc}/interface/modify.interface.d.ts +0 -0
- /package/dist/{misc → src/misc}/interface/modify.interface.js +0 -0
- /package/dist/{misc → src/misc}/interface/optional.interface.d.ts +0 -0
- /package/dist/{misc → src/misc}/interface/optional.interface.js +0 -0
- /package/dist/{misc → src/misc}/interface/upload-multer-file.interface.d.ts +0 -0
- /package/dist/{misc → src/misc}/interface/upload-multer-file.interface.js +0 -0
- /package/dist/{misc → src/misc}/type/arrayed.type.d.ts +0 -0
- /package/dist/{misc → src/misc}/type/arrayed.type.js +0 -0
- /package/dist/{utils → src/utils}/date.util.d.ts +0 -0
- /package/dist/{utils → src/utils}/date.util.js +0 -0
- /package/dist/{utils → src/utils}/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/index.js +0 -0
- /package/dist/{utils → src/utils}/models/date-code.model.util.d.ts +0 -0
- /package/dist/{utils → src/utils}/models/date-code.model.util.js +0 -0
- /package/dist/{utils → src/utils}/models/json.generator.d.ts +0 -0
- /package/dist/{utils → src/utils}/models/json.generator.js +0 -0
- /package/dist/{utils → src/utils}/number.util.d.ts +0 -0
- /package/dist/{utils → src/utils}/number.util.js +0 -0
- /package/dist/{utils → src/utils}/string.util.d.ts +0 -0
- /package/dist/{utils → src/utils}/string.util.js +0 -0
|
@@ -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: {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IApiEntity, ITimesheetEntity } from "../../entities";
|
|
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";
|
|
6
|
+
export type ITimesheetApiEntity = IApiEntity<ITimesheetEntity>;
|
|
7
|
+
export type ITimesheetApiEntityArray = ITimesheetApiEntity[];
|
|
8
|
+
export type ITimesheetApiEntityResponse = IBaseResponse<ITimesheetApiEntity>;
|
|
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
|
}
|
|
@@ -19,4 +19,13 @@ export type IEntityFilterData<T> = ConvertToArray<IEntityUpdateDto<T>> & {
|
|
|
19
19
|
range?: {
|
|
20
20
|
[key in keyof T]?: [T[key], T[key]];
|
|
21
21
|
};
|
|
22
|
+
exclude?: {
|
|
23
|
+
[key in keyof T]?: T[key][];
|
|
24
|
+
};
|
|
25
|
+
greaterThan?: {
|
|
26
|
+
[key in keyof T]?: T[key];
|
|
27
|
+
};
|
|
28
|
+
lessThan?: {
|
|
29
|
+
[key in keyof T]?: T[key];
|
|
30
|
+
};
|
|
22
31
|
};
|
|
@@ -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 || [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../src/utils");
|
|
4
|
+
describe("Test DateCodeModel class", () => {
|
|
5
|
+
it("Check validate method", () => {
|
|
6
|
+
const dateCode = new utils_1.DateCodeModel("200101");
|
|
7
|
+
expect(dateCode.isValid()).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
it("Check getDate method", () => {
|
|
10
|
+
const dateCode = new utils_1.DateCodeModel("201011");
|
|
11
|
+
console.log(dateCode.getDate());
|
|
12
|
+
});
|
|
13
|
+
it("Check getRange method", () => {
|
|
14
|
+
const startDate = new utils_1.DateCodeModel("241030");
|
|
15
|
+
const endDate = new utils_1.DateCodeModel("241031");
|
|
16
|
+
console.log(utils_1.DateCodeModel.getRange(startDate, endDate).map((dateCode) => dateCode.dateCode));
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { JsonGenerator } from "../../../src/utils/models/json.generator";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const utils_1 = require("../src/utils");
|
|
5
|
+
const json_generator_1 = require("../src/utils/models/json.generator");
|
|
6
|
+
// import { DateCodeModel } from "../src";
|
|
7
|
+
// import { DateCodeModel } from "../utils";
|
|
8
|
+
// import { JsonGenerator } from "../utils/models/json.generator";
|
|
9
|
+
describe("Test JsonGenerator class", () => {
|
|
10
|
+
it("Check generateJsonFromObject method", () => {
|
|
11
|
+
const projectId = [1, 2, 3, 4];
|
|
12
|
+
const projectUser = {
|
|
13
|
+
1: [51, 56],
|
|
14
|
+
2: [52, 53, 56],
|
|
15
|
+
3: [54, 56],
|
|
16
|
+
4: [51, 52, 56, 57],
|
|
17
|
+
};
|
|
18
|
+
const projectSelectedIndex = 3;
|
|
19
|
+
const object = {
|
|
20
|
+
task: ["Call", "Drafting", "Task4", "Task 1"],
|
|
21
|
+
totalDuration: [15, 30, 45, 60, 90],
|
|
22
|
+
projectId: [projectId[projectSelectedIndex]],
|
|
23
|
+
userId: projectUser[projectId[projectSelectedIndex]],
|
|
24
|
+
dateCode: utils_1.DateCodeModel.getRange(new utils_1.DateCodeModel("241101"), new utils_1.DateCodeModel("241231")).map((dateCode) => dateCode.dateCode),
|
|
25
|
+
description: [
|
|
26
|
+
"description1",
|
|
27
|
+
"description2",
|
|
28
|
+
"description3",
|
|
29
|
+
"description4",
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
const json = json_generator_1.JsonGenerator.generateJsonFromObject(object, 300);
|
|
33
|
+
console.log(JSON.stringify(json));
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare function sum(a: number, b: number): number;
|
package/package.json
CHANGED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IApiEntity, ITimesheetEntity } from "../../entities";
|
|
2
|
-
import { IBaseResponse } from "./base.response.interface";
|
|
3
|
-
export type ITimesheetApiEntity = IApiEntity<ITimesheetEntity>;
|
|
4
|
-
export type ITimesheetApiEntityArray = ITimesheetApiEntity[];
|
|
5
|
-
export type ITimesheetApiEntityResponse = IBaseResponse<ITimesheetApiEntity>;
|
|
6
|
-
export type ITimesheetApiEntityResponseArray = IBaseResponse<ITimesheetApiEntity>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|