Add CookiePatternFilter to push adoption filtering to SQL

The adoptUncategorisedPatterns method loaded all patterns for a
banner then filtered in Go. This adds a CookiePatternFilter
(match_type + cookie_category_id) and wires it into
LoadAllByCookieBannerID so the two targeted loads only fetch
the rows they need.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-30 12:25:30 +04:00
parent 33abbfbb8f
commit edcb5ba9c7
4 changed files with 180 additions and 3 deletions

View File

@@ -531,7 +531,7 @@ func (s *Service) ensureDraftVersionForBanner(
}
var allPatterns coredata.CookiePatterns
if err := allPatterns.LoadAllByCookieBannerID(ctx, tx, scope, bannerID); err != nil {
if err := allPatterns.LoadAllByCookieBannerID(ctx, tx, scope, bannerID, nil); err != nil {
return nil, fmt.Errorf("cannot load cookie patterns: %w", err)
}