@accounter/server
Version:
Accounter GraphQL server
25 lines (24 loc) • 894 B
TypeScript
import type { PoolClient } from 'pg';
import type { AdminContext } from '../../modules/admin-context/types.js';
/**
* Builds AdminContext from database user_context table.
*
* This helper eliminates ~100 lines of duplication across integration tests
* by querying the database for the full admin context configuration.
*
* @param client - Database client connection
* @param businessName - Name of the admin business entity (default: 'Admin Business')
* @returns Complete AdminContext object with all required fields populated from DB
*
* @example
* ```typescript
* const client = await pool.connect();
* try {
* const adminContext = await buildAdminContextFromDb(client);
* // Use adminContext in test...
* } finally {
* client.release();
* }
* ```
*/
export declare function buildAdminContextFromDb(client: PoolClient, businessName?: string): Promise<AdminContext>;