Fix review

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-21 11:27:25 +04:00
parent 937a0079fc
commit 98487953b9
5 changed files with 27 additions and 4 deletions

View File

@@ -357,7 +357,7 @@ export function CategorySection({ categoryKey, onDelete }: CategorySectionProps)
editingCookieIndex === index editingCookieIndex === index
? ( ? (
<EditCookieRow <EditCookieRow
key={index} key={cookie.name}
cookie={{ cookie={{
name: cookie.name, name: cookie.name,
duration: cookie.duration, duration: cookie.duration,
@@ -369,7 +369,7 @@ export function CategorySection({ categoryKey, onDelete }: CategorySectionProps)
/> />
) )
: ( : (
<Tr key={index}> <Tr key={cookie.name}>
<Td> <Td>
<code className="text-sm font-mono">{cookie.name}</code> <code className="text-sm font-mono">{cookie.name}</code>
</Td> </Td>

View File

@@ -30,4 +30,5 @@ var (
ErrConsentNotFound = errors.New("consent record not found") ErrConsentNotFound = errors.New("consent record not found")
ErrCookieNotFound = errors.New("cookie not found in source category") ErrCookieNotFound = errors.New("cookie not found in source category")
ErrCategoriesBannerMismatch = errors.New("source and target categories belong to different banners") ErrCategoriesBannerMismatch = errors.New("source and target categories belong to different banners")
ErrSameCategoryMove = errors.New("source and target cookie categories must be different")
) )

View File

@@ -949,6 +949,10 @@ func (s *Service) MoveCookieToCategory(
return fmt.Errorf("cannot load target cookie category: %w", err) return fmt.Errorf("cannot load target cookie category: %w", err)
} }
if source.ID == target.ID {
return ErrSameCategoryMove
}
if source.CookieBannerID != target.CookieBannerID { if source.CookieBannerID != target.CookieBannerID {
return ErrCategoriesBannerMismatch return ErrCategoriesBannerMismatch
} }

View File

@@ -42,6 +42,24 @@ enum CookieCategoryOrderField
) )
} }
enum CookieCategoryKind
@goModel(
model: "go.probo.inc/probo/pkg/coredata.CookieCategoryKind"
) {
NORMAL
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.CookieCategoryKindNormal"
)
NECESSARY
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.CookieCategoryKindNecessary"
)
UNCATEGORISED
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.CookieCategoryKindUncategorised"
)
}
input CookieBannerOrder input CookieBannerOrder
@goModel( @goModel(
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.CookieBannerOrderBy" model: "go.probo.inc/probo/pkg/server/api/console/v1/types.CookieBannerOrderBy"
@@ -90,7 +108,7 @@ type CookieCategory implements Node {
cookieBanner: CookieBanner @goField(forceResolver: true) cookieBanner: CookieBanner @goField(forceResolver: true)
name: String! name: String!
description: String! description: String!
kind: String! kind: CookieCategoryKind!
rank: Int! rank: Int!
cookies: [CookieItem!]! cookies: [CookieItem!]!
createdAt: Datetime! createdAt: Datetime!

View File

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