Skip to content

Commit a172fef

Browse files
chore: improve affiliate service
1 parent 0a5d87b commit a172fef

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

apps/api/src/app/inversify.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function getAffiliateStatsCacheTtlMs(): number {
8383
}
8484

8585
const parsed = Number(rawValue);
86-
if (!Number.isFinite(parsed) || parsed <= 0) {
86+
if (!Number.isFinite(parsed) || parsed < 0) {
8787
logger.warn(
8888
`Invalid DUNE_AFFILIATE_STATS_CACHE_TTL_MS value: ${rawValue}. Using default ${DEFAULT_AFFILIATE_STATS_CACHE_TTL_MS}ms.`
8989
);

libs/services/src/AffiliateProgramExportService/AffiliateProgramExportServiceImpl.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,17 @@ export class AffiliateProgramExportServiceImpl
8989

9090
private async upload(rows: AffiliateProgramRow[]): Promise<void> {
9191
const csv = buildCsv(rows);
92-
await this.duneRepository.uploadCsv({
92+
const response = await this.duneRepository.uploadCsv({
9393
tableName: AFFILIATE_PROGRAM_TABLE_NAME,
9494
data: csv,
9595
isPrivate: true,
9696
});
97+
if (!response.success) {
98+
const message = response.message ? `: ${response.message}` : '';
99+
throw new Error(
100+
`Dune CSV upload failed for ${AFFILIATE_PROGRAM_TABLE_NAME}${message}`
101+
);
102+
}
97103
}
98104
}
99105

0 commit comments

Comments
 (0)