law-common 10.18.1-beta.1 → 10.18.1-beta.11
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 +1 -0
- package/dist/src/api/index.js +1 -0
- package/dist/src/api/interface/project-user-mapping.entity.api.d.ts +3 -0
- package/dist/src/api/interface/project-user-mapping.entity.api.js +2 -0
- package/dist/src/entities/enums/relation-type.enum.d.ts +4 -0
- package/dist/src/entities/enums/relation-type.enum.js +8 -0
- package/dist/src/entities/index.d.ts +16 -0
- package/dist/src/entities/index.js +16 -0
- package/dist/src/entities/interface/entity.utils.interface.d.ts +17 -0
- package/dist/src/entities/interface/relation-config.interface.d.ts +16 -0
- package/dist/src/entities/interface/relation-config.interface.js +2 -0
- package/dist/src/entities/model/bank.entity.model.d.ts +5 -2
- package/dist/src/entities/model/bank.entity.model.js +12 -6
- package/dist/src/entities/model/base.entity.model.d.ts +8 -0
- package/dist/src/entities/model/base.entity.model.js +69 -0
- package/dist/src/entities/model/billing-reimbursement-expense.entity.model.d.ts +25 -0
- package/dist/src/entities/model/billing-reimbursement-expense.entity.model.js +35 -0
- package/dist/src/entities/model/billing.entity.model.d.ts +79 -0
- package/dist/src/entities/model/billing.entity.model.js +228 -0
- package/dist/src/entities/model/client.entity.model.d.ts +35 -0
- package/dist/src/entities/model/client.entity.model.js +50 -0
- package/dist/src/entities/model/configuration.model.d.ts +8 -9
- package/dist/src/entities/model/configuration.model.js +10 -5
- package/dist/src/entities/model/designation.entity.model.d.ts +8 -5
- package/dist/src/entities/model/designation.entity.model.js +28 -9
- package/dist/src/entities/model/entity.model.interface.d.ts +8 -0
- package/dist/src/entities/model/entity.model.interface.js +69 -0
- package/dist/src/entities/model/holiday.entity.model.d.ts +1 -19
- package/dist/src/entities/model/holiday.entity.model.js +42 -29
- package/dist/src/entities/model/leave.entity.model.d.ts +5 -5
- package/dist/src/entities/model/leave.entity.model.js +4 -1
- package/dist/src/entities/model/project-user-mapping.entity.model.d.ts +26 -0
- package/dist/src/entities/model/project-user-mapping.entity.model.js +49 -0
- package/dist/src/entities/model/project.entity.model.d.ts +40 -0
- package/dist/src/entities/model/project.entity.model.js +105 -0
- package/dist/src/entities/model/reimbursement-expense.entity.model.d.ts +27 -0
- package/dist/src/entities/model/reimbursement-expense.entity.model.js +43 -0
- package/dist/src/entities/model/reimbursement.entity.model.d.ts +32 -0
- package/dist/src/entities/model/reimbursement.entity.model.js +34 -0
- package/dist/src/entities/model/task.entity.model.d.ts +17 -0
- package/dist/src/entities/model/task.entity.model.js +29 -0
- package/dist/src/entities/model/timesheet.entity.model.d.ts +21 -0
- package/dist/src/entities/model/timesheet.entity.model.js +31 -0
- package/dist/src/entities/model/user.entity.model.d.ts +46 -0
- package/dist/src/entities/model/user.entity.model.js +36 -0
- package/dist/src/model/entities/timesheet.model.d.ts +2 -0
- package/dist/src/model/entities/timesheet.model.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IClientApiEntity } from "../../api";
|
|
2
|
+
import { EntityEnum, EnumEntityType } from "../interface/entity.utils.interface";
|
|
3
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
4
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
5
|
+
import { ProjectEntityModel } from "./project.entity.model";
|
|
6
|
+
export declare class ClientEntityModel extends BaseEntityModel<EntityEnum.CLIENT> implements IClientApiEntity {
|
|
7
|
+
createdOn: string;
|
|
8
|
+
updatedOn: string;
|
|
9
|
+
id: number;
|
|
10
|
+
name: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
primaryContactName: string;
|
|
13
|
+
primaryContact: string;
|
|
14
|
+
primaryEmail: string;
|
|
15
|
+
secondaryContactName?: string;
|
|
16
|
+
secondaryEmail?: string;
|
|
17
|
+
address?: string;
|
|
18
|
+
secondaryContact?: string;
|
|
19
|
+
country?: string;
|
|
20
|
+
industry?: string;
|
|
21
|
+
zipCode?: string;
|
|
22
|
+
organizationId: number;
|
|
23
|
+
reference?: string;
|
|
24
|
+
createdBy: number;
|
|
25
|
+
updatedBy: number;
|
|
26
|
+
projectIds?: number[];
|
|
27
|
+
billingOverdueDays: number;
|
|
28
|
+
projects: ProjectEntityModel[];
|
|
29
|
+
getRelationConfigs(): any;
|
|
30
|
+
static relationConfigs: RelationConfigs<[
|
|
31
|
+
EntityEnum.PROJECT
|
|
32
|
+
], EnumEntityType<EntityEnum.CLIENT>>;
|
|
33
|
+
static fromApiEntity(apiEntity: IClientApiEntity): ClientEntityModel;
|
|
34
|
+
populateProjectIds(projects: ProjectEntityModel[]): ClientEntityModel;
|
|
35
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientEntityModel = void 0;
|
|
4
|
+
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
5
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
6
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
7
|
+
class ClientEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this.createdOn = "";
|
|
11
|
+
this.updatedOn = "";
|
|
12
|
+
this.id = 0;
|
|
13
|
+
this.name = "";
|
|
14
|
+
this.primaryContactName = "";
|
|
15
|
+
this.primaryContact = "";
|
|
16
|
+
this.primaryEmail = "";
|
|
17
|
+
this.organizationId = 0;
|
|
18
|
+
this.createdBy = 0;
|
|
19
|
+
this.updatedBy = 0;
|
|
20
|
+
this.billingOverdueDays = 0;
|
|
21
|
+
this.projects = [];
|
|
22
|
+
}
|
|
23
|
+
getRelationConfigs() {
|
|
24
|
+
// return this.constructor.prototype.relationConfigs || [];
|
|
25
|
+
return this.constructor.prototype.constructor.relationConfigs;
|
|
26
|
+
}
|
|
27
|
+
static fromApiEntity(apiEntity) {
|
|
28
|
+
const entity = new ClientEntityModel(entity_utils_interface_1.EntityEnum.CLIENT);
|
|
29
|
+
Object.assign(entity, apiEntity);
|
|
30
|
+
return entity;
|
|
31
|
+
}
|
|
32
|
+
populateProjectIds(projects) {
|
|
33
|
+
this.projectIds = projects
|
|
34
|
+
.filter((project) => project.clientId === this.id)
|
|
35
|
+
.map((project) => project.id);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.ClientEntityModel = ClientEntityModel;
|
|
40
|
+
ClientEntityModel.relationConfigs = [
|
|
41
|
+
{
|
|
42
|
+
name: entity_utils_interface_1.EntityEnum.PROJECT,
|
|
43
|
+
relation: relation_type_enum_1.RelationType.MANY,
|
|
44
|
+
key: "projects",
|
|
45
|
+
mapKeyConfig: {
|
|
46
|
+
relationKey: "clientId",
|
|
47
|
+
key: "id",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
];
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { ConfigurationKeyEnum, ConfigurationTypeEnum
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export declare class ConfigurationsModel implements IConfigurationsModel {
|
|
1
|
+
import { ConfigurationKeyEnum, ConfigurationTypeEnum } from "..";
|
|
2
|
+
import { IConfigurationApiEntity } from "../../api";
|
|
3
|
+
export declare class ConfigurationEntityModel implements IConfigurationApiEntity {
|
|
6
4
|
id: number;
|
|
7
5
|
key: ConfigurationKeyEnum;
|
|
8
6
|
value: string;
|
|
9
7
|
description: string;
|
|
10
8
|
label: string;
|
|
11
9
|
type: ConfigurationTypeEnum;
|
|
12
|
-
createdOn:
|
|
13
|
-
updatedOn:
|
|
10
|
+
createdOn: string;
|
|
11
|
+
updatedOn: string;
|
|
14
12
|
createdBy: number;
|
|
15
13
|
updatedBy: number;
|
|
16
14
|
organizationId: number;
|
|
17
|
-
constructor(data:
|
|
15
|
+
constructor(data: IConfigurationApiEntity);
|
|
18
16
|
isCronJobKey(): boolean;
|
|
19
|
-
static findByKey(configurationEntities:
|
|
17
|
+
static findByKey(configurationEntities: IConfigurationApiEntity[], key: ConfigurationKeyEnum): IConfigurationApiEntity | undefined;
|
|
18
|
+
static fromApiEntity(apiEntity: IConfigurationApiEntity): ConfigurationEntityModel;
|
|
20
19
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ConfigurationEntityModel = void 0;
|
|
4
4
|
const __1 = require("..");
|
|
5
|
-
class
|
|
5
|
+
class ConfigurationEntityModel {
|
|
6
6
|
constructor(data) {
|
|
7
7
|
this.id = 0;
|
|
8
8
|
this.key = __1.ConfigurationKeyEnum.PENDING_APPROVAL_TIMESHEET_REMINDER;
|
|
@@ -10,8 +10,8 @@ class ConfigurationsModel {
|
|
|
10
10
|
this.description = "";
|
|
11
11
|
this.label = "";
|
|
12
12
|
this.type = __1.ConfigurationTypeEnum.CRONJOB_EXPRESSION;
|
|
13
|
-
this.createdOn =
|
|
14
|
-
this.updatedOn =
|
|
13
|
+
this.createdOn = "";
|
|
14
|
+
this.updatedOn = "";
|
|
15
15
|
this.createdBy = 0;
|
|
16
16
|
this.updatedBy = 0;
|
|
17
17
|
this.organizationId = 0;
|
|
@@ -23,5 +23,10 @@ class ConfigurationsModel {
|
|
|
23
23
|
static findByKey(configurationEntities, key) {
|
|
24
24
|
return configurationEntities.find((configurationEntity) => configurationEntity.key === key);
|
|
25
25
|
}
|
|
26
|
+
static fromApiEntity(apiEntity) {
|
|
27
|
+
const entity = new ConfigurationEntityModel(apiEntity);
|
|
28
|
+
Object.assign(entity, apiEntity);
|
|
29
|
+
return entity;
|
|
30
|
+
}
|
|
26
31
|
}
|
|
27
|
-
exports.
|
|
32
|
+
exports.ConfigurationEntityModel = ConfigurationEntityModel;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { IDesignationApiEntity } from "../interface/designation.entity.interface";
|
|
2
|
+
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
3
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
4
|
+
export declare class DesignationEntityModel extends BaseEntityModel<EntityEnum.DESIGNATION> implements IDesignationApiEntity {
|
|
3
5
|
id: number;
|
|
4
6
|
name: string;
|
|
5
7
|
description?: string;
|
|
6
8
|
createdBy: number;
|
|
7
|
-
createdOn:
|
|
9
|
+
createdOn: string;
|
|
8
10
|
updatedBy: number;
|
|
9
|
-
updatedOn:
|
|
10
|
-
|
|
11
|
+
updatedOn: string;
|
|
12
|
+
static fromApiEntity(apiEntity: IDesignationApiEntity): DesignationEntityModel;
|
|
13
|
+
getRelationConfigs(): any[];
|
|
11
14
|
}
|
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DesignationEntityModel = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
4
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
5
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
class DesignationEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.id = 0;
|
|
10
|
+
this.name = "";
|
|
11
|
+
this.createdBy = 0;
|
|
12
|
+
this.createdOn = "";
|
|
13
|
+
this.updatedBy = 0;
|
|
14
|
+
this.updatedOn = "";
|
|
15
|
+
}
|
|
16
|
+
// constructor(data: IDesignationApiEntity) {
|
|
17
|
+
// this.id = data.id;
|
|
18
|
+
// this.name = data.name;
|
|
19
|
+
// this.description = data.description;
|
|
20
|
+
// this.createdBy = data.createdBy;
|
|
21
|
+
// this.createdOn = data.createdOn;
|
|
22
|
+
// this.updatedBy = data.updatedBy;
|
|
23
|
+
// this.updatedOn = data.updatedOn;
|
|
24
|
+
// }
|
|
25
|
+
static fromApiEntity(apiEntity) {
|
|
26
|
+
const entity = new DesignationEntityModel(entity_utils_interface_1.EntityEnum.DESIGNATION);
|
|
27
|
+
Object.assign(entity, apiEntity);
|
|
28
|
+
return entity;
|
|
29
|
+
}
|
|
30
|
+
getRelationConfigs() {
|
|
31
|
+
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
13
32
|
}
|
|
14
33
|
}
|
|
15
34
|
exports.DesignationEntityModel = DesignationEntityModel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EntityEnum, EntityIndexMap, EntityMap, EnumEntityType, IBaseEntityApiResponse } from "../interface/entity.utils.interface";
|
|
2
|
+
export declare function mapToIndex(entityMap: EntityMap): EntityIndexMap;
|
|
3
|
+
export declare function getEntityIndexMap<T extends EntityEnum>(data: IBaseEntityApiResponse<EnumEntityType<T>>, baseEntity: T, reusedConfig?: {
|
|
4
|
+
existingEntityIndexMap: EntityIndexMap;
|
|
5
|
+
enumEntities: EntityEnum[];
|
|
6
|
+
}): EntityIndexMap;
|
|
7
|
+
export declare function populateRelationsFor(entityIndexMap: EntityIndexMap, enumEntities: EntityEnum[]): void;
|
|
8
|
+
export declare function parseEntities<T extends EnumEntityType<EntityEnum>>(json: IBaseEntityApiResponse<T>, baseEntity: EntityEnum, entityMap: EntityMap): EntityMap;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapToIndex = mapToIndex;
|
|
4
|
+
exports.getEntityIndexMap = getEntityIndexMap;
|
|
5
|
+
exports.populateRelationsFor = populateRelationsFor;
|
|
6
|
+
exports.parseEntities = parseEntities;
|
|
7
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
8
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
9
|
+
const billing_reimbursement_expense_entity_model_1 = require("./billing-reimbursement-expense.entity.model");
|
|
10
|
+
const billing_entity_model_1 = require("./billing.entity.model");
|
|
11
|
+
const client_entity_model_1 = require("./client.entity.model");
|
|
12
|
+
const project_user_mapping_entity_model_1 = require("./project-user-mapping.entity.model");
|
|
13
|
+
const project_entity_model_1 = require("./project.entity.model");
|
|
14
|
+
const reimbursement_expense_entity_model_1 = require("./reimbursement-expense.entity.model");
|
|
15
|
+
const reimbursement_entity_model_1 = require("./reimbursement.entity.model");
|
|
16
|
+
const user_entity_model_1 = require("./user.entity.model");
|
|
17
|
+
function mapToIndex(entityMap) {
|
|
18
|
+
return Object.keys(entityMap).reduce((acc, key) => {
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
acc[key] = entityMap[key].reduce((innerAcc, entity) => {
|
|
21
|
+
innerAcc[entity.id] = entity;
|
|
22
|
+
return innerAcc;
|
|
23
|
+
}, {});
|
|
24
|
+
return acc;
|
|
25
|
+
}, {});
|
|
26
|
+
}
|
|
27
|
+
function getEntityIndexMap(data, baseEntity, reusedConfig) {
|
|
28
|
+
const entityMap = {};
|
|
29
|
+
parseEntities(data, baseEntity, entityMap);
|
|
30
|
+
const entityIndexMap = mapToIndex(entityMap);
|
|
31
|
+
if (reusedConfig) {
|
|
32
|
+
for (const entity of reusedConfig.enumEntities) {
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
entityIndexMap[entity] = reusedConfig.existingEntityIndexMap[entity];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return entityIndexMap;
|
|
38
|
+
}
|
|
39
|
+
function populateRelationsFor(entityIndexMap, enumEntities) {
|
|
40
|
+
enumEntities.forEach((entity) => {
|
|
41
|
+
base_entity_model_1.BaseEntityModel.populateRelationsForEntities(entityIndexMap, entity);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function parseEntities(json, baseEntity, entityMap) {
|
|
45
|
+
var _a;
|
|
46
|
+
const entityFromJsonMappings = {
|
|
47
|
+
[entity_utils_interface_1.EntityEnum.PROJECT]: project_entity_model_1.ProjectEntityModel.fromApiEntity,
|
|
48
|
+
[entity_utils_interface_1.EntityEnum.CLIENT]: client_entity_model_1.ClientEntityModel.fromApiEntity,
|
|
49
|
+
[entity_utils_interface_1.EntityEnum.BILLING]: billing_entity_model_1.BillingEntityModel.fromApiEntity,
|
|
50
|
+
[entity_utils_interface_1.EntityEnum.USER]: user_entity_model_1.UserEntityModel.fromApiEntity,
|
|
51
|
+
[entity_utils_interface_1.EntityEnum.PROJECT_USER_MAPPING]: project_user_mapping_entity_model_1.ProjectUserMappingEntityModel.fromApiEntity,
|
|
52
|
+
[entity_utils_interface_1.EntityEnum.REIMBURSEMENT]: reimbursement_entity_model_1.ReimbursementEntityModel.fromApiEntity,
|
|
53
|
+
[entity_utils_interface_1.EntityEnum.REIMBURSEMENT_EXPENSE]: reimbursement_expense_entity_model_1.ReimbursementExpenseEntityModel.fromApiEntity,
|
|
54
|
+
[entity_utils_interface_1.EntityEnum.BILLING_REIMBURSEMENT_EXPENSE]: billing_reimbursement_expense_entity_model_1.BillingReimbursementExpneseEntityModel.fromApiEntity,
|
|
55
|
+
};
|
|
56
|
+
if (!(baseEntity in entityFromJsonMappings)) {
|
|
57
|
+
throw new Error(`Unknown entity: ${baseEntity}`);
|
|
58
|
+
}
|
|
59
|
+
entityMap[baseEntity] = ((_a = json["baseEntities"]) !== null && _a !== void 0 ? _a : []).map((e) => entityFromJsonMappings[baseEntity](e));
|
|
60
|
+
if (json["relatedEntities"]) {
|
|
61
|
+
const relatedEntities = json["relatedEntities"];
|
|
62
|
+
for (const entityName in relatedEntities) {
|
|
63
|
+
parseEntities(
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
relatedEntities[entityName], entityName, entityMap);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return entityMap;
|
|
69
|
+
}
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { IAuditColumnEntity } from "../interface/audit-column.entity.interface";
|
|
3
|
-
import { IHolidayEntity } from "../interface/holiday.entity.interface";
|
|
4
|
-
export declare class BaseEntityModel<T extends IAuditColumnEntity> {
|
|
5
|
-
createdOn: Date;
|
|
6
|
-
updatedOn: Date;
|
|
7
|
-
createdBy: number;
|
|
8
|
-
updatedBy: number;
|
|
9
|
-
constructor(data: T);
|
|
10
|
-
}
|
|
11
|
-
export declare class HolidayEntityModel extends BaseEntityModel<IHolidayEntity> implements IHolidayEntity {
|
|
12
|
-
id: number;
|
|
13
|
-
holidayListId: number;
|
|
14
|
-
dateCode: string;
|
|
15
|
-
private constructor();
|
|
16
|
-
getDateCodeModel(): DateCodeModel;
|
|
17
|
-
static fromEntity(data: IHolidayEntity): HolidayEntityModel;
|
|
18
|
-
static getDateCodeModelFromDate(models: HolidayEntityModel[]): DateCodeModel[];
|
|
19
|
-
}
|
|
1
|
+
export declare const toBeDeleted = "holiday";
|
|
@@ -1,31 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// import { DateCodeModel } from "../../utils";
|
|
3
|
+
// import { IAuditColumnEntity } from "../interface/audit-column.entity.interface";
|
|
4
|
+
// import { IHolidayEntity } from "../interface/holiday.entity.interface";
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
6
|
+
exports.toBeDeleted = void 0;
|
|
7
|
+
// export class BaseEntityModelV1<T extends IAuditColumnEntity> {
|
|
8
|
+
// createdOn: Date;
|
|
9
|
+
// updatedOn: Date;
|
|
10
|
+
// createdBy: number;
|
|
11
|
+
// updatedBy: number;
|
|
12
|
+
// constructor(data: T) {
|
|
13
|
+
// this.createdOn = data.createdOn;
|
|
14
|
+
// this.updatedOn = data.updatedOn;
|
|
15
|
+
// this.createdBy = data.createdBy;
|
|
16
|
+
// this.updatedBy = data.updatedBy;
|
|
17
|
+
// }
|
|
18
|
+
// }
|
|
19
|
+
// export class HolidayEntityModel
|
|
20
|
+
// extends BaseEntityModelV1<IHolidayEntity>
|
|
21
|
+
// implements IHolidayEntity
|
|
22
|
+
// {
|
|
23
|
+
// id: number;
|
|
24
|
+
// holidayListId: number;
|
|
25
|
+
// dateCode: string;
|
|
26
|
+
// private constructor(data: IHolidayEntity) {
|
|
27
|
+
// super(data);
|
|
28
|
+
// this.id = data.id;
|
|
29
|
+
// this.holidayListId = data.holidayListId;
|
|
30
|
+
// this.dateCode = data.dateCode;
|
|
31
|
+
// }
|
|
32
|
+
// getDateCodeModel(): DateCodeModel {
|
|
33
|
+
// return new DateCodeModel(this.dateCode);
|
|
34
|
+
// }
|
|
35
|
+
// static fromEntity(data: IHolidayEntity): HolidayEntityModel {
|
|
36
|
+
// return new HolidayEntityModel(data);
|
|
37
|
+
// }
|
|
38
|
+
// static getDateCodeModelFromDate(
|
|
39
|
+
// models: HolidayEntityModel[]
|
|
40
|
+
// ): DateCodeModel[] {
|
|
41
|
+
// return models.map((model) => model.getDateCodeModel());
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
|
+
exports.toBeDeleted = "holiday";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { ILeaveApiEntity } from "../../api";
|
|
1
2
|
import { DateCodeModel, Weekday } from "../../utils";
|
|
2
3
|
import { DurationTypeEnum } from "../enums/duration-type.enum";
|
|
3
4
|
import { LeaveTypeEnum } from "../enums/leave-type.enum";
|
|
4
5
|
import { LeaveStatusEnum } from "../enums/leave.status.enum";
|
|
5
|
-
|
|
6
|
-
export declare class LeaveEntityModel implements ILeaveEntity {
|
|
6
|
+
export declare class LeaveEntityModel implements ILeaveApiEntity {
|
|
7
7
|
id: number;
|
|
8
8
|
employeeId: number;
|
|
9
9
|
fromDate: string;
|
|
@@ -13,12 +13,12 @@ export declare class LeaveEntityModel implements ILeaveEntity {
|
|
|
13
13
|
status: LeaveStatusEnum;
|
|
14
14
|
remark?: string;
|
|
15
15
|
type: LeaveTypeEnum;
|
|
16
|
-
createdOn:
|
|
17
|
-
updatedOn:
|
|
16
|
+
createdOn: string;
|
|
17
|
+
updatedOn: string;
|
|
18
18
|
createdBy: number;
|
|
19
19
|
updatedBy: number;
|
|
20
20
|
private constructor();
|
|
21
|
-
static fromEntity(data:
|
|
21
|
+
static fromEntity(data: ILeaveApiEntity): LeaveEntityModel;
|
|
22
22
|
isMoreThanOneDayLeave(): boolean;
|
|
23
23
|
getLeaveDuration(excludeWeekdays?: Weekday[], excludeDates?: DateCodeModel[]): number;
|
|
24
24
|
static getLeaveDuration(leaves: LeaveEntityModel[], excludeWeekdays?: Weekday[], excludeDates?: DateCodeModel[], leaveStatusEnum?: LeaveStatusEnum[]): number;
|
|
@@ -6,6 +6,8 @@ const duration_type_enum_1 = require("../enums/duration-type.enum");
|
|
|
6
6
|
const leave_status_enum_1 = require("../enums/leave.status.enum");
|
|
7
7
|
class LeaveEntityModel {
|
|
8
8
|
constructor(data) {
|
|
9
|
+
this.createdOn = "";
|
|
10
|
+
this.updatedOn = "";
|
|
9
11
|
this.id = data.id;
|
|
10
12
|
this.employeeId = data.employeeId;
|
|
11
13
|
this.fromDate = data.fromDate;
|
|
@@ -41,7 +43,8 @@ class LeaveEntityModel {
|
|
|
41
43
|
if (this.durationType === duration_type_enum_1.DurationTypeEnum.SECOND_FIRST) {
|
|
42
44
|
return count - 1;
|
|
43
45
|
}
|
|
44
|
-
if (this.durationType === duration_type_enum_1.DurationTypeEnum.FULL_FIRST ||
|
|
46
|
+
if (this.durationType === duration_type_enum_1.DurationTypeEnum.FULL_FIRST ||
|
|
47
|
+
this.durationType === duration_type_enum_1.DurationTypeEnum.SECOND_FULL) {
|
|
45
48
|
return count - 0.5;
|
|
46
49
|
}
|
|
47
50
|
return count;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IProjectUserMappingApiEntity } from "../../api";
|
|
2
|
+
import { ProjectUserStatusEnum } from "../enums/project_user_status.enum";
|
|
3
|
+
import { EntityEnum, EnumEntityType, IEntityApiResponse } from "../interface/entity.utils.interface";
|
|
4
|
+
import { IProjectUserMappingEntity } from "../interface/project.entity.interface";
|
|
5
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
6
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
7
|
+
import { ProjectEntityModel } from "./project.entity.model";
|
|
8
|
+
import { UserEntityModel } from "./user.entity.model";
|
|
9
|
+
export declare class ProjectUserMappingEntityModel extends BaseEntityModel<EntityEnum.PROJECT_USER_MAPPING> implements IProjectUserMappingApiEntity {
|
|
10
|
+
id: number;
|
|
11
|
+
projectId: number;
|
|
12
|
+
userId: number;
|
|
13
|
+
status: ProjectUserStatusEnum;
|
|
14
|
+
createdOn: string;
|
|
15
|
+
updatedOn: string;
|
|
16
|
+
createdBy: number;
|
|
17
|
+
updatedBy: number;
|
|
18
|
+
user?: UserEntityModel;
|
|
19
|
+
project?: ProjectEntityModel;
|
|
20
|
+
static fromApiEntity(apiEntity: IEntityApiResponse<IProjectUserMappingEntity>): ProjectUserMappingEntityModel;
|
|
21
|
+
static relationConfigs: RelationConfigs<[
|
|
22
|
+
EntityEnum.USER,
|
|
23
|
+
EntityEnum.PROJECT
|
|
24
|
+
], EnumEntityType<EntityEnum.PROJECT_USER_MAPPING>>;
|
|
25
|
+
getRelationConfigs(): [import("../interface/relation-config.interface").IRelationConfig<EntityEnum.USER, EnumEntityType<EntityEnum.PROJECT_USER_MAPPING>>, import("../interface/relation-config.interface").IRelationConfig<EntityEnum.PROJECT, EnumEntityType<EntityEnum.PROJECT_USER_MAPPING>>];
|
|
26
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectUserMappingEntityModel = void 0;
|
|
4
|
+
const project_user_status_enum_1 = require("../enums/project_user_status.enum");
|
|
5
|
+
const relation_type_enum_1 = require("../enums/relation-type.enum");
|
|
6
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
7
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
8
|
+
class ProjectUserMappingEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.id = 0;
|
|
12
|
+
this.projectId = 0;
|
|
13
|
+
this.userId = 0;
|
|
14
|
+
this.status = project_user_status_enum_1.ProjectUserStatusEnum.ACTIVE;
|
|
15
|
+
this.createdOn = "";
|
|
16
|
+
this.updatedOn = "";
|
|
17
|
+
this.createdBy = 0;
|
|
18
|
+
this.updatedBy = 0;
|
|
19
|
+
}
|
|
20
|
+
static fromApiEntity(apiEntity) {
|
|
21
|
+
const entity = new ProjectUserMappingEntityModel(entity_utils_interface_1.EntityEnum.PROJECT_USER_MAPPING);
|
|
22
|
+
Object.assign(entity, apiEntity);
|
|
23
|
+
return entity;
|
|
24
|
+
}
|
|
25
|
+
getRelationConfigs() {
|
|
26
|
+
return ProjectUserMappingEntityModel.relationConfigs;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ProjectUserMappingEntityModel = ProjectUserMappingEntityModel;
|
|
30
|
+
ProjectUserMappingEntityModel.relationConfigs = [
|
|
31
|
+
{
|
|
32
|
+
name: entity_utils_interface_1.EntityEnum.USER,
|
|
33
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
34
|
+
key: "user",
|
|
35
|
+
mapKeyConfig: {
|
|
36
|
+
relationKey: "id",
|
|
37
|
+
key: "userId",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: entity_utils_interface_1.EntityEnum.PROJECT,
|
|
42
|
+
relation: relation_type_enum_1.RelationType.ONE,
|
|
43
|
+
key: "project",
|
|
44
|
+
mapKeyConfig: {
|
|
45
|
+
relationKey: "id",
|
|
46
|
+
key: "projectId",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IProjectApiEntity } from "../../api";
|
|
2
|
+
import { CurrencyEnum } from "../../enums";
|
|
3
|
+
import { ProjectBillingTypeEnum, ProjectStatusEnum } from "../enums/project.entity.enum";
|
|
4
|
+
import { EntityEnum, EnumEntityType } from "../interface/entity.utils.interface";
|
|
5
|
+
import { IProjectUserDto } from "../interface/project.entity.interface";
|
|
6
|
+
import { RelationConfigs } from "../interface/relation-config.interface";
|
|
7
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
8
|
+
import { ClientEntityModel } from "./client.entity.model";
|
|
9
|
+
import { ProjectUserMappingEntityModel } from "./project-user-mapping.entity.model";
|
|
10
|
+
import { UserEntityModel } from "./user.entity.model";
|
|
11
|
+
export declare class ProjectEntityModel extends BaseEntityModel<EntityEnum.PROJECT> implements IProjectApiEntity {
|
|
12
|
+
id: number;
|
|
13
|
+
name: string;
|
|
14
|
+
clientId: number;
|
|
15
|
+
startDate: string;
|
|
16
|
+
currency: CurrencyEnum;
|
|
17
|
+
billingType: ProjectBillingTypeEnum;
|
|
18
|
+
billingRate: string;
|
|
19
|
+
status: ProjectStatusEnum;
|
|
20
|
+
organizationId: number;
|
|
21
|
+
description?: string;
|
|
22
|
+
expectedEndDate?: string;
|
|
23
|
+
actualEndDate?: string;
|
|
24
|
+
createdBy: number;
|
|
25
|
+
updatedBy: number;
|
|
26
|
+
createdOn: string;
|
|
27
|
+
updatedOn: string;
|
|
28
|
+
users?: IProjectUserDto[];
|
|
29
|
+
billingOverdueDays?: number;
|
|
30
|
+
userMappings?: (UserEntityModel & ProjectUserMappingEntityModel)[];
|
|
31
|
+
projectUserMappings?: ProjectUserMappingEntityModel[];
|
|
32
|
+
client: ClientEntityModel;
|
|
33
|
+
static fromApiEntity(apiEntity: IProjectApiEntity): ProjectEntityModel;
|
|
34
|
+
static relationConfigs: RelationConfigs<[
|
|
35
|
+
EntityEnum.PROJECT_USER_MAPPING,
|
|
36
|
+
EntityEnum.CLIENT
|
|
37
|
+
], EnumEntityType<EntityEnum.PROJECT>>;
|
|
38
|
+
populateUsers(users: UserEntityModel[], projectUserMapping: ProjectUserMappingEntityModel[]): void;
|
|
39
|
+
getRelationConfigs(): [import("../interface/relation-config.interface").IRelationConfig<EntityEnum.PROJECT_USER_MAPPING, EnumEntityType<EntityEnum.PROJECT>>, import("../interface/relation-config.interface").IRelationConfig<EntityEnum.CLIENT, EnumEntityType<EntityEnum.PROJECT>>];
|
|
40
|
+
}
|