@accounter/server
Version:
Accounter GraphQL server
61 lines (60 loc) • 3.08 kB
TypeScript
import DataLoader from 'dataloader';
import type { PoolClient } from 'pg';
import { AdminContextProvider } from '../../admin-context/providers/admin-context.provider.js';
import { TenantAwareDBClient } from '../../app-providers/tenant-db-client.js';
import type { IGetAllBusinessesResult, IInsertBusinessesParams, IUpdateBusinessParams } from '../types.js';
export declare class BusinessesProvider {
private db;
private adminContextProvider;
constructor(db: TenantAwareDBClient, adminContextProvider: AdminContextProvider);
private batchBusinessesByIds;
getBusinessByIdLoader: DataLoader<string, import("../types.js").IGetBusinessesByIdsResult | undefined, string>;
private allBusinessesCache;
getAllBusinesses(): Promise<IGetAllBusinessesResult[]>;
getBusinessByEmail(email: string): Promise<import("../types.js").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;
ownerId: string | 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;
ownerId: string | null | void;
}>;
insertBusiness(newBusiness: IInsertBusinessesParams['businesses'][number], client?: PoolClient): Promise<import("../types.js").IInsertBusinessesResult>;
replaceBusiness(targetBusinessId: string, businessIdToReplace: string): Promise<void>;
invalidateBusinessById(businessId: string): Promise<void>;
clearCache(): void;
}