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)
var gcmConsentTypes *[]string
if input.GcmConsentTypes != nil {
gcmConsentTypes = &input.GcmConsentTypes
}
category, err := r.cookieBanner.UpdateCookieCategory(
ctx,
scope,
@@ -466,6 +471,7 @@ func (r *mutationResolver) UpdateCookieCategory(ctx context.Context, input types
Name: input.Name,
Slug: input.Slug,
Description: input.Description,
GCMConsentTypes: gcmConsentTypes,
},
)
if err != nil {

View File

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

View File

@@ -61,17 +61,22 @@ func NewCookieCategoryEdge(c *coredata.CookieCategory, orderBy coredata.CookieCa
}
func NewCookieCategory(c *coredata.CookieCategory) *CookieCategory {
gcmConsentTypes := c.GCMConsentTypes
if gcmConsentTypes == nil {
gcmConsentTypes = []string{}
}
return &CookieCategory{
ID: c.ID,
CookieBanner: &CookieBanner{
ID: c.CookieBannerID,
},
Name: c.Name,
Slug: c.Slug,
Description: c.Description,
Kind: c.Kind,
Rank: c.Rank,
CreatedAt: c.CreatedAt,
UpdatedAt: c.UpdatedAt,
Name: c.Name,
Slug: c.Slug,
Description: c.Description,
Kind: c.Kind,
Rank: c.Rank,
GcmConsentTypes: gcmConsentTypes,
CreatedAt: c.CreatedAt,
UpdatedAt: c.UpdatedAt,
}
}