import { IBaseResponse } from "../../api"; import { ClientAffiliateEntityModel, IClientAffiliateEntity } from "../../entities"; import { ColumnOrderBy } from "../../enums"; import { ConvertToArray } from "../../misc"; import { Modify } from "../../misc/interface/modify.interface"; import { EntitySearchConstraintTypeEnum } from "../enums/entity_search_constraint_type.enum"; import { HistoryOperationEnum } from "../enums/history_operation.enum"; import { AddressBookEntityModel } from "../model/address_book.entity.model"; import { BankEntityModel } from "../model/bank.entity.model"; import { BillingEntityModel } from "../model/billing.entity.model"; import { BillingParticularLineItemEntityModel } from "../model/billing_particular_line_item.entity.model"; import { BillingProfileEntityModel } from "../model/billing_profile.entity.model"; import { BillingReimbursementExpenseEntityModel } from "../model/billing_reimbursement_expense.entity.model"; import { BillingTimesheetEntityModel } from "../model/billing_timesheet.entity.model"; import { BillingTransactionEntityModel } from "../model/billing_transaction.entity.model"; import { ClientEntityModel } from "../model/client.entity.model"; import { ClientDebitNoteEntityModel } from "../model/client_debit_note.entity.model"; import { ClientDebitNoteParticularsEntityModel } from "../model/client_debit_note_particulars.entity.model"; import { ClientIntroducingMappingEntityModel } from "../model/client_introducing_mapping.entity.model"; import { ClientQuoteEntityModel } from "../model/client_quote.entity.model"; import { ClientQuoteRateEntityModel } from "../model/client_quote_rate.entity.model"; import { ClientUserMappingEntityModel } from "../model/client_user_mapping.entity.model"; import { ConfigurationEntityModel } from "../model/configuration.entity.model"; import { CountryEntityModel } from "../model/country.entity.model"; import { CronJobsEntityModel } from "../model/cron_jobs.entity.model"; import { ClientDebitNoteSequenceGeneratorVirtualEntityModel } from "../model/debit_note_sequence_generator.entity.model"; import { DesignationEntityModel } from "../model/designation.entity.model"; import { DocumentUploadEntityModel } from "../model/document_upload.entity.model"; import { EntityHistoryEntityModel } from "../model/entity_history.entity.model"; import { ExpenseHeadEntityModel } from "../model/expense_head.entity.model"; import { ExpenseTypeEntityModel } from "../model/expense_type.entity.model"; import { GstRateEntityModel } from "../model/gst_rate.entity.model"; import { HolidayEntityModel } from "../model/holiday.entity.model"; import { HolidayListEntityModel } from "../model/holiday_list.entity.model"; import { IndustryEntityModel } from "../model/industry.entity.model"; import { IntermediaryBankEntityModel } from "../model/intermediary_bank.entity.model"; import { LeaveEntityModel } from "../model/leave.entity.model"; import { LeaveApprovalEntityModel } from "../model/leave_approval.entity.model"; import { LeaveCountVirtualEntityModel } from "../model/leave_count.entity.model"; import { MovingTimesheetEntityModel } from "../model/moving_timesheet.entity.model"; import { OfficeLocationEntityModel } from "../model/office_location.entity.model"; import { OrganizationEntityModel } from "../model/organization.entity.model"; import { OrganizationTypeEntityModel } from "../model/organization_type.entity.model"; import { OrganizationTypeTdsRateMappingEntityModel } from "../model/organization_type_tds_rate_mapping.entity.model"; import { PermissionEntityModel } from "../model/permission.entity.model"; import { ProjectEntityModel } from "../model/project.entity.model"; import { ProjectRevenueSplitMappingEntityModel } from "../model/project_revenue_split_mapping.entity.model"; import { ProjectUserMappingEntityModel } from "../model/project_user_mapping.entity.model"; import { RateEntityModel } from "../model/rate.entity.model"; import { ReimbursementEntityModel } from "../model/reimbursement.entity.model"; import { ReimbursementExpenseEntityModel } from "../model/reimbursement_expense.entity.model"; import { RoleEntityModel } from "../model/role.entity.model"; import { RolePermissionMappingEntityModel } from "../model/role_permission_mapping.entity.model"; import { StateEntityModel } from "../model/state.entity.model"; import { TaskEntityModel } from "../model/task.entity.model"; import { TdsRateEntityModel } from "../model/tds_rate.entity.model"; import { TdsRateVoucherTypeMappingEntityModel } from "../model/tds_rate_voucher_type_mapping.entity.model"; import { TimesheetEntityModel } from "../model/timesheet.entity.model"; import { ToDoListEntityModel } from "../model/to_do_list.entity.model"; import { UserEntityModel } from "../model/user.entity.model"; import { VendorEntityModel } from "../model/vendor.entity.model"; import { VendorAdvanceEntityModel } from "../model/vendor_advance.entity.model"; import { VendorInvoiceEntityModel } from "../model/vendor_invoice.entity.model"; import { VendorInvoiceAdvanceEntityModel } from "../model/vendor_invoice_advance.entity.model"; import { VendorInvoiceItemEntityModel } from "../model/vendor_invoice_item.entity.model"; import { VendorInvoicePaymentEntityModel } from "../model/vendor_invoice_payment.entity.model"; import { VendorTdsChallanEntityModel } from "../model/vendor_tds_challan.entity.model"; import { VendorTdsLiabilityEntityModel } from "../model/vendor_tds_liability.entity.model"; import { VoucherTypeEntityModel } from "../model/voucher_type.entity.model"; import { WebsiteLeadEntityModel } from "../model/website_lead.entity.model"; import { WebsiteNewsletterSubscriptionEntityModel } from "../model/website_newsletter_subscription.entity.model"; import { WorkFromHomeEntityModel } from "../model/work_from_home.entity.model"; import { IAddressBookEntity } from "./address_book.entity.interface"; import { AggregationFields, IEntityAggregationConfig } from "./aggregation.utils"; import { IBankEntity } from "./bank.entity.interface"; import { IBankHistoryEntity } from "./bank_history.entity.interface"; import { IBillingEntity } from "./billing.entity.interface"; import { IBillingHistoryEntity } from "./billing_history.entity.interface"; import { IBillingParticularLineItemEntity } from "./billing_particular_line_item.entity.interface"; import { IBillingProfileEntity } from "./billing_profile.entity.interface"; import { IBillingReimbursementExpenseEntity } from "./billing_reimbursement_expense.entity.interface"; import { IBillingReimbursementExpenseHistoryEntity } from "./billing_reimbursement_expense_history.entity.interface"; import { IBillingTimesheetEntity } from "./billing_timesheet.entity.interface"; import { IBillingTimesheetHistoryEntity } from "./billing_timesheet_history.entity.interface"; import { IBillingTransactionEntity } from "./billing_transaction.entity.interface"; import { IBillingTransactionHistoryEntity } from "./billing_transaction_history.entity.interface"; import { IClientEntity } from "./client.entity.interface"; import { IClientDebitNoteEntity } from "./client_debit_note.entity.interface"; import { IClientDebitNoteParticularsEntity } from "./client_debit_note_particulars.entity.interface"; import { IClientIntroducingMappingEntity } from "./client_introducing_mapping.entity.interface"; import { IClientQuoteEntity } from "./client_quote.entity.interface"; import { IClientQuoteRateEntity } from "./client_quote_rate.entity.interface"; import { IClientUserMappingEntity } from "./client_user_mapping.entity.interface"; import { IConfigurationEntity } from "./configuration.entity.interface"; import { ICountryEntity } from "./country.entity.interface"; import { ICronJobsEntity } from "./cron_jobs.entity.interface"; import { IClientDebitNoteSequenceGenerator } from "./debit_note_sequence_generator.entity.interface"; import { IDesignationEntity } from "./designation.entity.interface"; import { IDocumentUploadEntity } from "./document_upload.entity.interface"; import { IEntityAuditColumn } from "./entity-audit-columns.interface"; import { IEntityHistoryEntity } from "./entity_history.entity.interface"; import { IExpenseHeadEntity } from "./expense_head.entity.interface"; import { IExpenseTypeEntity } from "./expense_type.entity.interface"; import { IGstRateEntity } from "./gst_rate.entity.interface"; import { IHolidayEntity } from "./holiday.entity.interface"; import { IHolidayListEntity } from "./holiday_list.entity.interface"; import { IIndustryEntity } from "./industry.entity.interface"; import { IIntermediaryBankEntity } from "./intermediary_bank.entity.interface"; import { ILeaveCountVirtualEntity, ILeaveEntity } from "./leave.entity.interface"; import { ILeaveApprovalEntity } from "./leave_approval.entity.interface"; import { ILeaveHistoryEntity } from "./leave_history.entity.interface"; import { IMovingTimesheetEntity } from "./moving_timesheet.entity.interface"; import { IOfficeLocationEntity } from "./office_location.entity.interface"; import { IOrganizationEntity } from "./organization.entity.interface"; import { IOrganizationTypeEntity } from "./organization_type.entity.interface"; import { IOrganizationTypeTdsRateMappingEntity } from "./organization_type_tds_rate_mapping.entity.interface"; import { IPermissionEntity } from "./permission.entity.interface"; import { IProjectEntity } from "./project.entity.interface"; import { IProjectRevenueSplitMappingEntity } from "./project_revenue_split_mapping.entity.interface"; import { IProjectUserMappingEntity } from "./project_user_mapping.entity.interface"; import { IRateEntity } from "./rate.entity.interface"; import { IReimbursementEntity } from "./reimbursement.entity.interface"; import { IReimbursementExpenseEntity } from "./reimbursement_expense.entity.interface"; import { IReimbursementHistoryEntity } from "./reimbursement_history.entity.interface"; import { IRoleEntity } from "./role.entity.interface"; import { IRolePermissionMappingEntity } from "./role_permission_mapping.entity.interface"; import { IStateEntity } from "./state.entity.interface"; import { ITaskEntity } from "./task.entity.interface"; import { ITdsRateEntity } from "./tds_rate.entity.interface"; import { ITdsRateVoucherTypeMappingEntity } from "./tds_rate_voucher_type_mapping.entity.interface"; import { ITimesheetEntity } from "./timesheet.entity.interface"; import { ITimesheetHistoryEntity } from "./timesheet_history.entity.interface"; import { IToDoListEntity } from "./to_do_list.entity.interface"; import { IUserEntity } from "./user.entity.interface"; import { IVendorEntity } from "./vendor.entity.interface"; import { IVendorAdvanceEntity } from "./vendor_advance.entity.interface"; import { IVendorHistoryEntity } from "./vendor_history.entity.interface"; import { IVendorInvoiceEntity } from "./vendor_invoice.entity.interface"; import { IVendorInvoiceAdvanceEntity } from "./vendor_invoice_advance.entity.interface"; import { IVendorInvoiceHistoryEntity } from "./vendor_invoice_history.entity.interface"; import { IVendorInvoiceItemEntity } from "./vendor_invoice_item.entity.interface"; import { IVendorInvoiceItemHistoryEntity } from "./vendor_invoice_item_history.entity.interface"; import { IVendorInvoicePaymentEntity } from "./vendor_invoice_payment.entity.interface"; import { IVendorTdsChallanEntity } from "./vendor_tds_challan.entity.interface"; import { IVendorTdsLiabilityEntity } from "./vendor_tds_liability.entity.interface"; import { IVoucherTypeEntity } from "./voucher_type.entity.interface"; import { IWebsiteLeadEntity } from "./website_lead.entity.interface"; import { IWebsiteNewsletterSubscriptionEntity } from "./website_newsletter_subscription.entity.interface"; import { IWorkFromHomeEntity } from "./work_from_home.entity.interface"; import { IWorkFromHomeHistoryEntity } from "./work_from_home_history.entity.interface"; export type IApiEntity = Modify; export type IEntityCreateDto = Omit & { fetch?: EntityEnum[]; }; export type IEntityUpdateDto = Omit, "id" | keyof IEntityAuditColumn>; /** * EntityEnum * * Centralized registry of **entity identifiers** used across the application. * * Purpose: * - Provides a single source of truth for entity names. * - Ensures consistency across backend, frontend, and shared packages. * - In the backend, these values are also used as TypeORM table names. * * Rules: * - Whenever a new entity (domain object / database table) is introduced, * its corresponding entry MUST be added here. * - Backend entities must always use `@Entity(EntityEnum.XYZ)` instead of string literals. * * Example (backend): * ```ts * @Entity(EntityEnum.USER) * export class UserEntity { ... } * ``` * * Example (frontend / service): * ```ts * if (entity === EntityEnum.USER) { * // handle user entity logic * } * ``` * * Do not duplicate or hardcode entity names in different layers. */ export declare enum EntityEnum { BILLING = "billing", BILLING_HISTORY = "billing_history", BILLING_TIMESHEET = "billing_timesheet", BILLING_REIMBURSEMENT_EXPENSE = "billing_reimbursement_expense", BILLING_TIMESHEET_HISTORY = "billing_timesheet_history", BILLING_REIMBURESMENT_EXPENSE_HISTORY = "billing_reimbursement_expense_history", TIMESHEET = "timesheet", TIMESHEET_HISTORY = "timesheet_history", MOVING_TIMESHEET = "moving_timesheet", USER = "user", PROJECT = "project", CLIENT = "client", TASK = "task", DESIGNATION = "designation", RATE = "rate", REIMBURSEMENT = "reimbursement", REIMBURSEMENT_EXPENSE = "reimbursement_expense", REIMBURSEMENT_HISTORY = "reimbursement_history", WORK_FROM_HOME = "work_from_home", WORK_FROM_HOME_HISTORY = "work_from_home_history", LEAVE = "leave", LEAVE_HISTORY = "leave_history", ORGANIZATION = "organization", BANK = "bank", CLIENT_AFFILIATE = "client_affiliate", BANK_HISTORY = "bank_history", BILLING_TRANSACTION = "billing_transaction", BILLING_TRANSACTION_HISTORY = "billing_transaction_history", CONFIGURATION = "configuration", COUNTRY = "country", EXPENSE_TYPE = "expense_type", INDUSTRY = "industry", INTERMEDIARY_BANK = "intermediary_bank", OFFICE_LOCATION = "office_location", PERMISSION = "permission", ROLE = "role", PROJECT_USER_MAPPING = "project_user_mapping", CLIENT_USER_MAPPING = "client_user_mapping", CLIENT_INTRODUCING_MAPPING = "client_introducing_mapping", ROLE_PERMISSION_MAPPING = "role_permission_mapping", HOLIDAY = "holiday", HOLIDAY_LIST = "holiday_list", CRON_JOBS = "cron_jobs", TO_DO_LIST = "to_do_list", ADDRESS_BOOK = "address_book", STATE = "state", GST_RATE = "gst_rate", ORGANIZATION_TYPE = "organization_type", TDS_RATE = "tds_rate", ORGANIZATION_TYPE_TDS_RATE_MAPPING = "organization_type_tds_rate_mapping", VOUCHER_TYPE = "voucher_type", TDS_RATE_VOUCHER_TYPE_MAPPING = "tds_rate_voucher_type_mapping", EXPENSE_HEAD = "expense_head", DOCUMENT_UPLOAD = "document_upload", VENDOR = "vendor", VENDOR_INVOICE = "vendor_invoice", VENDOR_INVOICE_HISTORY = "vendor_invoice_history", VENDOR_INVOICE_ITEM = "vendor_invoice_item", BILLING_PROFILE = "billing_profile", PROJECT_REVENUE_SPLIT_MAPPING = "project_revenue_split_mapping", WEBSITE_LEAD = "website_lead", WEBSITE_NEWSLETTER_SUBSCRIPTION = "website_newsletter_subscription", VENDOR_INVOICE_ITEM_HISTORY = "vendor_invoice_item_history", VENDOR_HISTORY = "vendor_history", CLIENT_QUOTE = "client_quote", CLIENT_QUOTE_RATE = "client_quote_rate", ENTITY_HISTORY = "entity_history", VENDOR_INVOICE_PAYMENT = "vendor_invoice_payment", LEAVE_APPROVAL = "leave_approval", VENDOR_TDS_LIABILITY = "vendor_tds_liability", VENDOR_TDS_CHALLAN = "vendor_tds_challan", VENDOR_ADVANCE = "vendor_advance", VENDOR_INVOICE_ADVANCE = "vendor_invoice_advance", BILLING_PARTICULAR_LINE_ITEM = "billing_particular_line_item", CLIENT_DEBIT_NOTE = "client_debit_note", CLIENT_DEBIT_NOTE_PARTICULARS = "client_debit_note_particulars" } export type EntityRelations = { [K in EntityEnum | VirtualEntityEnum]: K; }; export type IEntityServiceResponse = { [K in EntityEnum | VirtualEntityEnum]?: IBaseEntityServiceResponse>; }; export type IBaseEntityServiceResponse = { baseEntities: T[]; relatedEntities?: IEntityServiceResponse; virtualEntities?: IEntityServiceResponse; aggregateEntities?: { [key in EntityEnum | VirtualEntityEnum]?: any[]; }; }; export type IBaseEntityApiResponse = { baseEntities: T[]; relatedEntities?: { [K in EntityEnum | VirtualEntityEnum]?: IBaseEntityApiResponse>; }; aggregateEntities?: { [key in EntityEnum | VirtualEntityEnum]?: AggregationFields>[]; }; }; export type EnumEntityType = (T extends EntityEnum.BILLING ? IBillingEntity : T extends EntityEnum.BILLING_HISTORY ? IBillingHistoryEntity : T extends EntityEnum.MOVING_TIMESHEET ? IMovingTimesheetEntity : T extends EntityEnum.BILLING_TIMESHEET ? IBillingTimesheetEntity : T extends EntityEnum.BILLING_REIMBURSEMENT_EXPENSE ? IBillingReimbursementExpenseEntity : T extends EntityEnum.BILLING_TIMESHEET_HISTORY ? IBillingTimesheetHistoryEntity : T extends EntityEnum.BILLING_REIMBURESMENT_EXPENSE_HISTORY ? IBillingReimbursementExpenseHistoryEntity : T extends EntityEnum.BILLING_PARTICULAR_LINE_ITEM ? IBillingParticularLineItemEntity : 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_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.REIMBURSEMENT_HISTORY ? IReimbursementHistoryEntity : 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.CLIENT_INTRODUCING_MAPPING ? IClientIntroducingMappingEntity : 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 : T extends EntityEnum.STATE ? IStateEntity : T extends EntityEnum.GST_RATE ? IGstRateEntity : T extends EntityEnum.ORGANIZATION_TYPE ? IOrganizationTypeEntity : T extends EntityEnum.TDS_RATE ? ITdsRateEntity : T extends EntityEnum.ORGANIZATION_TYPE_TDS_RATE_MAPPING ? IOrganizationTypeTdsRateMappingEntity : T extends EntityEnum.VOUCHER_TYPE ? IVoucherTypeEntity : T extends EntityEnum.TDS_RATE_VOUCHER_TYPE_MAPPING ? ITdsRateVoucherTypeMappingEntity : T extends EntityEnum.EXPENSE_HEAD ? IExpenseHeadEntity : T extends EntityEnum.DOCUMENT_UPLOAD ? IDocumentUploadEntity : T extends EntityEnum.VENDOR ? IVendorEntity : T extends EntityEnum.VENDOR_INVOICE ? IVendorInvoiceEntity : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? IVendorInvoiceHistoryEntity : T extends EntityEnum.VENDOR_INVOICE_HISTORY ? IVendorInvoiceHistoryEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM ? IVendorInvoiceItemEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? IVendorInvoiceItemHistoryEntity : T extends EntityEnum.VENDOR_HISTORY ? IVendorHistoryEntity : T extends EntityEnum.WEBSITE_LEAD ? IWebsiteLeadEntity : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? IWebsiteNewsletterSubscriptionEntity : T extends EntityEnum.CLIENT_QUOTE ? IClientQuoteEntity : T extends EntityEnum.CLIENT_QUOTE_RATE ? IClientQuoteRateEntity : T extends EntityEnum.BILLING_PROFILE ? IBillingProfileEntity : T extends EntityEnum.PROJECT_REVENUE_SPLIT_MAPPING ? IProjectRevenueSplitMappingEntity : T extends EntityEnum.VENDOR_INVOICE_ITEM_HISTORY ? IVendorInvoiceItemHistoryEntity : T extends EntityEnum.VENDOR_HISTORY ? IVendorHistoryEntity : T extends EntityEnum.WEBSITE_LEAD ? IWebsiteLeadEntity : T extends EntityEnum.WEBSITE_NEWSLETTER_SUBSCRIPTION ? IWebsiteNewsletterSubscriptionEntity : T extends EntityEnum.CLIENT_QUOTE ? IClientQuoteEntity : T extends EntityEnum.CLIENT_QUOTE_RATE ? IClientQuoteRateEntity : T extends EntityEnum.ENTITY_HISTORY ? IEntityHistoryEntity : T extends EntityEnum.LEAVE_APPROVAL ? ILeaveApprovalEntity : T extends EntityEnum.VENDOR_INVOICE_PAYMENT ? IVendorInvoicePaymentEntity : T extends EntityEnum.VENDOR_TDS_LIABILITY ? IVendorTdsLiabilityEntity : T extends EntityEnum.VENDOR_TDS_CHALLAN ? IVendorTdsChallanEntity : T extends EntityEnum.VENDOR_ADVANCE ? IVendorAdvanceEntity : T extends EntityEnum.VENDOR_INVOICE_ADVANCE ? IVendorInvoiceAdvanceEntity : T extends EntityEnum.BILLING_PARTICULAR_LINE_ITEM ? IBillingParticularLineItemEntity : T extends EntityEnum.CLIENT_DEBIT_NOTE ? IClientDebitNoteEntity : T extends EntityEnum.CLIENT_DEBIT_NOTE_PARTICULARS ? IClientDebitNoteParticularsEntity : T extends VirtualEntityEnum.CLIENT_DEBIT_NOTE_SEQUENCE_GENERATOR ? IClientDebitNoteSequenceGenerator : never) & { id: number; }; export type EntityRelationConfig = { [K in EntityEnum | VirtualEntityEnum]?: { mappingProperties: EntityKeyType[]; searchProperty: EntityKeyType; projectProperties?: EntityKeyType[]; }; }; export type EntityKeyType = keyof EnumEntityType; export type IEntityApiResponse = IApiEntity; export type IEntityFilterData> = ConvertToArray> & { id?: number[]; range?: { [key in keyof T]?: [T[key], T[key]]; }; exclude?: { [key in keyof T]?: T[key][]; }; include?: { [key in keyof T]?: T[key][]; }; greaterThan?: { [key in keyof T]?: T[key]; }; lessThan?: { [key in keyof T]?: T[key]; }; ge?: { [key in keyof T]?: T[key]; }; le?: { [key in keyof T]?: T[key]; }; contains?: { [key in keyof T]?: string[]; }; relations?: ISearchIncludeEntity[]; entities?: ISearchIncludeEntity[]; columnKeys?: (keyof T)[]; virtualRelations?: ISearchIncludeEntity[]; orderBy?: Partial>; limit?: number; aggregation?: IEntityAggregationConfig; }; export type ISearchIncludeEntity = { id?: number[]; name: T; relations?: ISearchIncludeEntity[]; entities?: ISearchIncludeEntity[]; columnKeys?: EntityKeyType[]; mappingProperties?: EntityKeyType[]; searchProperty?: EntityKeyType; include?: { [key in keyof EnumEntityType]?: EnumEntityType[key][]; }; exclude?: { [key in keyof EnumEntityType]?: EnumEntityType[key][]; }; range?: { [key in keyof EnumEntityType]?: [EnumEntityType[key], EnumEntityType[key]]; }; ge?: { [key in keyof EnumEntityType]?: EnumEntityType[key]; }; le?: { [key in keyof EnumEntityType]?: EnumEntityType[key]; }; greaterThan?: { [key in keyof EnumEntityType]?: EnumEntityType[key]; }; lessThan?: { [key in keyof EnumEntityType]?: EnumEntityType[key]; }; contains?: { [key in keyof EnumEntityType]?: string[]; }; virtualRelations?: ISearchIncludeEntity[]; orderBy?: Partial, ColumnOrderBy>>; limit?: number; aggregation?: IEntityAggregationConfig>; }; export type IEntityHistoryParsed = { parsedData: any; id: number; entityId: number; operation: HistoryOperationEnum; data: string; createdOn: Date; updatedOn: Date; createdBy: number; updatedBy: number; }; export type IEntitySearchConstraint = { entityId: number[]; constraint: { since: IEntitySearchSinceConstraint; }; }; export type IEntitySearchSinceConstraint = { type: EntitySearchConstraintTypeEnum; columnKey: string; value: number; }; export interface IBaseHistoryEntity extends IEntityAuditColumn { id: number; entityId: number; operation: HistoryOperationEnum; data: string; } export type IHistoryEntitySearchByConstraintResponse = { id: number; createdBy: number; changedLogs: IHistoryEntityChangedLogs[]; }; export type IHistoryEntityChangedLogs = { key: keyof T; label: string; newValue: T[keyof T]; oldValue: T[keyof T] | null; timeStamp: number; }; export declare enum VirtualEntityEnum { LEAVE_COUNT = "leave_count", USER_LEAVE = "user_leave", CLIENT_DEBIT_NOTE_SEQUENCE_GENERATOR = "client_debit_note_sequence_generator" } export type IHistoryConstraintSearchResponse = IBaseResponse[]>; export type IHistoryConstraintSearchServiceResponse = IHistoryEntitySearchByConstraintResponse[]; export type EnumToModel = 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 ? BillingReimbursementExpenseEntityModel : 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.MOVING_TIMESHEET ? MovingTimesheetEntityModel : 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.ORGANIZATION ? OrganizationEntityModel : T extends EntityEnum.INDUSTRY ? IndustryEntityModel : T extends EntityEnum.EXPENSE_TYPE ? ExpenseTypeEntityModel : T extends EntityEnum.DESIGNATION ? DesignationEntityModel : T extends EntityEnum.RATE ? RateEntityModel : 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_USER_MAPPING ? ClientUserMappingEntityModel : T extends EntityEnum.CLIENT_INTRODUCING_MAPPING ? ClientIntroducingMappingEntityModel : T extends EntityEnum.HOLIDAY_LIST ? HolidayListEntityModel : T extends EntityEnum.CRON_JOBS ? CronJobsEntityModel : T extends EntityEnum.TO_DO_LIST ? ToDoListEntityModel : T extends EntityEnum.CLIENT_QUOTE ? ClientQuoteEntityModel : T extends EntityEnum.CLIENT_QUOTE_RATE ? ClientQuoteRateEntityModel : T extends EntityEnum.BILLING_PROFILE ? BillingProfileEntityModel : T extends EntityEnum.PROJECT_REVENUE_SPLIT_MAPPING ? ProjectRevenueSplitMappingEntityModel : 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 : T extends EntityEnum.ENTITY_HISTORY ? EntityHistoryEntityModel : T extends EntityEnum.LEAVE_APPROVAL ? LeaveApprovalEntityModel : T extends EntityEnum.VENDOR_INVOICE_PAYMENT ? VendorInvoicePaymentEntityModel : T extends EntityEnum.VENDOR_TDS_LIABILITY ? VendorTdsLiabilityEntityModel : T extends EntityEnum.VENDOR_TDS_CHALLAN ? VendorTdsChallanEntityModel : T extends EntityEnum.VENDOR_ADVANCE ? VendorAdvanceEntityModel : T extends EntityEnum.VENDOR_INVOICE_ADVANCE ? VendorInvoiceAdvanceEntityModel : T extends EntityEnum.BILLING_PARTICULAR_LINE_ITEM ? BillingParticularLineItemEntityModel : T extends EntityEnum.CLIENT_DEBIT_NOTE ? ClientDebitNoteEntityModel : T extends EntityEnum.CLIENT_DEBIT_NOTE_PARTICULARS ? ClientDebitNoteParticularsEntityModel : T extends VirtualEntityEnum.CLIENT_DEBIT_NOTE_SEQUENCE_GENERATOR ? ClientDebitNoteSequenceGeneratorVirtualEntityModel : UserEntityModel; export type EntityMap = { [key in EntityEnum | VirtualEntityEnum]: EnumToModel[]; } & { aggregateEntities?: { [key in EntityEnum | VirtualEntityEnum]: AggregationFields>[]; }; }; export type EntityIndexMap = { [key in EntityEnum | VirtualEntityEnum]: { [id: number]: EnumToModel; }; }; export type IPremissionFilterConfig = { [key: string]: () => Promise>>; }; /** * Represents a value that can be explicitly cleared. * * Use this type for optional fields where: * - `undefined` means "do not update / leave unchanged" * - `null` means "explicitly remove the stored value" * * Commonly used in update DTOs and entities with nullable database columns. * * @template T - The underlying value type. */ export type Nullable = T | null; export type HistoryExcludedColumns = { [K in EntityEnum]?: (keyof EnumEntityType)[]; };