cookiebanner: add TrackerResource service layer

Wire resource ingestion and add full CRUD + list/count service methods
for the new tracker_resources table.

- reportDetectedResource splits the URL into origin/path and upserts
  into tracker_resources with the uncategorised category.
- CreateTrackerResource, GetTrackerResource, UpdateTrackerResource,
  DeleteTrackerResource, MoveTrackerResourceToCategory mirror the
  tracker-pattern service surface.
- ListTrackerResourcesForCategory, CountTrackerResourcesForCategory,
  ListUncategorisedTrackerResources, CountUncategorisedTrackerResources
  provide paginated access.
- Request structs with Validate() and dedicated error sentinels.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-05-08 18:43:32 +04:00
parent 93407f6431
commit 6e07da9ab2
2 changed files with 446 additions and 4 deletions

View File

@@ -35,4 +35,7 @@ var (
ErrTrackerPatternNotFound = errors.New("tracker pattern not found")
ErrPatternAlreadyExists = errors.New("a pattern with this name already exists in this banner")
ErrSamePatternCategoryMove = errors.New("source and target cookie categories must be different")
ErrTrackerResourceNotFound = errors.New("tracker resource not found")
ErrResourceAlreadyExists = errors.New("a resource with this origin and path already exists in this banner")
ErrSameResourceCategoryMove = errors.New("source and target cookie categories must be different")
)