From 597d00d53598148b72abd599434d2a74a4e627ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Thu, 7 May 2026 13:02:44 +0400 Subject: [PATCH] Remove dead code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- pkg/cookiebanner/service.go | 54 ------------------------------------- 1 file changed, 54 deletions(-) diff --git a/pkg/cookiebanner/service.go b/pkg/cookiebanner/service.go index cdc15dcd9..26cd93803 100644 --- a/pkg/cookiebanner/service.go +++ b/pkg/cookiebanner/service.go @@ -1387,60 +1387,6 @@ func (s *Service) CountCookieBannerVersionsForBanner( return count, nil } -func (s *Service) CreateCookieConsentRecord( - ctx context.Context, - scope coredata.Scoper, - req CreateCookieConsentRecordRequest, -) (*coredata.CookieConsentRecord, error) { - if err := req.Validate(); err != nil { - return nil, fmt.Errorf("invalid request: %w", err) - } - - var record *coredata.CookieConsentRecord - - err := s.pg.WithTx( - ctx, - func(ctx context.Context, tx pg.Tx) error { - var publishedVersion coredata.CookieBannerVersion - if err := publishedVersion.LoadByCookieBannerIDAndVersion(ctx, tx, scope, req.CookieBannerID, req.Version); err != nil { - if errors.Is(err, coredata.ErrResourceNotFound) { - return ErrVersionNotFound - } - return fmt.Errorf("cannot load cookie banner version: %w", err) - } - - if publishedVersion.State != coredata.CookieBannerVersionStatePublished { - return ErrVersionNotPublished - } - - record = &coredata.CookieConsentRecord{ - ID: gid.New(scope.GetTenantID(), coredata.CookieConsentRecordEntityType), - OrganizationID: publishedVersion.OrganizationID, - CookieBannerID: req.CookieBannerID, - CookieBannerVersionID: publishedVersion.ID, - VisitorID: req.VisitorID, - IPAddress: req.IPAddress, - UserAgent: req.UserAgent, - ConsentData: req.ConsentData, - Action: req.Action, - SdkVersion: req.SdkVersion, - CreatedAt: time.Now(), - } - - if err := record.Insert(ctx, tx, scope); err != nil { - return fmt.Errorf("cannot insert consent record: %w", err) - } - - return nil - }, - ) - if err != nil { - return nil, err - } - - return record, nil -} - func (s *Service) ListCookieConsentRecordsForBanner( ctx context.Context, scope coredata.Scoper,