UNPKG

@accounter/server

Version:

49 lines (48 loc) 3.63 kB
import DataLoader from 'dataloader'; import { DBProvider } from '../../app-providers/db.provider.js'; import type { Optional, TimelessDateString } from '../../../shared/types/index.js'; import type { IBatchUpdateChargesParams, IDeleteChargesByIdsParams, IGenerateChargeParams, IGetChargesByFiltersParams, IGetChargesByFiltersResult, IGetChargesByFinancialAccountIdsParams, IGetChargesByFinancialAccountIdsResult, IGetChargesByFinancialEntityIdsParams, IGetChargesByFinancialEntityIdsResult, IGetChargesByIdsResult, IGetChargesByTransactionIdsResult, IGetSimilarChargesParams, IUpdateAccountantApprovalParams, IUpdateAccountantApprovalResult, IUpdateChargeParams, IUpdateChargeResult } from '../types.js'; export type ChargeRequiredWrapper<T extends { id: unknown; owner_id: unknown; is_property: unknown; accountant_status: unknown; updated_at: unknown; created_at: unknown; }> = Omit<T, 'id' | 'owner_id' | 'is_property' | 'accountant_status' | 'updated_at' | 'created_at'> & { id: NonNullable<T['id']>; owner_id: NonNullable<T['owner_id']>; is_property: NonNullable<T['is_property']>; accountant_status: NonNullable<T['accountant_status']>; updated_at: NonNullable<T['updated_at']>; created_at: NonNullable<T['created_at']>; }; type IGetAdjustedChargesByFiltersParams = Optional<Omit<IGetChargesByFiltersParams, 'isOwnerIds' | 'isBusinessIds' | 'businessIds' | 'isIDs' | 'isTags' | 'tags'>, 'ownerIds' | 'IDs' | 'asc' | 'sortColumn' | 'toDate' | 'fromDate'> & { toDate?: TimelessDateString | null; fromDate?: TimelessDateString | null; tags?: readonly string[] | null; businessIds?: readonly string[] | null; }; export declare class ChargesProvider { private dbProvider; constructor(dbProvider: DBProvider); private batchChargesByIds; getChargeByIdLoader: DataLoader<string, ChargeRequiredWrapper<IGetChargesByIdsResult>, string>; private batchChargesByTransactionIds; getChargeByTransactionIdLoader: DataLoader<string, ChargeRequiredWrapper<IGetChargesByTransactionIdsResult> | undefined, string>; getChargesByFinancialAccountIds(params: IGetChargesByFinancialAccountIdsParams): Promise<ChargeRequiredWrapper<IGetChargesByFinancialAccountIdsResult>[]>; private batchChargesByFinancialAccountIds; getChargeByFinancialAccountIDsLoader: DataLoader<string, ChargeRequiredWrapper<IGetChargesByFinancialAccountIdsResult>[], string>; getChargesByFinancialEntityIds(params: IGetChargesByFinancialEntityIdsParams): Promise<ChargeRequiredWrapper<IGetChargesByFinancialEntityIdsResult>[]>; private batchChargesByFinancialEntityIds; getChargeByFinancialEntityIdLoader: DataLoader<string, ChargeRequiredWrapper<IGetChargesByFinancialEntityIdsResult>[], string>; getChargesByMissingRequiredInfo(): Promise<import("../types.js").IGetChargesByMissingRequiredInfoResult[]>; updateCharge(params: IUpdateChargeParams): Promise<ChargeRequiredWrapper<IUpdateChargeResult>[]>; batchUpdateCharges(params: IBatchUpdateChargesParams): Promise<ChargeRequiredWrapper<IUpdateChargeResult>[]>; updateAccountantApproval(params: IUpdateAccountantApprovalParams): Promise<ChargeRequiredWrapper<IUpdateAccountantApprovalResult>[]>; generateCharge(params: IGenerateChargeParams): Promise<import("../types.js").IGenerateChargeResult[]>; getChargesByFilters(params: IGetAdjustedChargesByFiltersParams): Promise<IGetChargesByFiltersResult[]>; getSimilarCharges(params: IGetSimilarChargesParams): Promise<IGetChargesByFiltersResult[]>; deleteChargesByIds(params: IDeleteChargesByIdsParams): Promise<void[]>; } export {};