Track cookie policy generation requests on publish
Add policy_document_id and policy_generation_requested_at columns to cookie_banners and backfill banners that already have a published version, so existing live banners get a policy on the worker's first pass. Flag the banner for policy generation inside the publish transaction so generation is requested only when a cookie banner version is published, not on draft edits. Fold policy_document_id into the existing Update so the upcoming worker can persist the generated document id with the scope it already holds. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -964,6 +964,11 @@ func (s *Service) PublishCookieBannerVersion(
|
||||
return fmt.Errorf("cannot publish version: %w", err)
|
||||
}
|
||||
|
||||
banner := coredata.CookieBanner{ID: bannerID}
|
||||
if err := banner.SetPolicyGenerationRequested(ctx, tx); err != nil {
|
||||
return fmt.Errorf("cannot request cookie policy generation: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user