From 929c148c56380df548cc45fd3d199c99f3392c06 Mon Sep 17 00:00:00 2001 From: Kingsmai Date: Mon, 11 May 2026 20:39:40 +0800 Subject: [PATCH] feat(items): add food category to item usage options Update items table CHECK constraint to allow 'food' usage_key Add 'food' to itemUsageOptions in backend queries with translations Update design documentation to include the new category --- DESIGN.md | 1 + backend/db/schema.sql | 2 +- backend/src/queries.ts | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 33de24f..0ae6819 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -663,6 +663,7 @@ Pokemon 详情页展示: - Relaxation - Toy - Road + - Food - 入手方式:可多选 - 客制化: - 染色能力:`dyeability`,使用互斥枚举值维护: diff --git a/backend/db/schema.sql b/backend/db/schema.sql index 215a7b1..a65340f 100644 --- a/backend/db/schema.sql +++ b/backend/db/schema.sql @@ -1214,7 +1214,7 @@ CREATE TABLE IF NOT EXISTS items ( ancient_artifact_category_key IS NULL OR ancient_artifact_category_key IN ('lost-relics-l', 'lost-relics-s', 'fossils') ), - CHECK (usage_key IS NULL OR usage_key IN ('decoration', 'relaxation', 'toy', 'road')) + CHECK (usage_key IS NULL OR usage_key IN ('decoration', 'relaxation', 'toy', 'road', 'food')) ); CREATE TABLE IF NOT EXISTS recipes ( diff --git a/backend/src/queries.ts b/backend/src/queries.ts index 063e8a2..c730276 100644 --- a/backend/src/queries.ts +++ b/backend/src/queries.ts @@ -718,7 +718,8 @@ const itemUsageOptions = [ { id: 1, key: 'decoration', labels: { en: 'Decoration', 'zh-CN': '装饰' } }, { id: 2, key: 'relaxation', labels: { en: 'Relaxation', 'zh-CN': '休闲' } }, { id: 3, key: 'toy', labels: { en: 'Toy', 'zh-CN': '玩具' } }, - { id: 4, key: 'road', labels: { en: 'Road', 'zh-CN': '道路' } } + { id: 4, key: 'road', labels: { en: 'Road', 'zh-CN': '道路' } }, + { id: 5, key: 'food', labels: { en: 'Food', 'zh-CN': '食物' } } ] as const satisfies readonly SystemListOption[]; const ancientArtifactCategoryOptions = [