Fix totalCount 5xx

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-06-11 16:28:59 -07:00
committed by Sacha Al Himdani
parent 87b99ea912
commit 1f94ddba95
2 changed files with 12 additions and 5 deletions

View File

@@ -68,7 +68,8 @@ func (c *Controls) CountByDocumentID(
q := `
WITH ctrl AS (
SELECT
c.id
c.id,
c.tenant_id
FROM
controls c
INNER JOIN
@@ -173,7 +174,8 @@ func (c *Controls) CountByMeasureID(
q := `
WITH ctrl AS (
SELECT
c.id
c.id,
c.tenant_id
FROM
controls c
INNER JOIN
@@ -278,7 +280,8 @@ func (c *Controls) CountByRiskID(
q := `
WITH ctrl AS (
SELECT DISTINCT
c.id
c.id,
c.tenant_id
FROM
controls c
LEFT JOIN
@@ -475,7 +478,8 @@ func (c *Controls) CountByOrganizationID(
q := `
WITH ctrl AS (
SELECT
c.id
c.id,
c.tenant_id
FROM
controls c
INNER JOIN
@@ -491,6 +495,8 @@ WHERE %s
AND %s
`
q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment())
args := pgx.StrictNamedArgs{"organization_id": organizationID}
maps.Copy(args, scope.SQLArguments())
maps.Copy(args, filter.SQLArguments())

View File

@@ -289,7 +289,8 @@ func (p *Documents) CountByControlID(
q := `
WITH plcs AS (
SELECT
p.id
p.id,
p.tenant_id
FROM
documents p
INNER JOIN