law-common 10.63.4-beta.6 → 10.63.4-beta.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.
|
@@ -30,6 +30,7 @@ import { OrganizationTypeTdsRateMappingEntityModel } from "../model/organization
|
|
|
30
30
|
import { PermissionEntityModel } from "../model/permissions.entity.model";
|
|
31
31
|
import { ProjectUserMappingEntityModel } from "../model/project-user-mapping.entity.model";
|
|
32
32
|
import { ProjectEntityModel } from "../model/project.entity.model";
|
|
33
|
+
import { RateEntityModel } from "../model/rate.model";
|
|
33
34
|
import { ReimbursementExpenseEntityModel } from "../model/reimbursement-expense.entity.model";
|
|
34
35
|
import { ReimbursementEntityModel } from "../model/reimbursement.entity.model";
|
|
35
36
|
import { RolePermissionMappingEntityModel } from "../model/role-permission.entity.model";
|
|
@@ -350,7 +351,7 @@ export declare enum VirtualEntityEnum {
|
|
|
350
351
|
}
|
|
351
352
|
export type IHistoryConstraintSearchResponse<T> = IBaseResponse<IHistoryEntitySearchByConstraintResponse<T>[]>;
|
|
352
353
|
export type IHistoryConstraintSearchServiceResponse<T> = IHistoryEntitySearchByConstraintResponse<T>[];
|
|
353
|
-
export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.INTERMEDIARY_BANK ? IntermediaryBankEntityModel : 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.WORK_FROM_HOME ? WorkFromHomeEntityModel : 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 : T extends EntityEnum.ADDRESS_BOOK ? AddressBookEntityModel : T extends EntityEnum.STATE ? StateEntityModel : T extends EntityEnum.GST_RATE ? GstRateEntityModel : T extends EntityEnum.ORGANIZATION_TYPE ? OrganizationTypeEntityModel : T extends EntityEnum.TDS_RATE ? TdsRateEntityModel : T extends EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING ? OrganizationTypeTdsRateMappingEntityModel : T extends EntityEnum.VOUCHER_TYPE ? VoucherTypeEntityModel : T extends EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING ? TdsRateVoucherTypeMappingEntityModel : T extends EntityEnum.ROLE ? RoleEntityModel : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? RolePermissionMappingEntityModel : T extends EntityEnum.PERMISSION ? PermissionEntityModel : T extends EntityEnum.EXPENSE_HEAD ? ExpenseHeadEntityModel : T extends EntityEnum.DOCUMENT_UPLOAD ? DocumentUploadEntityModel : T extends EntityEnum.VENDOR ? VendorEntityModel : T extends EntityEnum.VENDOR_INVOICE ? VendorInvoiceEntityModel : T extends EntityEnum.OFFICE_LOCATION ? OfficeLocationEntityModel : T extends EntityEnum.VENDOR_INVOICE_ITEM ? VendorInvoiceItemEntityModel : T extends EntityEnum.WEBSITE_LEAD ? WebsiteLeadEntityModel : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? WebsiteNewsletterSubscriptionEntityModel : T extends EntityEnum.CLIENT_QUOTE ? ClientQuoteEntityModel : T extends EntityEnum.CLIENT_QUOTE_RATE ? ClientQuoteRateEntityModel : T extends EntityEnum.DESIGNATION ? DesignationEntityModel : UserEntityModel;
|
|
354
|
+
export type EnumToModel<T extends EntityEnum | VirtualEntityEnum> = T extends EntityEnum.BILLING ? BillingEntityModel : T extends EntityEnum.CLIENT ? ClientEntityModel : T extends EntityEnum.INTERMEDIARY_BANK ? IntermediaryBankEntityModel : 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.WORK_FROM_HOME ? WorkFromHomeEntityModel : 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 : T extends EntityEnum.ADDRESS_BOOK ? AddressBookEntityModel : T extends EntityEnum.STATE ? StateEntityModel : T extends EntityEnum.GST_RATE ? GstRateEntityModel : T extends EntityEnum.ORGANIZATION_TYPE ? OrganizationTypeEntityModel : T extends EntityEnum.TDS_RATE ? TdsRateEntityModel : T extends EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING ? OrganizationTypeTdsRateMappingEntityModel : T extends EntityEnum.VOUCHER_TYPE ? VoucherTypeEntityModel : T extends EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING ? TdsRateVoucherTypeMappingEntityModel : T extends EntityEnum.ROLE ? RoleEntityModel : T extends EntityEnum.ROLE_PERMISSION_MAPPING ? RolePermissionMappingEntityModel : T extends EntityEnum.PERMISSION ? PermissionEntityModel : T extends EntityEnum.EXPENSE_HEAD ? ExpenseHeadEntityModel : T extends EntityEnum.DOCUMENT_UPLOAD ? DocumentUploadEntityModel : T extends EntityEnum.VENDOR ? VendorEntityModel : T extends EntityEnum.VENDOR_INVOICE ? VendorInvoiceEntityModel : T extends EntityEnum.OFFICE_LOCATION ? OfficeLocationEntityModel : T extends EntityEnum.VENDOR_INVOICE_ITEM ? VendorInvoiceItemEntityModel : T extends EntityEnum.WEBSITE_LEAD ? WebsiteLeadEntityModel : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? WebsiteNewsletterSubscriptionEntityModel : T extends EntityEnum.CLIENT_QUOTE ? ClientQuoteEntityModel : T extends EntityEnum.CLIENT_QUOTE_RATE ? ClientQuoteRateEntityModel : T extends EntityEnum.DESIGNATION ? DesignationEntityModel : T extends EntityEnum.RATE ? RateEntityModel : UserEntityModel;
|
|
354
355
|
export type EntityMap = {
|
|
355
356
|
[key in EntityEnum | VirtualEntityEnum]: EnumToModel<key>[];
|
|
356
357
|
};
|
|
@@ -37,6 +37,7 @@ const organization_type_tds_rate_mapping_entity_model_1 = require("./organizatio
|
|
|
37
37
|
const permissions_entity_model_1 = require("./permissions.entity.model");
|
|
38
38
|
const project_user_mapping_entity_model_1 = require("./project-user-mapping.entity.model");
|
|
39
39
|
const project_entity_model_1 = require("./project.entity.model");
|
|
40
|
+
const rate_model_1 = require("./rate.model");
|
|
40
41
|
const reimbursement_expense_entity_model_1 = require("./reimbursement-expense.entity.model");
|
|
41
42
|
const reimbursement_entity_model_1 = require("./reimbursement.entity.model");
|
|
42
43
|
const role_permission_entity_model_1 = require("./role-permission.entity.model");
|
|
@@ -126,6 +127,7 @@ exports.entityEnumToEntityModel = {
|
|
|
126
127
|
[entity_utils_interface_1.EntityEnum.CLIENT_QUOTE]: client_quote_entity_model_1.ClientQuoteEntityModel.fromEntity,
|
|
127
128
|
[entity_utils_interface_1.EntityEnum.CLIENT_QUOTE_RATE]: client_quote_rate_entity_model_1.ClientQuoteRateEntityModel.fromEntity,
|
|
128
129
|
[entity_utils_interface_1.EntityEnum.DESIGNATION]: designation_entity_model_1.DesignationEntityModel.fromEntity,
|
|
130
|
+
[entity_utils_interface_1.EntityEnum.RATE]: rate_model_1.RateEntityModel.fromEntity,
|
|
129
131
|
};
|
|
130
132
|
function entityMapToModels(entityMap) {
|
|
131
133
|
for (const entityName in entityMap) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TimeUnitEnum, CurrencyEnum } from "../../enums";
|
|
2
|
+
import { EntityEnum } from "../interface/entity.utils.interface";
|
|
3
|
+
import { IRateEntity } from "../interface/rate.entity.interface";
|
|
4
|
+
import { BaseEntityModel } from "./base.entity.model";
|
|
5
|
+
import { DesignationEntityModel } from "./designation.entity.model";
|
|
6
|
+
export declare class RateEntityModel extends BaseEntityModel<EntityEnum.RATE> implements IRateEntity {
|
|
7
|
+
id: number;
|
|
8
|
+
designation: string;
|
|
9
|
+
rate: number;
|
|
10
|
+
unit: TimeUnitEnum;
|
|
11
|
+
currency: CurrencyEnum;
|
|
12
|
+
createdOn: number;
|
|
13
|
+
updatedOn: number;
|
|
14
|
+
createdBy: number;
|
|
15
|
+
updatedBy: number;
|
|
16
|
+
static fromEntity(entity: IRateEntity): RateEntityModel;
|
|
17
|
+
getRelationConfigs(): any[];
|
|
18
|
+
static getByDesignation(designation: string, roleModels: RateEntityModel[], designationModels: DesignationEntityModel[]): RateEntityModel[];
|
|
19
|
+
static getByCurrency(currency: string, roleModels: RateEntityModel[]): RateEntityModel | undefined;
|
|
20
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RateEntityModel = void 0;
|
|
4
|
+
const entity_utils_interface_1 = require("../interface/entity.utils.interface");
|
|
5
|
+
const base_entity_model_1 = require("./base.entity.model");
|
|
6
|
+
class RateEntityModel extends base_entity_model_1.BaseEntityModel {
|
|
7
|
+
static fromEntity(entity) {
|
|
8
|
+
const result = new RateEntityModel(entity_utils_interface_1.EntityEnum.RATE);
|
|
9
|
+
Object.assign(result, entity);
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
getRelationConfigs() {
|
|
13
|
+
return this.constructor.prototype.constructor.relationConfigs || [];
|
|
14
|
+
}
|
|
15
|
+
static getByDesignation(designation, roleModels, designationModels) {
|
|
16
|
+
const filteredDesignationModels = designationModels.filter((designationModel) => designationModel.name === designation);
|
|
17
|
+
if (filteredDesignationModels.length === 0) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
return roleModels.filter((role) => filteredDesignationModels.some((designationModel) => designationModel.name === role.designation));
|
|
21
|
+
}
|
|
22
|
+
static getByCurrency(currency, roleModels) {
|
|
23
|
+
const filteredCurrencyModels = roleModels.filter((role) => role.currency === currency);
|
|
24
|
+
if (filteredCurrencyModels.length === 0) {
|
|
25
|
+
console.warn(`No rate model found for currency: ${currency}. Returning undefined.`);
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
if (filteredCurrencyModels.length > 1) {
|
|
29
|
+
console.warn(`Multiple rate models found for currency: ${currency}. Returning the first matching model.`);
|
|
30
|
+
}
|
|
31
|
+
return filteredCurrencyModels[0];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.RateEntityModel = RateEntityModel;
|