Drop pre-merge access source count check
Scoped rows in the MERGE desired_sources CTE already limit snapshots to sources visible under the scoper. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
@@ -166,27 +166,6 @@ func (sources *AccessReviewCampaignSources) MergeByCampaignID(
|
|||||||
sourceIDStrings[i] = id.String()
|
sourceIDStrings[i] = id.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
countQ := `
|
|
||||||
SELECT COUNT(DISTINCT id)
|
|
||||||
FROM access_review_sources
|
|
||||||
WHERE
|
|
||||||
%s
|
|
||||||
AND id = ANY(@access_review_source_ids::text[])
|
|
||||||
`
|
|
||||||
countQ = fmt.Sprintf(countQ, scope.SQLFragment())
|
|
||||||
|
|
||||||
countArgs := pgx.StrictNamedArgs{"access_review_source_ids": sourceIDStrings}
|
|
||||||
maps.Copy(countArgs, scope.SQLArguments())
|
|
||||||
|
|
||||||
var found int
|
|
||||||
if err := conn.QueryRow(ctx, countQ, countArgs).Scan(&found); err != nil {
|
|
||||||
return fmt.Errorf("cannot count access review sources: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if found != len(uniqueSourceIDs) {
|
|
||||||
return ErrResourceNotFound
|
|
||||||
}
|
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
q := `
|
q := `
|
||||||
|
|||||||
Reference in New Issue
Block a user