factory.ts (1346B)
1 import { PostgresAuthRepositoryAdapter } from "#infrastructure/postgres/auth.ts"; 2 import { PostgresCustomerInfoAdapter } from "#infrastructure/postgres/customer_info.ts"; 3 import { PostgresIDDocumentRepositoryAdapter } from "#infrastructure/postgres/iddocument.ts"; 4 import { PostgresIDDocumentListAdapter } from "#infrastructure/postgres/iddocument_list.ts"; 5 import { PostgresOAuth2FlowRepositoryAdapter } from "#infrastructure/postgres/oauth2_flow.ts"; 6 import { PostgresPhoneRepositoryAdapter } from "#infrastructure/postgres/phone.ts"; 7 import { PostgresRateLimitRepositoryAdapter } from "#infrastructure/postgres/ratelimit.ts"; 8 import { Pool } from "$postgres"; 9 10 export function createPostgresPersistance() { 11 const pool = new Pool(undefined, 4); 12 const authRepo = new PostgresAuthRepositoryAdapter(pool); 13 const phoneRepo = new PostgresPhoneRepositoryAdapter(pool); 14 const flowRepo = new PostgresOAuth2FlowRepositoryAdapter(pool); 15 const rateLimitRepo = new PostgresRateLimitRepositoryAdapter(pool); 16 const idDocumentRepo = new PostgresIDDocumentRepositoryAdapter(pool); 17 const idDocumentList = new PostgresIDDocumentListAdapter(pool); 18 const customerInfo = new PostgresCustomerInfoAdapter(pool); 19 20 return { 21 authRepo, 22 phoneRepo, 23 flowRepo, 24 rateLimitRepo, 25 idDocumentRepo, 26 idDocumentList, 27 customerInfo, 28 }; 29 }