Add gcmConsentTypes to GraphQL schema and resolvers

Expose gcmConsentTypes on CookieCategory type and accept
it in UpdateCookieCategoryInput so the console can read
and write GCM consent type mappings per category.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-24 13:47:59 +04:00
parent 60705af3a2
commit 4436059483
3 changed files with 20 additions and 7 deletions

View File

@@ -458,6 +458,11 @@ func (r *mutationResolver) UpdateCookieCategory(ctx context.Context, input types
scope := coredata.NewScopeFromObjectID(input.CookieCategoryID) scope := coredata.NewScopeFromObjectID(input.CookieCategoryID)
var gcmConsentTypes *[]string
if input.GcmConsentTypes != nil {
gcmConsentTypes = &input.GcmConsentTypes
}
category, err := r.cookieBanner.UpdateCookieCategory( category, err := r.cookieBanner.UpdateCookieCategory(
ctx, ctx,
scope, scope,
@@ -466,6 +471,7 @@ func (r *mutationResolver) UpdateCookieCategory(ctx context.Context, input types
Name: input.Name, Name: input.Name,
Slug: input.Slug, Slug: input.Slug,
Description: input.Description, Description: input.Description,
GCMConsentTypes: gcmConsentTypes,
}, },
) )
if err != nil { if err != nil {

View File

@@ -123,6 +123,7 @@ type CookieCategory implements Node {
description: String! description: String!
kind: CookieCategoryKind! kind: CookieCategoryKind!
rank: Int! rank: Int!
gcmConsentTypes: [String!]!
cookies( cookies(
first: Int first: Int
@@ -308,6 +309,7 @@ input UpdateCookieCategoryInput {
name: String name: String
slug: String slug: String
description: String description: String
gcmConsentTypes: [String!]
} }
input DeleteCookieCategoryInput { input DeleteCookieCategoryInput {

View File

@@ -61,6 +61,10 @@ func NewCookieCategoryEdge(c *coredata.CookieCategory, orderBy coredata.CookieCa
} }
func NewCookieCategory(c *coredata.CookieCategory) *CookieCategory { func NewCookieCategory(c *coredata.CookieCategory) *CookieCategory {
gcmConsentTypes := c.GCMConsentTypes
if gcmConsentTypes == nil {
gcmConsentTypes = []string{}
}
return &CookieCategory{ return &CookieCategory{
ID: c.ID, ID: c.ID,
CookieBanner: &CookieBanner{ CookieBanner: &CookieBanner{
@@ -71,6 +75,7 @@ func NewCookieCategory(c *coredata.CookieCategory) *CookieCategory {
Description: c.Description, Description: c.Description,
Kind: c.Kind, Kind: c.Kind,
Rank: c.Rank, Rank: c.Rank,
GcmConsentTypes: gcmConsentTypes,
CreatedAt: c.CreatedAt, CreatedAt: c.CreatedAt,
UpdatedAt: c.UpdatedAt, UpdatedAt: c.UpdatedAt,
} }