Remove unused deleteCookieBannerTranslation mutation
The mutation was wired up in the GraphQL schema and resolver but never called from the console frontend. This removes the service method, request type, resolver, schema entries, and two unused error sentinels (ErrTranslationNotFound, ErrTranslationAlreadyExists). Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -146,11 +146,6 @@ type (
|
||||
Translations json.RawMessage
|
||||
}
|
||||
|
||||
DeleteCookieBannerTranslationRequest struct {
|
||||
CookieBannerID gid.GID
|
||||
Language string
|
||||
}
|
||||
|
||||
VisitorConsent struct {
|
||||
VisitorID string `json:"visitor_id"`
|
||||
Version int `json:"version"`
|
||||
@@ -311,15 +306,6 @@ func (r *UpsertCookieBannerTranslationRequest) Validate() error {
|
||||
return v.Error()
|
||||
}
|
||||
|
||||
func (r *DeleteCookieBannerTranslationRequest) Validate() error {
|
||||
v := validator.New()
|
||||
|
||||
v.Check(r.CookieBannerID, "cookie_banner_id", validator.Required(), validator.GID(coredata.CookieBannerEntityType))
|
||||
v.Check(r.Language, "language", validator.Required(), validator.SafeTextNoNewLine(10))
|
||||
|
||||
return v.Error()
|
||||
}
|
||||
|
||||
func CanonicalizeOrigin(raw string) string {
|
||||
u, err := url.Parse(raw)
|
||||
if err != nil {
|
||||
@@ -1906,40 +1892,6 @@ func (s *Service) UpsertCookieBannerTranslation(
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (s *Service) DeleteCookieBannerTranslation(
|
||||
ctx context.Context,
|
||||
scope coredata.Scoper,
|
||||
req DeleteCookieBannerTranslationRequest,
|
||||
) error {
|
||||
if err := req.Validate(); err != nil {
|
||||
return fmt.Errorf("invalid request: %w", err)
|
||||
}
|
||||
|
||||
return s.pg.WithTx(
|
||||
ctx,
|
||||
func(ctx context.Context, tx pg.Tx) error {
|
||||
var translation coredata.CookieBannerTranslation
|
||||
err := translation.LoadByCookieBannerIDAndLanguage(ctx, tx, scope, req.CookieBannerID, req.Language)
|
||||
if err != nil {
|
||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||
return ErrTranslationNotFound
|
||||
}
|
||||
return fmt.Errorf("cannot load cookie banner translation: %w", err)
|
||||
}
|
||||
|
||||
if err := translation.Delete(ctx, tx, scope); err != nil {
|
||||
return fmt.Errorf("cannot delete cookie banner translation: %w", err)
|
||||
}
|
||||
|
||||
if _, err := s.ensureDraftVersionForBanner(ctx, tx, scope, req.CookieBannerID); err != nil {
|
||||
return fmt.Errorf("cannot ensure draft version: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func (s *Service) ListCookieBannerTranslations(
|
||||
ctx context.Context,
|
||||
scope coredata.Scoper,
|
||||
|
||||
Reference in New Issue
Block a user