Add reorderCookieCategory mutation

Category reordering previously required two separate
updateCookieCategory calls to swap ranks, which was not
atomic. Replace with a single reorderCookieCategory mutation
that shifts all affected ranks in one SQL statement, and
remove the rank field from UpdateCookieCategoryInput.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-20 16:51:20 +04:00
parent 9511fa3bd4
commit 5094ff49df
5 changed files with 166 additions and 39 deletions

View File

@@ -169,6 +169,9 @@ extend type Mutation {
deleteCookieCategory(
input: DeleteCookieCategoryInput!
): DeleteCookieCategoryPayload!
reorderCookieCategory(
input: ReorderCookieCategoryInput!
): ReorderCookieCategoryPayload!
}
input CreateCookieBannerInput {
@@ -218,7 +221,6 @@ input UpdateCookieCategoryInput {
cookieCategoryId: ID!
name: String
description: String
rank: Int
cookies: [CookieItemInput!]
}
@@ -226,6 +228,11 @@ input DeleteCookieCategoryInput {
cookieCategoryId: ID!
}
input ReorderCookieCategoryInput {
cookieCategoryId: ID!
rank: Int!
}
input CookieItemInput {
name: String!
duration: String!
@@ -271,3 +278,7 @@ type DeleteCookieCategoryPayload {
deletedCookieCategoryId: ID!
cookieBanner: CookieBanner!
}
type ReorderCookieCategoryPayload {
cookieBanner: CookieBanner!
}