From 6b25ff8f48132462338b9c6587adc6ebf8c43f9a Mon Sep 17 00:00:00 2001 From: Alejandro Peralta Date: Tue, 17 Dec 2024 13:26:35 +0100 Subject: [PATCH] fix(api): Return BIGINT for project maximums as numbers are too big and out of an integer range --- api/src/modules/projects/projects.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/modules/projects/projects.service.ts b/api/src/modules/projects/projects.service.ts index cd17f263..b56ac89e 100644 --- a/api/src/modules/projects/projects.service.ts +++ b/api/src/modules/projects/projects.service.ts @@ -30,14 +30,14 @@ export class ProjectsService extends AppBaseService< ): Promise { const qb = this.dataSource .createQueryBuilder() - .select('SUM(abatement_potential)::integer', 'maxAbatementPotential') + .select('SUM(abatement_potential)::BIGINT', 'maxAbatementPotential') .from(Project, 'project'); const { costRangeSelector } = query; if (costRangeSelector == COST_TYPE_SELECTOR.NPV) { - qb.addSelect('SUM(capex_npv + opex_npv)::integer', 'maxTotalCost'); + qb.addSelect('SUM(capex_npv + opex_npv)::BIGINT', 'maxTotalCost'); } else { - qb.addSelect('SUM(capex + opex)::integer', 'maxTotalCost'); + qb.addSelect('SUM(capex + opex)::BIGINT', 'maxTotalCost'); } const totalsQuery = this.applySearchFiltersToQueryBuilder(qb, query);