UNPKG

@accounter/server

Version:

The test suite is split into three Vitest projects for efficiency and isolation:

58 lines (57 loc) 3.43 kB
import DataLoader from 'dataloader'; import type { Optional, TimelessDateString } from '../../../shared/types/index.js'; import { DBProvider } from '../../app-providers/db.provider.js'; import type { IBatchUpdateChargesParams, IDeleteChargesByIdsParams, IGenerateChargeParams, IGetChargesByFiltersParams, IGetChargesByFiltersResult, IGetSimilarChargesParams, IUpdateAccountantApprovalParams, IUpdateChargeParams } 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; documents_optional_flag: unknown; optional_vat: unknown; }> = Omit<T, 'id' | 'owner_id' | 'is_property' | 'accountant_status' | 'updated_at' | 'created_at' | 'documents_optional_flag' | 'optional_vat'> & { 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']>; documents_optional_flag: NonNullable<T['documents_optional_flag']>; optional_vat: NonNullable<T['optional_vat']>; }; 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; cache: { get: <T>(key: import("node-cache").Key) => T | undefined; set: { <T>(key: import("node-cache").Key, value: T, ttl: number | string): boolean; <T>(key: import("node-cache").Key, value: T): boolean; }; delete: (keys: import("node-cache").Key | import("node-cache").Key[]) => number; clear: () => void; }; constructor(dbProvider: DBProvider); private batchChargesByIds; getChargeByIdLoader: DataLoader<string, import("../types.js").IGetChargesByIdsResult | undefined, import("node-cache").Key | import("node-cache").Key[]>; private batchChargesByTransactionIds; getChargeByTransactionIdLoader: DataLoader<string, import("../types.js").IGetChargesByTransactionIdsResult | undefined, string>; getChargesByMissingRequiredInfo(): Promise<import("../types.js").IGetChargesByMissingRequiredInfoResult[]>; updateCharge(params: IUpdateChargeParams): Promise<import("../types.js").IUpdateChargeResult>; batchUpdateCharges(params: IBatchUpdateChargesParams): Promise<import("../types.js").IBatchUpdateChargesResult[]>; updateAccountantApproval(params: IUpdateAccountantApprovalParams): Promise<import("../types.js").IUpdateAccountantApprovalResult>; generateCharge(params: IGenerateChargeParams): Promise<import("../types.js").IGenerateChargeResult>; getChargesByFilters(params: IGetAdjustedChargesByFiltersParams): Promise<IGetChargesByFiltersResult[]>; getSimilarCharges(params: IGetSimilarChargesParams): Promise<IGetChargesByFiltersResult[]>; deleteChargesByIds(params: IDeleteChargesByIdsParams): Promise<void[]>; invalidateCharge(chargeId: string): Promise<void>; clearCache(): void; } export {};