Constrain PostHog consent to one normal category per banner

Add a partial unique index ensuring only one category per banner can
have posthog_consent enabled. Default it to the analytics category on
banner creation, clear the previous mapping before setting a new one,
and restrict the toggle to NORMAL categories in both the service layer
and the console UI.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-24 16:35:39 +04:00
parent 7f1dffad80
commit 9fbb716b00
9 changed files with 190 additions and 27 deletions

View File

@@ -33,4 +33,5 @@ var (
ErrCookieNameAlreadyExists = errors.New("a cookie with this name already exists in this banner")
ErrCategoriesBannerMismatch = errors.New("source and target categories belong to different banners")
ErrSameCategoryMove = errors.New("source and target cookie categories must be different")
ErrPostHogConsentKindInvalid = errors.New("PostHog consent can only be enabled on normal categories")
)