Add uncategorised cookie category

Replace the `required` boolean column on cookie_categories with a `kind`
enum (NORMAL, NECESSARY, UNCATEGORISED). The Necessary category remains
undeletable and always-on for consent; the new Uncategorised category is
also undeletable but users can opt out of it.

When a category is deleted, its cookies are merged into the Uncategorised
category (lazy-created for legacy banners that don't have one yet).

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-20 19:00:00 +04:00
parent 2147cded9f
commit 7cd8c516b9
18 changed files with 207 additions and 70 deletions

View File

@@ -41,7 +41,7 @@ const createMutation = graphql`
id id
name name
description description
required kind
rank rank
cookies { cookies {
name name
@@ -94,7 +94,6 @@ export function CategoryDialog({
cookieBannerId, cookieBannerId,
name, name,
description, description,
required: false,
rank: nextRank, rank: nextRank,
}, },
connections: [connectionId], connections: [connectionId],

View File

@@ -28,14 +28,16 @@ import { CategoryDialog } from "./CategoryDialog";
const categoryListFragment = graphql` const categoryListFragment = graphql`
fragment CategoryList_cookieBanner on CookieBanner { fragment CategoryList_cookieBanner on CookieBanner {
id id
categories(first: 50, orderBy: { field: RANK, direction: ASC }) @required(action: THROW) { categories(first: 50, orderBy: { field: RANK, direction: ASC })
@connection(key: "CategoryList_categories")
@required(action: THROW) {
__id __id
edges { edges {
node { node {
id id
name name
description description
required kind
rank rank
} }
} }
@@ -152,7 +154,7 @@ export function CategoryList({ cookieBannerKey }: CategoryListProps) {
<div className="flex items-center justify-between mb-2"> <div className="flex items-center justify-between mb-2">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="font-medium">{category.name}</span> <span className="font-medium">{category.name}</span>
{category.required && ( {category.kind === "NECESSARY" && (
<Badge variant="neutral">{__("Required")}</Badge> <Badge variant="neutral">{__("Required")}</Badge>
)} )}
</div> </div>
@@ -175,7 +177,7 @@ export function CategoryList({ cookieBannerKey }: CategoryListProps) {
<IconArrowDown size={14} /> <IconArrowDown size={14} />
</button> </button>
</div> </div>
{!category.required && ( {category.kind === "NORMAL" && (
<Button <Button
variant="danger" variant="danger"
className="h-6 px-2 text-xs" className="h-6 px-2 text-xs"

View File

@@ -30,7 +30,9 @@ export const cookieBannerCookiesPageQuery = graphql`
__typename __typename
... on CookieBanner { ... on CookieBanner {
id id
categories(first: 50, orderBy: { field: RANK, direction: ASC }) @required(action: THROW) { categories(first: 50, orderBy: { field: RANK, direction: ASC })
@connection(key: "CookieBannerCookiesPage_categories")
@required(action: THROW) {
__id __id
edges { edges {
node { node {

View File

@@ -42,7 +42,7 @@ export const categorySectionFragment = graphql`
id id
name name
description description
required kind
cookies { cookies {
name name
duration duration
@@ -269,7 +269,7 @@ export function CategorySection({ categoryKey }: CategorySectionProps) {
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<span className="font-medium">{category.name}</span> <span className="font-medium">{category.name}</span>
{category.required && ( {category.kind === "NECESSARY" && (
<Badge variant="neutral">{__("Required")}</Badge> <Badge variant="neutral">{__("Required")}</Badge>
)} )}
</div> </div>
@@ -314,7 +314,7 @@ export function CategorySection({ categoryKey }: CategorySectionProps) {
editingCookieIndex === index editingCookieIndex === index
? ( ? (
<Tr key={index}> <Tr key={index}>
<Td> <Td className="pr-3">
<Input <Input
value={cookieForm.name} value={cookieForm.name}
onChange={e => onChange={e =>
@@ -322,7 +322,7 @@ export function CategorySection({ categoryKey }: CategorySectionProps) {
placeholder={__("Cookie name")} placeholder={__("Cookie name")}
/> />
</Td> </Td>
<Td> <Td className="pr-3">
<Input <Input
value={cookieForm.duration} value={cookieForm.duration}
onChange={e => onChange={e =>
@@ -333,7 +333,7 @@ export function CategorySection({ categoryKey }: CategorySectionProps) {
placeholder={__("e.g. 1 year")} placeholder={__("e.g. 1 year")}
/> />
</Td> </Td>
<Td> <Td className="pr-3">
<Input <Input
value={cookieForm.description} value={cookieForm.description}
onChange={e => onChange={e =>

View File

@@ -28,7 +28,7 @@ export interface CookieItem {
export interface Category { export interface Category {
name: string; name: string;
description: string; description: string;
required: boolean; kind: string;
cookies: CookieItem[]; cookies: CookieItem[];
} }
@@ -164,7 +164,7 @@ export class CookieBannerClient {
const consentData: Record<string, boolean> = {}; const consentData: Record<string, boolean> = {};
for (const cat of cfg.categories) { for (const cat of cfg.categories) {
consentData[cat.name] = cat.required; consentData[cat.name] = cat.kind === "NECESSARY";
} }
return this.recordConsent("REJECT_ALL", consentData); return this.recordConsent("REJECT_ALL", consentData);
@@ -177,7 +177,7 @@ export class CookieBannerClient {
const consentData: Record<string, boolean> = {}; const consentData: Record<string, boolean> = {};
for (const cat of cfg.categories) { for (const cat of cfg.categories) {
consentData[cat.name] = cat.required || !!categories[cat.name]; consentData[cat.name] = cat.kind === "NECESSARY" || !!categories[cat.name];
} }
return this.recordConsent("CUSTOMIZE", consentData); return this.recordConsent("CUSTOMIZE", consentData);

View File

@@ -57,9 +57,7 @@ export class ProboCategoryList extends ProboElement {
for (const cat of categories) { for (const cat of categories) {
const wrapper = document.createElement("probo-category"); const wrapper = document.createElement("probo-category");
wrapper.setAttribute("name", cat.name); wrapper.setAttribute("name", cat.name);
if (cat.required) { wrapper.setAttribute("kind", cat.kind);
wrapper.setAttribute("required", "");
}
wrapper.setAttribute("description", cat.description); wrapper.setAttribute("description", cat.description);
wrapper.setAttribute("cookies", JSON.stringify(cat.cookies)); wrapper.setAttribute("cookies", JSON.stringify(cat.cookies));

View File

@@ -49,7 +49,7 @@ export class ProboCategoryToggle extends ProboElement {
if (!this.category || !this.root) return; if (!this.category || !this.root) return;
const name = this.category.categoryName; const name = this.category.categoryName;
const isRequired = this.category.required; const isRequired = this.category.kind === "NECESSARY";
if (isRequired) { if (isRequired) {
this.checkbox.checked = true; this.checkbox.checked = true;

View File

@@ -21,8 +21,8 @@ export class ProboCategory extends ProboElement {
return this.getAttribute("name") ?? "Other"; return this.getAttribute("name") ?? "Other";
} }
get required(): boolean { get kind(): string {
return this.hasAttribute("required"); return this.getAttribute("kind") ?? "NORMAL";
} }
get cookies(): CookieItem[] { get cookies(): CookieItem[] {

View File

@@ -86,7 +86,7 @@ export class ProboCookieBannerRoot extends ProboElement implements ProboRootElem
const existing = this._client?.visitorConsent?.consent_data; const existing = this._client?.visitorConsent?.consent_data;
for (const cat of config.categories) { for (const cat of config.categories) {
if (cat.required) { if (cat.kind === "NECESSARY") {
draft[cat.name] = true; draft[cat.name] = true;
} else if (existing && cat.name in existing) { } else if (existing && cat.name in existing) {
draft[cat.name] = existing[cat.name]; draft[cat.name] = existing[cat.name];

View File

@@ -17,15 +17,15 @@ package cookiebanner
import "errors" import "errors"
var ( var (
ErrBannerNotFound = errors.New("cookie banner not found") ErrBannerNotFound = errors.New("cookie banner not found")
ErrCategoryNotFound = errors.New("cookie category not found") ErrCategoryNotFound = errors.New("cookie category not found")
ErrVersionNotFound = errors.New("cookie banner version not found") ErrVersionNotFound = errors.New("cookie banner version not found")
ErrBannerAlreadyActive = errors.New("cookie banner is already active") ErrBannerAlreadyActive = errors.New("cookie banner is already active")
ErrBannerAlreadyInactive = errors.New("cookie banner is already inactive") ErrBannerAlreadyInactive = errors.New("cookie banner is already inactive")
ErrVersionNotPublished = errors.New("cookie banner version is not published") ErrVersionNotPublished = errors.New("cookie banner version is not published")
ErrNoPublishedVersion = errors.New("no published cookie banner version") ErrNoPublishedVersion = errors.New("no published cookie banner version")
ErrNoDraftVersion = errors.New("no draft cookie banner version to publish") ErrNoDraftVersion = errors.New("no draft cookie banner version to publish")
ErrCannotDeleteRequiredCategory = errors.New("cannot delete required cookie category") ErrCannotDeleteSystemCategory = errors.New("cannot delete system cookie category")
ErrOriginAlreadyInUse = errors.New("origin is already used by another active cookie banner") ErrOriginAlreadyInUse = errors.New("origin is already used by another active cookie banner")
ErrConsentNotFound = errors.New("consent record not found") ErrConsentNotFound = errors.New("consent record not found")
) )

View File

@@ -41,13 +41,14 @@ func NewService(pgClient *pg.Client) *Service {
var defaultCategories = []struct { var defaultCategories = []struct {
Name string Name string
Description string Description string
Required bool Kind coredata.CookieCategoryKind
Rank int Rank int
}{ }{
{"Necessary", "Essential cookies required for the website to function properly.", true, 0}, {"Necessary", "Essential cookies required for the website to function properly.", coredata.CookieCategoryKindNecessary, 0},
{"Analytics", "Cookies that help understand how visitors interact with the website.", false, 1}, {"Analytics", "Cookies that help understand how visitors interact with the website.", coredata.CookieCategoryKindNormal, 1},
{"Advertising", "Cookies used to deliver relevant advertisements and track campaigns.", false, 2}, {"Advertising", "Cookies used to deliver relevant advertisements and track campaigns.", coredata.CookieCategoryKindNormal, 2},
{"Functional", "Cookies that enable enhanced functionality and personalization.", false, 3}, {"Functional", "Cookies that enable enhanced functionality and personalization.", coredata.CookieCategoryKindNormal, 3},
{"Uncategorised", "Cookies that have not been assigned to a category yet.", coredata.CookieCategoryKindUncategorised, 4},
} }
type ( type (
@@ -64,7 +65,6 @@ type (
CookieBannerID gid.GID CookieBannerID gid.GID
Name string Name string
Description string Description string
Required bool
Rank int Rank int
Cookies coredata.CookieItems Cookies coredata.CookieItems
} }
@@ -230,7 +230,7 @@ func buildSnapshot(
snapshotCategories[i] = coredata.CookieBannerVersionSnapshotCategory{ snapshotCategories[i] = coredata.CookieBannerVersionSnapshotCategory{
Name: c.Name, Name: c.Name,
Description: c.Description, Description: c.Description,
Required: c.Required, Kind: c.Kind,
Cookies: c.Cookies, Cookies: c.Cookies,
} }
} }
@@ -340,7 +340,7 @@ func (s *Service) CreateCookieBanner(
CookieBannerID: banner.ID, CookieBannerID: banner.ID,
Name: dc.Name, Name: dc.Name,
Description: dc.Description, Description: dc.Description,
Required: dc.Required, Kind: dc.Kind,
Rank: dc.Rank, Rank: dc.Rank,
Cookies: coredata.CookieItems{}, Cookies: coredata.CookieItems{},
CreatedAt: now, CreatedAt: now,
@@ -725,7 +725,7 @@ func (s *Service) CreateCookieCategory(
CookieBannerID: req.CookieBannerID, CookieBannerID: req.CookieBannerID,
Name: req.Name, Name: req.Name,
Description: req.Description, Description: req.Description,
Required: req.Required, Kind: coredata.CookieCategoryKindNormal,
Rank: req.Rank, Rank: req.Rank,
Cookies: cookies, Cookies: cookies,
CreatedAt: now, CreatedAt: now,
@@ -964,12 +964,43 @@ func (s *Service) DeleteCookieCategory(
return fmt.Errorf("cannot load cookie category: %w", err) return fmt.Errorf("cannot load cookie category: %w", err)
} }
if category.Required { if category.Kind != coredata.CookieCategoryKindNormal {
return ErrCannotDeleteRequiredCategory return ErrCannotDeleteSystemCategory
} }
bannerID := category.CookieBannerID bannerID := category.CookieBannerID
if len(category.Cookies) > 0 {
var uncategorised coredata.CookieCategory
err := uncategorised.LoadUncategorisedByCookieBannerID(ctx, tx, scope, bannerID)
if errors.Is(err, coredata.ErrResourceNotFound) {
now := time.Now()
uncategorised = coredata.CookieCategory{
ID: gid.New(scope.GetTenantID(), coredata.CookieCategoryEntityType),
OrganizationID: category.OrganizationID,
CookieBannerID: bannerID,
Name: "Uncategorised",
Description: "Cookies that have not been assigned to a category yet.",
Kind: coredata.CookieCategoryKindUncategorised,
Rank: category.Rank + 1,
Cookies: category.Cookies,
CreatedAt: now,
UpdatedAt: now,
}
if err := uncategorised.Insert(ctx, tx, scope); err != nil {
return fmt.Errorf("cannot create uncategorised cookie category: %w", err)
}
} else if err != nil {
return fmt.Errorf("cannot load uncategorised cookie category: %w", err)
} else {
uncategorised.Cookies = append(uncategorised.Cookies, category.Cookies...)
uncategorised.UpdatedAt = time.Now()
if err := uncategorised.Update(ctx, tx, scope); err != nil {
return fmt.Errorf("cannot update uncategorised cookie category: %w", err)
}
}
}
if err := category.Delete(ctx, tx, scope); err != nil { if err := category.Delete(ctx, tx, scope); err != nil {
return fmt.Errorf("cannot delete cookie category: %w", err) return fmt.Errorf("cannot delete cookie category: %w", err)
} }

View File

@@ -37,10 +37,10 @@ type (
} }
CookieBannerVersionSnapshotCategory struct { CookieBannerVersionSnapshotCategory struct {
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
Required bool `json:"required"` Kind CookieCategoryKind `json:"kind"`
Cookies CookieItems `json:"cookies"` Cookies CookieItems `json:"cookies"`
} }
CookieBannerVersion struct { CookieBannerVersion struct {

View File

@@ -38,16 +38,16 @@ type (
CookieItems []CookieItem CookieItems []CookieItem
CookieCategory struct { CookieCategory struct {
ID gid.GID `db:"id"` ID gid.GID `db:"id"`
OrganizationID gid.GID `db:"organization_id"` OrganizationID gid.GID `db:"organization_id"`
CookieBannerID gid.GID `db:"cookie_banner_id"` CookieBannerID gid.GID `db:"cookie_banner_id"`
Name string `db:"name"` Name string `db:"name"`
Description string `db:"description"` Description string `db:"description"`
Required bool `db:"required"` Kind CookieCategoryKind `db:"kind"`
Rank int `db:"rank"` Rank int `db:"rank"`
Cookies CookieItems `db:"cookies"` Cookies CookieItems `db:"cookies"`
CreatedAt time.Time `db:"created_at"` CreatedAt time.Time `db:"created_at"`
UpdatedAt time.Time `db:"updated_at"` UpdatedAt time.Time `db:"updated_at"`
} }
CookieCategories []*CookieCategory CookieCategories []*CookieCategory
@@ -105,7 +105,7 @@ SELECT
cookie_banner_id, cookie_banner_id,
name, name,
description, description,
required, kind,
rank, rank,
cookies, cookies,
created_at, created_at,
@@ -155,7 +155,7 @@ SELECT
cookie_banner_id, cookie_banner_id,
name, name,
description, description,
required, kind,
rank, rank,
cookies, cookies,
created_at, created_at,
@@ -233,7 +233,7 @@ SELECT
cookie_banner_id, cookie_banner_id,
name, name,
description, description,
required, kind,
rank, rank,
cookies, cookies,
created_at, created_at,
@@ -280,7 +280,7 @@ INSERT INTO cookie_categories (
cookie_banner_id, cookie_banner_id,
name, name,
description, description,
required, kind,
rank, rank,
cookies, cookies,
created_at, created_at,
@@ -292,7 +292,7 @@ INSERT INTO cookie_categories (
@cookie_banner_id, @cookie_banner_id,
@name, @name,
@description, @description,
@required, @kind,
@rank, @rank,
@cookies, @cookies,
@created_at, @created_at,
@@ -307,7 +307,7 @@ INSERT INTO cookie_categories (
"cookie_banner_id": c.CookieBannerID, "cookie_banner_id": c.CookieBannerID,
"name": c.Name, "name": c.Name,
"description": c.Description, "description": c.Description,
"required": c.Required, "kind": c.Kind,
"rank": c.Rank, "rank": c.Rank,
"cookies": c.Cookies, "cookies": c.Cookies,
"created_at": c.CreatedAt, "created_at": c.CreatedAt,
@@ -343,7 +343,7 @@ RETURNING
cookie_banner_id, cookie_banner_id,
name, name,
description, description,
required, kind,
rank, rank,
cookies, cookies,
created_at, created_at,
@@ -449,3 +449,56 @@ WHERE
return nil return nil
} }
func (c *CookieCategory) LoadUncategorisedByCookieBannerID(
ctx context.Context,
conn pg.Querier,
scope Scoper,
cookieBannerID gid.GID,
) error {
q := `
SELECT
id,
organization_id,
cookie_banner_id,
name,
description,
kind,
rank,
cookies,
created_at,
updated_at
FROM
cookie_categories
WHERE
%s
AND cookie_banner_id = @cookie_banner_id
AND kind = @kind
LIMIT 1;
`
q = fmt.Sprintf(q, scope.SQLFragment())
args := pgx.StrictNamedArgs{
"cookie_banner_id": cookieBannerID,
"kind": CookieCategoryKindUncategorised,
}
maps.Copy(args, scope.SQLArguments())
rows, err := conn.Query(ctx, q, args)
if err != nil {
return fmt.Errorf("cannot query uncategorised cookie category: %w", err)
}
category, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[CookieCategory])
if err != nil {
if errors.Is(err, pgx.ErrNoRows) {
return ErrResourceNotFound
}
return fmt.Errorf("cannot collect uncategorised cookie category: %w", err)
}
*c = category
return nil
}

View File

@@ -0,0 +1,27 @@
// Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package coredata
type CookieCategoryKind string
const (
CookieCategoryKindNormal CookieCategoryKind = "NORMAL"
CookieCategoryKindNecessary CookieCategoryKind = "NECESSARY"
CookieCategoryKindUncategorised CookieCategoryKind = "UNCATEGORISED"
)
func (k CookieCategoryKind) IsRequired() bool {
return k == CookieCategoryKindNecessary
}

View File

@@ -0,0 +1,27 @@
-- Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
CREATE TYPE cookie_category_kind AS ENUM ('NORMAL', 'NECESSARY', 'UNCATEGORISED');
ALTER TABLE cookie_categories ADD COLUMN kind cookie_category_kind NOT NULL DEFAULT 'NORMAL';
UPDATE cookie_categories SET kind = 'NECESSARY' WHERE required = TRUE;
ALTER TABLE cookie_categories ALTER COLUMN kind DROP DEFAULT;
DROP INDEX idx_cookie_categories_one_required_per_banner;
ALTER TABLE cookie_categories DROP COLUMN required;
CREATE UNIQUE INDEX idx_cookie_categories_one_necessary_per_banner
ON cookie_categories (cookie_banner_id) WHERE kind = 'NECESSARY';
CREATE UNIQUE INDEX idx_cookie_categories_one_uncategorised_per_banner
ON cookie_categories (cookie_banner_id) WHERE kind = 'UNCATEGORISED';

View File

@@ -354,7 +354,6 @@ func (r *mutationResolver) CreateCookieCategory(ctx context.Context, input types
CookieBannerID: input.CookieBannerID, CookieBannerID: input.CookieBannerID,
Name: input.Name, Name: input.Name,
Description: input.Description, Description: input.Description,
Required: input.Required,
Rank: input.Rank, Rank: input.Rank,
Cookies: cookies, Cookies: cookies,
}, },
@@ -461,7 +460,7 @@ func (r *mutationResolver) DeleteCookieCategory(ctx context.Context, input types
if errors.Is(err, cookiebanner.ErrCategoryNotFound) { if errors.Is(err, cookiebanner.ErrCategoryNotFound) {
return nil, gqlutils.NotFound(ctx, err) return nil, gqlutils.NotFound(ctx, err)
} }
if errors.Is(err, cookiebanner.ErrCannotDeleteRequiredCategory) { if errors.Is(err, cookiebanner.ErrCannotDeleteSystemCategory) {
return nil, gqlutils.Conflict(ctx, err) return nil, gqlutils.Conflict(ctx, err)
} }
r.logger.ErrorCtx(ctx, "cannot delete cookie category", log.Error(err)) r.logger.ErrorCtx(ctx, "cannot delete cookie category", log.Error(err))

View File

@@ -90,7 +90,7 @@ type CookieCategory implements Node {
cookieBanner: CookieBanner @goField(forceResolver: true) cookieBanner: CookieBanner @goField(forceResolver: true)
name: String! name: String!
description: String! description: String!
required: Boolean! kind: String!
rank: Int! rank: Int!
cookies: [CookieItem!]! cookies: [CookieItem!]!
createdAt: Datetime! createdAt: Datetime!
@@ -212,7 +212,6 @@ input CreateCookieCategoryInput {
cookieBannerId: ID! cookieBannerId: ID!
name: String! name: String!
description: String! description: String!
required: Boolean!
rank: Int! rank: Int!
cookies: [CookieItemInput!] cookies: [CookieItemInput!]
} }

View File

@@ -77,7 +77,7 @@ func NewCookieCategory(c *coredata.CookieCategory) *CookieCategory {
}, },
Name: c.Name, Name: c.Name,
Description: c.Description, Description: c.Description,
Required: c.Required, Kind: string(c.Kind),
Rank: c.Rank, Rank: c.Rank,
Cookies: cookies, Cookies: cookies,
CreatedAt: c.CreatedAt, CreatedAt: c.CreatedAt,