law-common 10.28.1-beta.0 → 10.28.1
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 +5 -0
- package/dist/src/api/interface/address-book.create.dto.interface.d.ts +19 -0
- package/dist/src/api/interface/address-book.create.dto.interface.js +2 -0
- package/dist/src/api/interface/timesheet.entity.response.interface.d.ts +0 -1
- package/dist/src/api/interface/timesheet.entity.response.interface.js +0 -4
- package/dist/src/entities/index.d.ts +3 -0
- package/dist/src/entities/index.js +3 -0
- package/dist/src/entities/interface/address-book.entity.interface.d.ts +10 -0
- package/dist/src/entities/interface/address-book.entity.interface.js +2 -0
- package/dist/src/entities/interface/entity.utils.interface.d.ts +6 -3
- package/dist/src/entities/interface/entity.utils.interface.js +1 -0
- package/dist/src/entities/model/country.entity.model.d.ts +11 -0
- package/dist/src/entities/model/country.entity.model.js +21 -0
- package/dist/src/entities/model/entity.model.interface.d.ts +4 -5
- package/dist/src/entities/model/entity.model.interface.js +37 -39
- package/package.json +1 -1
package/dist/src/api/index.d.ts
CHANGED
|
@@ -48,3 +48,4 @@ export * from "./interface/work.from.home.create.dto.interface";
|
|
|
48
48
|
export * from "./interface/work.from.home.update.interface";
|
|
49
49
|
export * from "./interface/cron-job-manual-trigger.dto.interface";
|
|
50
50
|
export * from "./interface/cron-job.entity.response";
|
|
51
|
+
export * from "./interface/address-book.create.dto.interface";
|
package/dist/src/api/index.js
CHANGED
|
@@ -64,3 +64,8 @@ __exportStar(require("./interface/work.from.home.create.dto.interface"), exports
|
|
|
64
64
|
__exportStar(require("./interface/work.from.home.update.interface"), exports);
|
|
65
65
|
__exportStar(require("./interface/cron-job-manual-trigger.dto.interface"), exports);
|
|
66
66
|
__exportStar(require("./interface/cron-job.entity.response"), exports);
|
|
67
|
+
// export * from "./interface/to-do.entity.api";
|
|
68
|
+
// export * from "./interface/billing-reimbursement-expense.api";
|
|
69
|
+
// export * from "./interface/billing-reimbursement-expense-history.api";
|
|
70
|
+
// export * from "./interface/project-user-mapping.entity.api";
|
|
71
|
+
__exportStar(require("./interface/address-book.create.dto.interface"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IAddressBookEntity, IEntityCreateDto } from "../../entities";
|
|
2
|
+
export type IAddressBookCreateExclude = "contactDetails" | "address" | "organizationId";
|
|
3
|
+
export interface IAddressBookContactDetail {
|
|
4
|
+
id?: number;
|
|
5
|
+
name: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
phone?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IAddressBookAddress {
|
|
10
|
+
addressLine1?: string;
|
|
11
|
+
addressLine2?: string;
|
|
12
|
+
city?: string;
|
|
13
|
+
state?: string;
|
|
14
|
+
zipCode?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface IAddressBookCreateDto extends Omit<IEntityCreateDto<IAddressBookEntity>, IAddressBookCreateExclude> {
|
|
17
|
+
contactDetails: IAddressBookContactDetail[];
|
|
18
|
+
address?: IAddressBookAddress;
|
|
19
|
+
}
|
|
@@ -64,6 +64,7 @@ export * from "./interface/billing_timesheet.entity.interface";
|
|
|
64
64
|
export * from "./interface/intermediary_bank.entity.interface";
|
|
65
65
|
export * from "./interface/holiday-list.entity.interface";
|
|
66
66
|
export * from "./interface/holiday.entity.interface";
|
|
67
|
+
export * from "./interface/address-book.entity.interface";
|
|
67
68
|
export * from "./model/leave.entity.model";
|
|
68
69
|
export * from "./model/leave_count.entity.model";
|
|
69
70
|
export * from "./model/holiday.entity.model";
|
|
@@ -97,8 +98,10 @@ export * from "./model/timesheet.entity.model";
|
|
|
97
98
|
export * from "./model/user.entity.model";
|
|
98
99
|
export * from "./model/client-affiliate.entity.model";
|
|
99
100
|
export * from "./model/billing-timesheet.entity.model";
|
|
101
|
+
export * from "./model/country.entity.model";
|
|
100
102
|
export * from "./interface/entity-audit-columns.interface";
|
|
101
103
|
export * from "./enums/billing-transaction-action.enum";
|
|
102
104
|
export * from "./enums/billing-transaction-status.enum";
|
|
103
105
|
export * from "./interface/billing-transaction-history.entity";
|
|
104
106
|
export * from "./model/billing-transaction.model";
|
|
107
|
+
export * from "./interface/address-book.entity.interface";
|
|
@@ -80,6 +80,7 @@ __exportStar(require("./interface/billing_timesheet.entity.interface"), exports)
|
|
|
80
80
|
__exportStar(require("./interface/intermediary_bank.entity.interface"), exports);
|
|
81
81
|
__exportStar(require("./interface/holiday-list.entity.interface"), exports);
|
|
82
82
|
__exportStar(require("./interface/holiday.entity.interface"), exports);
|
|
83
|
+
__exportStar(require("./interface/address-book.entity.interface"), exports);
|
|
83
84
|
__exportStar(require("./model/leave.entity.model"), exports);
|
|
84
85
|
__exportStar(require("./model/leave_count.entity.model"), exports);
|
|
85
86
|
__exportStar(require("./model/holiday.entity.model"), exports);
|
|
@@ -113,8 +114,10 @@ __exportStar(require("./model/timesheet.entity.model"), exports);
|
|
|
113
114
|
__exportStar(require("./model/user.entity.model"), exports);
|
|
114
115
|
__exportStar(require("./model/client-affiliate.entity.model"), exports);
|
|
115
116
|
__exportStar(require("./model/billing-timesheet.entity.model"), exports);
|
|
117
|
+
__exportStar(require("./model/country.entity.model"), exports);
|
|
116
118
|
__exportStar(require("./interface/entity-audit-columns.interface"), exports);
|
|
117
119
|
__exportStar(require("./enums/billing-transaction-action.enum"), exports);
|
|
118
120
|
__exportStar(require("./enums/billing-transaction-status.enum"), exports);
|
|
119
121
|
__exportStar(require("./interface/billing-transaction-history.entity"), exports);
|
|
120
122
|
__exportStar(require("./model/billing-transaction.model"), exports);
|
|
123
|
+
__exportStar(require("./interface/address-book.entity.interface"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-columns.interface";
|
|
2
|
+
export interface IAddressBookEntity extends IEntityAuditColumn {
|
|
3
|
+
id: number;
|
|
4
|
+
contactDetails: string;
|
|
5
|
+
address?: string;
|
|
6
|
+
country: string;
|
|
7
|
+
notes?: string;
|
|
8
|
+
organizationId: number;
|
|
9
|
+
introducedBy?: number;
|
|
10
|
+
}
|
|
@@ -11,6 +11,7 @@ import { BillingEntityModel } from "../model/billing.entity.model";
|
|
|
11
11
|
import { ClientAffiliateEntityModel } from "../model/client-affiliate.entity.model";
|
|
12
12
|
import { ClientEntityModel } from "../model/client.entity.model";
|
|
13
13
|
import { ConfigurationEntityModel } from "../model/configuration.model";
|
|
14
|
+
import { CountryEntityModel } from "../model/country.entity.model";
|
|
14
15
|
import { HolidayEntityModel } from "../model/holiday.entity.model";
|
|
15
16
|
import { LeaveEntityModel } from "../model/leave.entity.model";
|
|
16
17
|
import { LeaveCountVirtualEntityModel } from "../model/leave_count.entity.model";
|
|
@@ -21,6 +22,7 @@ import { ReimbursementEntityModel } from "../model/reimbursement.entity.model";
|
|
|
21
22
|
import { TaskEntityModel } from "../model/task.entity.model";
|
|
22
23
|
import { TimesheetEntityModel } from "../model/timesheet.entity.model";
|
|
23
24
|
import { UserEntityModel } from "../model/user.entity.model";
|
|
25
|
+
import { IAddressBookEntity } from "./address-book.entity.interface";
|
|
24
26
|
import { IAuditColumnEntity } from "./audit-column.entity.interface";
|
|
25
27
|
import { IBankEntity } from "./bank.entity.interface";
|
|
26
28
|
import { IBankHistoryEntity } from "./bank_history.entity.interface";
|
|
@@ -140,7 +142,8 @@ export declare enum EntityEnum {
|
|
|
140
142
|
HOLIDAY = "holiday",
|
|
141
143
|
HOLIDAY_LIST = "holiday_list",
|
|
142
144
|
CRON_JOBS = "cron_jobs",
|
|
143
|
-
TO_DO_LIST = "to_do_list"
|
|
145
|
+
TO_DO_LIST = "to_do_list",
|
|
146
|
+
ADDRESS_BOOK = "address_book"
|
|
144
147
|
}
|
|
145
148
|
export type EntityRelations = {
|
|
146
149
|
[K in EntityEnum | VirtualEntityEnum]: K;
|
|
@@ -159,7 +162,7 @@ export type IBaseEntityApiResponse<T> = {
|
|
|
159
162
|
[K in EntityEnum | VirtualEntityEnum]?: IBaseEntityApiResponse<EnumEntityType<K>>;
|
|
160
163
|
};
|
|
161
164
|
};
|
|
162
|
-
export type EnumEntityType<T extends EntityEnum | VirtualEntityEnum> = (T extends EntityEnum.BILLING ? IBillingEntity : T extends EntityEnum.BILLING_TIMESHEET ? IBillingTimesheetEntity : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? IBillingReimbursementExpenseEntity : T extends EntityEnum.TIMESHEET ? ITimesheetEntity : T extends EntityEnum.USER ? IUserEntity : T extends EntityEnum.PROJECT ? IProjectEntity : T extends EntityEnum.CLIENT ? IClientEntity : T extends EntityEnum.LEAVE ? ILeaveEntity : T extends EntityEnum.BANK ? IBankEntity : T extends EntityEnum.BILLING_PAYMENT ? IBillingPaymentEntity : T extends EntityEnum.BILLING_TRANSACTION ? IBillingTransactionEntity : T extends EntityEnum.BILLING_TRANSACTION_HISTORY ? IBillingTransactionHistoryEntity : T extends EntityEnum.CLIENT_AFFILIATE ? IClientAffiliateEntity : T extends EntityEnum.CONFIGURATION ? IConfigurationEntity : T extends EntityEnum.HOLIDAY ? IHolidayEntity : T extends EntityEnum.HOLIDAY_LIST ? IHolidayListEntity : T extends EntityEnum.COUNTRY ? ICountryEntity : T extends EntityEnum.EXPENSE_TYPE ? IExpenseTypeEntity : T extends EntityEnum.INDUSTRY ? IIndustryEntity : T extends EntityEnum.INTERMEDIARY_BANK ? IIntermediaryBankEntity : T extends EntityEnum.OFFICE_LOCATION ? IOfficeLocationEntity : T extends EntityEnum.PERMISSION ? IPermissionEntity : T extends EntityEnum.ROLE ? IRoleEntity : T extends EntityEnum.TASK ? ITaskEntity : T extends EntityEnum.DESIGNATION ? IDesignationEntity : T extends EntityEnum.RATE ? IRateEntity : T extends EntityEnum.REIMBURSEMENT ? IReimbursementEntity : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? IReimbursementExpenseEntity : T extends EntityEnum.WORK_FROM_HOME ? IWorkFromHomeEntity : T extends EntityEnum.ORGANIZATION ? IOrganizationEntity : T extends EntityEnum.PROJECT_USER_MAPPING ? IProjectUserMappingEntity : T extends EntityEnum.CLIENT_USER_MAPPING ? IClientUserMappingEntity : T extends EntityEnum.TO_DO_LIST ? IToDoListEntity : T extends EntityEnum.CRON_JOBS ? ICronJobsEntity : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : T extends EntityEnum.BANK_HISTORY ? IBankHistoryEntity : T extends VirtualEntityEnum.LEAVE_COUNT ? ILeaveCountVirtualEntity : T extends EntityEnum.LEAVE_HISTORY ? ILeaveHistoryEntity : T extends EntityEnum.WORK_FROM_HOME_HISTORY ? IWorkFromHomeHistoryEntity : T extends EntityEnum.TIMESHEET_HISTORY ? ITimesheetHistoryEntity : never) & {
|
|
165
|
+
export type EnumEntityType<T extends EntityEnum | VirtualEntityEnum> = (T extends EntityEnum.BILLING ? IBillingEntity : T extends EntityEnum.BILLING_TIMESHEET ? IBillingTimesheetEntity : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? IBillingReimbursementExpenseEntity : T extends EntityEnum.TIMESHEET ? ITimesheetEntity : T extends EntityEnum.USER ? IUserEntity : T extends EntityEnum.PROJECT ? IProjectEntity : T extends EntityEnum.CLIENT ? IClientEntity : T extends EntityEnum.LEAVE ? ILeaveEntity : T extends EntityEnum.BANK ? IBankEntity : T extends EntityEnum.BILLING_PAYMENT ? IBillingPaymentEntity : T extends EntityEnum.BILLING_TRANSACTION ? IBillingTransactionEntity : T extends EntityEnum.BILLING_TRANSACTION_HISTORY ? IBillingTransactionHistoryEntity : T extends EntityEnum.CLIENT_AFFILIATE ? IClientAffiliateEntity : T extends EntityEnum.CONFIGURATION ? IConfigurationEntity : T extends EntityEnum.HOLIDAY ? IHolidayEntity : T extends EntityEnum.HOLIDAY_LIST ? IHolidayListEntity : T extends EntityEnum.COUNTRY ? ICountryEntity : T extends EntityEnum.EXPENSE_TYPE ? IExpenseTypeEntity : T extends EntityEnum.INDUSTRY ? IIndustryEntity : T extends EntityEnum.INTERMEDIARY_BANK ? IIntermediaryBankEntity : T extends EntityEnum.OFFICE_LOCATION ? IOfficeLocationEntity : T extends EntityEnum.PERMISSION ? IPermissionEntity : T extends EntityEnum.ROLE ? IRoleEntity : T extends EntityEnum.TASK ? ITaskEntity : T extends EntityEnum.DESIGNATION ? IDesignationEntity : T extends EntityEnum.RATE ? IRateEntity : T extends EntityEnum.REIMBURSEMENT ? IReimbursementEntity : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? IReimbursementExpenseEntity : T extends EntityEnum.WORK_FROM_HOME ? IWorkFromHomeEntity : T extends EntityEnum.ORGANIZATION ? IOrganizationEntity : T extends EntityEnum.PROJECT_USER_MAPPING ? IProjectUserMappingEntity : T extends EntityEnum.CLIENT_USER_MAPPING ? IClientUserMappingEntity : T extends EntityEnum.TO_DO_LIST ? IToDoListEntity : T extends EntityEnum.CRON_JOBS ? ICronJobsEntity : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? IRolePermissionMappingEntity : T extends EntityEnum.BANK_HISTORY ? IBankHistoryEntity : T extends VirtualEntityEnum.LEAVE_COUNT ? ILeaveCountVirtualEntity : T extends EntityEnum.LEAVE_HISTORY ? ILeaveHistoryEntity : T extends EntityEnum.WORK_FROM_HOME_HISTORY ? IWorkFromHomeHistoryEntity : T extends EntityEnum.TIMESHEET_HISTORY ? ITimesheetHistoryEntity : T extends EntityEnum.ADDRESS_BOOK ? IAddressBookEntity : never) & {
|
|
163
166
|
id: number;
|
|
164
167
|
};
|
|
165
168
|
export type EntityRelationConfig<T extends EntityEnum | VirtualEntityEnum> = {
|
|
@@ -282,7 +285,7 @@ export declare enum VirtualEntityEnum {
|
|
|
282
285
|
}
|
|
283
286
|
export type IHistoryConstraintSearchResponse<T> = IBaseResponse<IHistoryEntitySearchByConstraintResponse<T>[]>;
|
|
284
287
|
export type IHistoryConstraintSearchServiceResponse<T> = IHistoryEntitySearchByConstraintResponse<T>[];
|
|
285
|
-
export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.PROJECT ? ProjectEntityModel : T extends EntityEnum.PROJECT_USER_MAPPING ? ProjectUserMappingEntityModel : T extends EntityEnum.REIMBURSEMENT ? ReimbursementEntityModel : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? ReimbursementExpenseEntityModel : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? BillingReimbursementExpneseEntityModel : T extends EntityEnum.LEAVE ? LeaveEntityModel : T extends EntityEnum.HOLIDAY ? HolidayEntityModel : T extends VirtualEntityEnum.LEAVE_COUNT ? LeaveCountVirtualEntityModel : T extends EntityEnum.CLIENT_AFFILIATE ? ClientAffiliateEntityModel : T extends EntityEnum.BANK ? BankEntityModel : T extends EntityEnum.CONFIGURATION ? ConfigurationEntityModel : T extends EntityEnum.TASK ? TaskEntityModel : T extends EntityEnum.BILLING_TIMESHEET ? BillingTimesheetEntityModel : T extends EntityEnum.TIMESHEET ? TimesheetEntityModel : T extends EntityEnum.BILLING_TRANSACTION ? BillingTransactionEntityModel : UserEntityModel;
|
|
288
|
+
export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.PROJECT ? ProjectEntityModel : T extends EntityEnum.PROJECT_USER_MAPPING ? ProjectUserMappingEntityModel : T extends EntityEnum.REIMBURSEMENT ? ReimbursementEntityModel : T extends EntityEnum.REIMBURSEMENT_EXPENSE ? ReimbursementExpenseEntityModel : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? BillingReimbursementExpneseEntityModel : T extends EntityEnum.LEAVE ? LeaveEntityModel : T extends EntityEnum.HOLIDAY ? HolidayEntityModel : T extends VirtualEntityEnum.LEAVE_COUNT ? LeaveCountVirtualEntityModel : T extends EntityEnum.CLIENT_AFFILIATE ? ClientAffiliateEntityModel : T extends EntityEnum.BANK ? BankEntityModel : T extends EntityEnum.CONFIGURATION ? ConfigurationEntityModel : T extends EntityEnum.TASK ? TaskEntityModel : T extends EntityEnum.BILLING_TIMESHEET ? BillingTimesheetEntityModel : T extends EntityEnum.TIMESHEET ? TimesheetEntityModel : T extends EntityEnum.COUNTRY ? CountryEntityModel : T extends EntityEnum.BILLING_TRANSACTION ? BillingTransactionEntityModel : UserEntityModel;
|
|
286
289
|
export type EntityMap = {
|
|
287
290
|
[key in EntityEnum | VirtualEntityEnum]: EnumToModel<key>[];
|
|
288
291
|
};
|
|
@@ -77,6 +77,7 @@ var EntityEnum;
|
|
|
77
77
|
EntityEnum["HOLIDAY_LIST"] = "holiday_list";
|
|
78
78
|
EntityEnum["CRON_JOBS"] = "cron_jobs";
|
|
79
79
|
EntityEnum["TO_DO_LIST"] = "to_do_list";
|
|
80
|
+
EntityEnum["ADDRESS_BOOK"] = "address_book";
|
|
80
81
|
})(EntityEnum || (exports.EntityEnum = EntityEnum = {}));
|
|
81
82
|
var VirtualEntityEnum;
|
|
82
83
|
(function (VirtualEntityEnum) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ICountryEntity } from "../interface/country.entity.interface";
|
|
2
|
+
export declare class CountryEntityModel implements ICountryEntity {
|
|
3
|
+
id: number;
|
|
4
|
+
name: string;
|
|
5
|
+
createdBy: number;
|
|
6
|
+
updatedBy: number;
|
|
7
|
+
createdOn: number;
|
|
8
|
+
updatedOn: number;
|
|
9
|
+
constructor(data?: ICountryEntity);
|
|
10
|
+
static fromApiEntity(apiEntity: ICountryEntity): CountryEntityModel;
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// import { ICountryApiEntity } from "../../api";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CountryEntityModel = void 0;
|
|
5
|
+
class CountryEntityModel {
|
|
6
|
+
constructor(data) {
|
|
7
|
+
this.id = 0;
|
|
8
|
+
this.name = "";
|
|
9
|
+
this.createdBy = 0;
|
|
10
|
+
this.updatedBy = 0;
|
|
11
|
+
this.createdOn = 0;
|
|
12
|
+
this.updatedOn = 0;
|
|
13
|
+
Object.assign(this, data);
|
|
14
|
+
}
|
|
15
|
+
static fromApiEntity(apiEntity) {
|
|
16
|
+
const entity = new CountryEntityModel(apiEntity);
|
|
17
|
+
Object.assign(entity, apiEntity);
|
|
18
|
+
return entity;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.CountryEntityModel = CountryEntityModel;
|
|
@@ -5,13 +5,12 @@ export declare function getEntityIndexMap<T extends EntityEnum>(data: IBaseEntit
|
|
|
5
5
|
enumEntities: EntityEnum[];
|
|
6
6
|
}): EntityIndexMap;
|
|
7
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;
|
|
9
8
|
export declare const entityEnumToEntityModel: {
|
|
10
|
-
[E in EntityEnum | VirtualEntityEnum]?: (json:
|
|
11
|
-
createdOn: number;
|
|
12
|
-
updatedOn: number;
|
|
13
|
-
}) => EnumToModel<E>;
|
|
9
|
+
[E in EntityEnum | VirtualEntityEnum]?: (json: EnumEntityType<E>) => EnumToModel<E>;
|
|
14
10
|
};
|
|
11
|
+
export declare function entityMapToModels(entityMap: EntityMap): void;
|
|
12
|
+
export declare function parseEntities<T extends EnumEntityType<EntityEnum | VirtualEntityEnum>>(json: IBaseEntityApiResponse<T>, baseEntity: EntityEnum | VirtualEntityEnum, entityMap: EntityMap): EntityMap;
|
|
13
|
+
export declare function entityMapToEntityIndexMap(entityMap: EntityMap, entityRelationsFor: EntityEnum[]): EntityIndexMap;
|
|
15
14
|
export declare function parseEntitiesWithoutModels<T extends EnumEntityType<EntityEnum | VirtualEntityEnum>>(json: IBaseEntityApiResponse<T>, baseEntity: EntityEnum | VirtualEntityEnum, entityMap?: {
|
|
16
15
|
[E in EntityEnum | VirtualEntityEnum]?: IApiEntity<EnumEntityType<E>>[];
|
|
17
16
|
}): {
|
|
@@ -4,21 +4,22 @@ exports.entityEnumToEntityModel = void 0;
|
|
|
4
4
|
exports.mapToIndex = mapToIndex;
|
|
5
5
|
exports.getEntityIndexMap = getEntityIndexMap;
|
|
6
6
|
exports.populateRelationsFor = populateRelationsFor;
|
|
7
|
+
exports.entityMapToModels = entityMapToModels;
|
|
7
8
|
exports.parseEntities = parseEntities;
|
|
9
|
+
exports.entityMapToEntityIndexMap = entityMapToEntityIndexMap;
|
|
8
10
|
exports.parseEntitiesWithoutModels = parseEntitiesWithoutModels;
|
|
9
11
|
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
10
12
|
const bank_entity_model_1 = require("./bank.entity.model");
|
|
11
13
|
const base_entity_model_1 = require("./base.entity.model");
|
|
12
14
|
const billing_reimbursement_expense_entity_model_1 = require("./billing-reimbursement-expense.entity.model");
|
|
13
15
|
const billing_timesheet_entity_model_1 = require("./billing-timesheet.entity.model");
|
|
14
|
-
const billing_transaction_model_1 = require("./billing-transaction.model");
|
|
15
16
|
const billing_entity_model_1 = require("./billing.entity.model");
|
|
16
17
|
const client_affiliate_entity_model_1 = require("./client-affiliate.entity.model");
|
|
17
18
|
const client_entity_model_1 = require("./client.entity.model");
|
|
18
|
-
const configuration_model_1 = require("./configuration.model");
|
|
19
19
|
const holiday_entity_model_1 = require("./holiday.entity.model");
|
|
20
20
|
const leave_entity_model_1 = require("./leave.entity.model");
|
|
21
21
|
const leave_count_entity_model_1 = require("./leave_count.entity.model");
|
|
22
|
+
const configuration_model_1 = require("./configuration.model");
|
|
22
23
|
const project_user_mapping_entity_model_1 = require("./project-user-mapping.entity.model");
|
|
23
24
|
const project_entity_model_1 = require("./project.entity.model");
|
|
24
25
|
const reimbursement_expense_entity_model_1 = require("./reimbursement-expense.entity.model");
|
|
@@ -26,6 +27,7 @@ const reimbursement_entity_model_1 = require("./reimbursement.entity.model");
|
|
|
26
27
|
const task_entity_model_1 = require("./task.entity.model");
|
|
27
28
|
const timesheet_entity_model_1 = require("./timesheet.entity.model");
|
|
28
29
|
const user_entity_model_1 = require("./user.entity.model");
|
|
30
|
+
const country_entity_model_1 = require("./country.entity.model");
|
|
29
31
|
function mapToIndex(entityMap) {
|
|
30
32
|
return Object.keys(entityMap).reduce((acc, key) => {
|
|
31
33
|
// @ts-ignore
|
|
@@ -53,41 +55,6 @@ function populateRelationsFor(entityIndexMap, enumEntities) {
|
|
|
53
55
|
base_entity_model_1.BaseEntityModel.populateRelationsForEntities(entityIndexMap, entity);
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
|
-
function parseEntities(json, baseEntity, entityMap) {
|
|
57
|
-
var _a;
|
|
58
|
-
const entityFromJsonMappings = {
|
|
59
|
-
[entity_utils_interface_1.EntityEnum.PROJECT]: project_entity_model_1.ProjectEntityModel.fromEntity,
|
|
60
|
-
[entity_utils_interface_1.EntityEnum.CLIENT]: client_entity_model_1.ClientEntityModel.fromEntity,
|
|
61
|
-
[entity_utils_interface_1.EntityEnum.BILLING]: billing_entity_model_1.BillingEntityModel.fromEntity,
|
|
62
|
-
[entity_utils_interface_1.EntityEnum.USER]: user_entity_model_1.UserEntityModel.fromEntity,
|
|
63
|
-
[entity_utils_interface_1.EntityEnum.PROJECT_USER_MAPPING]: project_user_mapping_entity_model_1.ProjectUserMappingEntityModel.fromEntity,
|
|
64
|
-
[entity_utils_interface_1.EntityEnum.REIMBURSEMENT]: reimbursement_entity_model_1.ReimbursementEntityModel.fromEntity,
|
|
65
|
-
[entity_utils_interface_1.EntityEnum.REIMBURSEMENT_EXPENSE]: reimbursement_expense_entity_model_1.ReimbursementExpenseEntityModel.fromEntity,
|
|
66
|
-
[entity_utils_interface_1.EntityEnum.BILLING_REIMBURSEMENT_EXPENSE]: billing_reimbursement_expense_entity_model_1.BillingReimbursementExpneseEntityModel.fromEntity,
|
|
67
|
-
[entity_utils_interface_1.EntityEnum.CLIENT_AFFILIATE]: client_affiliate_entity_model_1.ClientAffiliateEntityModel.fromEntity,
|
|
68
|
-
[entity_utils_interface_1.EntityEnum.BANK]: bank_entity_model_1.BankEntityModel.fromEntity,
|
|
69
|
-
[entity_utils_interface_1.EntityEnum.CONFIGURATION]: configuration_model_1.ConfigurationEntityModel.fromEntity,
|
|
70
|
-
[entity_utils_interface_1.EntityEnum.TASK]: task_entity_model_1.TaskEntityModel.fromEntity,
|
|
71
|
-
[entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET]: billing_timesheet_entity_model_1.BillingTimesheetEntityModel.fromEntity,
|
|
72
|
-
[entity_utils_interface_1.EntityEnum.TIMESHEET]: timesheet_entity_model_1.TimesheetEntityModel.fromEntity,
|
|
73
|
-
[entity_utils_interface_1.EntityEnum.BILLING_TRANSACTION]: billing_transaction_model_1.BillingTransactionEntityModel.fromEntity,
|
|
74
|
-
};
|
|
75
|
-
if (!(baseEntity in entityFromJsonMappings)) {
|
|
76
|
-
throw new Error(`Unknown entity: ${baseEntity}`);
|
|
77
|
-
}
|
|
78
|
-
entityMap[baseEntity] = ((_a = json["baseEntities"]) !== null && _a !== void 0 ? _a : []).map(
|
|
79
|
-
// REVIEW: Needs to be fixed after audit column type conversion
|
|
80
|
-
(e) => entityFromJsonMappings[baseEntity](e));
|
|
81
|
-
if (json["relatedEntities"]) {
|
|
82
|
-
const relatedEntities = json["relatedEntities"];
|
|
83
|
-
for (const entityName in relatedEntities) {
|
|
84
|
-
parseEntities(
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
relatedEntities[entityName], entityName, entityMap);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return entityMap;
|
|
90
|
-
}
|
|
91
58
|
exports.entityEnumToEntityModel = {
|
|
92
59
|
[entity_utils_interface_1.EntityEnum.PROJECT]: project_entity_model_1.ProjectEntityModel.fromEntity,
|
|
93
60
|
[entity_utils_interface_1.EntityEnum.CLIENT]: client_entity_model_1.ClientEntityModel.fromEntity,
|
|
@@ -107,13 +74,44 @@ exports.entityEnumToEntityModel = {
|
|
|
107
74
|
[entity_utils_interface_1.EntityEnum.TASK]: task_entity_model_1.TaskEntityModel.fromEntity,
|
|
108
75
|
[entity_utils_interface_1.EntityEnum.BILLING_TIMESHEET]: billing_timesheet_entity_model_1.BillingTimesheetEntityModel.fromEntity,
|
|
109
76
|
[entity_utils_interface_1.EntityEnum.TIMESHEET]: timesheet_entity_model_1.TimesheetEntityModel.fromEntity,
|
|
110
|
-
[entity_utils_interface_1.EntityEnum.
|
|
77
|
+
[entity_utils_interface_1.EntityEnum.COUNTRY]: country_entity_model_1.CountryEntityModel.fromApiEntity,
|
|
111
78
|
};
|
|
112
|
-
function
|
|
79
|
+
function entityMapToModels(entityMap) {
|
|
80
|
+
for (const entityName in entityMap) {
|
|
81
|
+
if (!(entityName in exports.entityEnumToEntityModel)) {
|
|
82
|
+
throw new Error(`Unknown entity: ${entityName}`);
|
|
83
|
+
}
|
|
84
|
+
entityMap[entityName] = entityMap[entityName].map((entity) =>
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
exports.entityEnumToEntityModel[entityName](entity));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function parseEntities(json, baseEntity, entityMap) {
|
|
113
90
|
var _a;
|
|
114
91
|
if (!(baseEntity in exports.entityEnumToEntityModel)) {
|
|
115
92
|
throw new Error(`Unknown entity: ${baseEntity}`);
|
|
116
93
|
}
|
|
94
|
+
entityMap[baseEntity] = ((_a = json["baseEntities"]) !== null && _a !== void 0 ? _a : []).map(
|
|
95
|
+
// @ts-ignore
|
|
96
|
+
(e) => exports.entityEnumToEntityModel[baseEntity](e));
|
|
97
|
+
if (json["relatedEntities"]) {
|
|
98
|
+
const relatedEntities = json["relatedEntities"];
|
|
99
|
+
for (const entityName in relatedEntities) {
|
|
100
|
+
parseEntities(
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
relatedEntities[entityName], entityName, entityMap);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return entityMap;
|
|
106
|
+
}
|
|
107
|
+
function entityMapToEntityIndexMap(entityMap, entityRelationsFor) {
|
|
108
|
+
entityMapToModels(entityMap);
|
|
109
|
+
const entityIndexMap = mapToIndex(entityMap);
|
|
110
|
+
populateRelationsFor(entityIndexMap, entityRelationsFor);
|
|
111
|
+
return entityIndexMap;
|
|
112
|
+
}
|
|
113
|
+
function parseEntitiesWithoutModels(json, baseEntity, entityMap = {}) {
|
|
114
|
+
var _a;
|
|
117
115
|
entityMap[baseEntity] = ((_a = json["baseEntities"]) !== null && _a !== void 0 ? _a : []);
|
|
118
116
|
if (json["relatedEntities"]) {
|
|
119
117
|
const relatedEntities = json["relatedEntities"];
|