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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user