@accounter/server
Version:
Accounter GraphQL server
30 lines (29 loc) • 931 B
TypeScript
/**
* Shared utility for seeding countries table from CountryCode enum.
* Used by both seed script and vitest global setup.
*/
import type { PoolClient } from 'pg';
/**
* Get all countries from the CountryCode enum as an array of {name, code} objects.
*/
export declare function getAllCountries(): Array<{
name: string;
code: string;
}>;
/**
* Insert all countries from CountryCode enum into the countries table.
* Uses ON CONFLICT DO NOTHING to make it idempotent.
*
* @param client - PostgreSQL client (from pool.connect() or standalone client)
* @param schema - Schema name (default: 'accounter_schema')
*/
export declare function seedCountries(client: PoolClient | {
query: PoolClient['query'];
}, schema?: string): Promise<void>;
/**
* Get a specific country by code from the CountryCode enum.
*/
export declare function getCountryByCode(code: string): {
name: string;
code: string;
} | null;