From 0a3378afaee78e0dedb4bc54f6959f8c92629f56 Mon Sep 17 00:00:00 2001 From: kongkx Date: Tue, 8 Sep 2026 20:32:27 +0800 Subject: [PATCH] fix(categories): align taxonomy moderation --- src/api/types.gen.ts | 28 +++++++++---------- src/api/types.ts | 4 +-- .../categories/category-form-dialog.tsx | 2 +- src/routes/_authed/categories/index.tsx | 2 +- src/routes/_authed/categories/pending.tsx | 10 ++++++- 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/api/types.gen.ts b/src/api/types.gen.ts index 9aaf897..599ac99 100644 --- a/src/api/types.gen.ts +++ b/src/api/types.gen.ts @@ -50,7 +50,7 @@ export interface paths { content: { "application/json": { /** - * @example all + * @example active * @enum {string|null} */ state?: "active" | "archived" | "trashed" | "all" | null; @@ -539,7 +539,7 @@ export interface paths { */ language_code?: string; /** - * @example published + * @example draft * @enum {string} */ status?: "draft" | "awaiting_publish" | "published"; @@ -4371,7 +4371,7 @@ export interface paths { /** @example architecto */ status?: string | null; /** - * @example manual_selection + * @example instant_accept * @enum {string|null} */ dispatch_mode?: "instant_accept" | "quote" | "scheduled_booking" | "manual_selection" | null; @@ -4685,7 +4685,7 @@ export interface paths { content: { "application/json": { /** - * @example taken_by_other + * @example ignored * @enum {string|null} */ status?: "sent" | "delivered" | "viewed" | "accepted" | "rejected" | "ignored" | "expired" | "taken_by_other" | null; @@ -4879,7 +4879,7 @@ export interface paths { content: { "application/json": { /** - * @example consumed + * @example created * @enum {string|null} */ status?: "created" | "confirmed" | "started" | "consumed" | "paid" | "fulfilled" | "canceled" | null; @@ -5163,13 +5163,13 @@ export interface paths { content: { "application/json": { /** - * @example busy + * @example offline * @enum {string|null} */ status?: "offline" | "online" | "inactive" | "busy" | null; - /** @example true */ + /** @example false */ is_disabled?: boolean | null; - /** @example true */ + /** @example false */ is_verified?: boolean | null; /** * @description Must be at least 1. @@ -5448,12 +5448,12 @@ export interface paths { content: { "application/json": { /** - * @example friends + * @example public * @enum {string|null} */ visibility?: "public" | "friends" | "private" | null; /** - * @example visible + * @example all * @enum {string|null} */ status?: "blocked" | "visible" | "all" | null; @@ -5779,7 +5779,7 @@ export interface paths { content: { "application/json": { /** - * @example pending + * @example blocked * @enum {string|null} */ status?: "pending" | "blocked" | "all" | null; @@ -7664,7 +7664,7 @@ export interface paths { * @example b */ q?: string | null; - /** @example false */ + /** @example true */ status?: boolean | null; /** @example true */ is_robot?: boolean | null; @@ -10107,11 +10107,11 @@ export interface paths { content: { "application/json": { /** - * @example android + * @example web * @enum {string|null} */ platform?: "ios" | "android" | "web" | "desktop" | null; - /** @example true */ + /** @example false */ is_online?: boolean | null; /** * @description Must be at least 1. diff --git a/src/api/types.ts b/src/api/types.ts index 036903d..8f6cfca 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -204,8 +204,8 @@ export interface Category { sort_order: number is_active: boolean visibility?: string - approval_status?: 'pending' | 'approved' | 'rejected' | string - source?: string + approval_status?: 'pending' | 'approved' | 'rejected' | 'merged' + source?: 'platform' | 'admin' | 'user' created_by_uid?: string | null approved_by_uid?: string | null approved_at?: string | null diff --git a/src/features/categories/category-form-dialog.tsx b/src/features/categories/category-form-dialog.tsx index 1dbbd6e..a61a917 100644 --- a/src/features/categories/category-form-dialog.tsx +++ b/src/features/categories/category-form-dialog.tsx @@ -70,7 +70,7 @@ export function CategoryFormDialog({ open, onOpenChange, category, parent }: Cat const mutation = useMutation({ mutationFn: (values: FormValues) => { const translations: NonNullable = [ - { locale: 'zh-CN', name: values.name_zh, description: values.description_zh || null }, + { locale: 'zh-Hans', name: values.name_zh, description: values.description_zh || null }, ] if (values.name_en) { translations.push({ diff --git a/src/routes/_authed/categories/index.tsx b/src/routes/_authed/categories/index.tsx index 8d834ed..ca41978 100644 --- a/src/routes/_authed/categories/index.tsx +++ b/src/routes/_authed/categories/index.tsx @@ -141,7 +141,7 @@ function TreeNode({ {!node.is_active && 未启用} {node.approval_status === 'pending' && 待审核} - {canCreate && ( + {canCreate && node.level < 3 && ( diff --git a/src/routes/_authed/categories/pending.tsx b/src/routes/_authed/categories/pending.tsx index 8081a2b..8d9b9da 100644 --- a/src/routes/_authed/categories/pending.tsx +++ b/src/routes/_authed/categories/pending.tsx @@ -154,7 +154,15 @@ function MergeDialog({ enabled: source !== null, }) - const options = flattenTree(tree.data?.data ?? []).filter((c) => c.id !== source?.id) + const options = flattenTree(tree.data?.data ?? []).filter( + (category) => + category.id !== source?.id && + category.level === source?.level && + category.parent_id === source?.parent_id && + category.is_active && + category.visibility === 'public' && + category.approval_status === 'approved', + ) const submit = async () => { if (!source || !targetId) return