1- import { OrganizationEnrichmentSource } from '@crowd/types'
1+ import { IOrganizationEnrichmentCache , OrganizationEnrichmentSource } from '@crowd/types'
22
33import { QueryExecutor } from '../../queryExecutor'
44
@@ -7,20 +7,20 @@ export async function insertOrganizationEnrichmentCache<T>(
77 organizationId : string ,
88 data : T ,
99 source : OrganizationEnrichmentSource ,
10- ) {
11- return qx . result (
10+ ) : Promise < void > {
11+ await qx . result (
1212 `insert into "organizationEnrichmentCache" ("organizationId", "data", "source", "createdAt", "updatedAt")
1313 values ($(organizationId), $(data), $(source), now(), now())
1414 on conflict ("organizationId", "source") do update set "data" = $(data), "updatedAt" = now()` ,
1515 { organizationId, data, source } ,
1616 )
1717}
1818
19- export async function findOrganizationEnrichmentCache (
19+ export async function findOrganizationEnrichmentCache < T > (
2020 qx : QueryExecutor ,
2121 organizationId : string ,
2222 source : OrganizationEnrichmentSource ,
23- ) {
23+ ) : Promise < IOrganizationEnrichmentCache < T > | null > {
2424 return qx . selectOneOrNone (
2525 `select * from "organizationEnrichmentCache" where "organizationId" = $(organizationId) and "source" = $(source)` ,
2626 { organizationId, source } ,
@@ -32,8 +32,8 @@ export async function updateOrganizationEnrichmentCache<T>(
3232 organizationId : string ,
3333 data : T ,
3434 source : OrganizationEnrichmentSource ,
35- ) {
36- return qx . result (
35+ ) : Promise < void > {
36+ await qx . result (
3737 `update "organizationEnrichmentCache" set "data" = $(data), "updatedAt" = now() where "organizationId" = $(organizationId) and "source" = $(source)` ,
3838 { organizationId, data, source } ,
3939 )
0 commit comments