@accounter/server
Version:
The test suite is split into three Vitest projects for efficiency and isolation:
63 lines (62 loc) • 3 kB
TypeScript
import DataLoader from 'dataloader';
import { DBProvider } from '../../app-providers/db.provider.js';
import type { IGetAllBusinessesResult, IGetBusinessByEmailResult, IUpdateBusinessParams } from '../types.js';
export declare class BusinessesProvider {
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 batchBusinessesByIds;
getBusinessByIdLoader: DataLoader<string, import("../types.js").IGetBusinessesByIdsResult | undefined, import("node-cache").Key | import("node-cache").Key[]>;
getAllBusinesses(): Promise<IGetAllBusinessesResult[]>;
getBusinessByEmail(email: string): Promise<IGetBusinessByEmailResult | null>;
updateBusiness(params: Omit<IUpdateBusinessParams, 'businessId'> & {
businessId: string;
}): Promise<import("../types.js").IUpdateBusinessResult[]>;
private batchInsertBusinesses;
insertBusinessLoader: DataLoader<{
id: string | null | void;
hebrewName: string | null | void;
address: string | null | void;
city: string | null | void;
zipCode: string | null | void;
email: string | null | void;
website: string | null | void;
phoneNumber: string | null | void;
governmentId: string | null | void;
exemptDealer: boolean | null | void;
suggestions: import("../types.js").Json | null | void;
optionalVat: boolean | null | void;
country: string | null | void;
pcn874RecordTypeOverride: import("../types.js").pcn874_record_type | null | void;
isReceiptEnough: boolean | null | void;
isDocumentsOptional: boolean | null | void;
}, import("../types.js").IInsertBusinessesResult | null, {
id: string | null | void;
hebrewName: string | null | void;
address: string | null | void;
city: string | null | void;
zipCode: string | null | void;
email: string | null | void;
website: string | null | void;
phoneNumber: string | null | void;
governmentId: string | null | void;
exemptDealer: boolean | null | void;
suggestions: import("../types.js").Json | null | void;
optionalVat: boolean | null | void;
country: string | null | void;
pcn874RecordTypeOverride: import("../types.js").pcn874_record_type | null | void;
isReceiptEnough: boolean | null | void;
isDocumentsOptional: boolean | null | void;
}>;
replaceBusiness(targetBusinessId: string, businessIdToReplace: string): Promise<void>;
invalidateBusinessById(businessId: string): Promise<void>;
clearCache(): void;
}