Kaynağa Gözat

修正文件分类后端api路由查询表名为file_categories
将react版本降为18.3.1

yourname 6 ay önce
ebeveyn
işleme
ae2ba8a916
3 değiştirilmiş dosya ile 21 ekleme ve 19 silme
  1. 4 0
      HISTORY.md
  2. 12 14
      deno.json
  3. 5 5
      server/routes_file_category.ts

+ 4 - 0
HISTORY.md

@@ -2,6 +2,10 @@
 待实现
 迁移管理页面,在正式环境中,需要验证env中配置的密码参数才能打开
 
+2025.05.15 0.1.6
+修正文件分类后端api路由查询表名为file_categories
+将react版本降为18.3.1
+
 2025.05.14 0.1.5
 优化ErrorPage样式,补充了NotFoundPage
 deno.json中去掉 没用的 @testing-library,jsDom

+ 12 - 14
deno.json

@@ -17,20 +17,18 @@
     "@d8d-appcontainer/types": "https://esm.d8d.fun/@d8d-appcontainer/types@3.0.47",
     "@d8d-appcontainer/api": "https://esm.d8d.fun/@d8d-appcontainer/api@3.0.47",
     "lodash": "https://esm.d8d.fun/lodash@4.17.21",
-    "react": "https://esm.d8d.fun/react@19.0.0?dev",
-    "react-dom": "https://esm.d8d.fun/react-dom@19.0.0?dev",
-    "react-dom/client": "https://esm.d8d.fun/react-dom@19.0.0/client?dev",
-    "react-router": "https://esm.d8d.fun/react-router@7.3.0?dev&deps=react@19.0.0,react-dom@19.0.0",
-    "antd": "https://esm.d8d.fun/antd@5.24.6?dev&standalone&deps=react@19.0.0,react-dom@19.0.0",
-    "@ant-design/v5-patch-for-react-19":"https://esm.d8d.fun/@ant-design/v5-patch-for-react-19@1.0.3?dev&standalone&deps=react@19.0.0,react-dom@19.0.0",
-    "antd/locale/zh_CN": "https://esm.d8d.fun/antd@5.24.5/locale/zh_CN?dev&standalone&deps=react@19.0.0,react-dom@19.0.0",
-    "@ant-design/icons": "https://esm.d8d.fun/@ant-design/icons@5.6.1?dev&standalone&deps=react@19.0.0,react-dom@19.0.0",
-    "@tanstack/react-query": "https://esm.d8d.fun/@tanstack/react-query@5.67.1?dev&deps=react@19.0.0,react-dom@19.0.0",
-    "@ant-design/plots": "https://esm.d8d.fun/@ant-design/plots@2.1.13?dev&deps=react@19.0.0,react-dom@19.0.0",
-    "react-hook-form": "https://esm.d8d.fun/react-hook-form@7.55.0?dev&deps=react@19.0.0,react-dom@19.0.0",
-    "@heroicons/react/24/outline": "https://esm.d8d.fun/@heroicons/react@2.1.1/24/outline?dev&deps=react@19.0.0,react-dom@19.0.0",
-    "@heroicons/react/24/solid": "https://esm.d8d.fun/@heroicons/react@2.1.1/24/solid?dev&deps=react@19.0.0,react-dom@19.0.0",
-    "@testing-library/react": "https://esm.d8d.fun/@testing-library/react@16.3.0?dev&deps=react@19.0.0,react-dom@19.0.0"
+    "react": "https://esm.d8d.fun/react@18.3.1?dev",
+    "react-dom": "https://esm.d8d.fun/react-dom@18.3.1?dev",
+    "react-dom/client": "https://esm.d8d.fun/react-dom@18.3.1/client?dev",
+    "react-router": "https://esm.d8d.fun/react-router@7.3.0?dev&deps=react@18.3.1,react-dom@18.3.1",
+    "antd": "https://esm.d8d.fun/antd@5.24.6?dev&standalone&deps=react@18.3.1,react-dom@18.3.1",
+    "antd/locale/zh_CN": "https://esm.d8d.fun/antd@5.24.5/locale/zh_CN?dev&standalone&deps=react@18.3.1,react-dom@18.3.1",
+    "@ant-design/icons": "https://esm.d8d.fun/@ant-design/icons@5.6.1?dev&standalone&deps=react@18.3.1,react-dom@18.3.1",
+    "@tanstack/react-query": "https://esm.d8d.fun/@tanstack/react-query@5.67.1?dev&deps=react@18.3.1,react-dom@18.3.1",
+    "@ant-design/plots": "https://esm.d8d.fun/@ant-design/plots@2.1.13?dev&deps=react@18.3.1,react-dom@18.3.1",
+    "react-hook-form": "https://esm.d8d.fun/react-hook-form@7.55.0?dev&deps=react@18.3.1,react-dom@18.3.1",
+    "@heroicons/react/24/outline": "https://esm.d8d.fun/@heroicons/react@2.1.1/24/outline?dev&deps=react@18.3.1,react-dom@18.3.1",
+    "@heroicons/react/24/solid": "https://esm.d8d.fun/@heroicons/react@2.1.1/24/solid?dev&deps=react@18.3.1,react-dom@18.3.1"
   },
   "compilerOptions": {
     "lib": ["dom", "dom.iterable", "esnext", "deno.ns"]

+ 5 - 5
server/routes_file_category.ts

@@ -11,7 +11,7 @@ import {
 import type { Variables, WithAuth } from "./middlewares.ts";
 
 const log = {
-  api: debug("api:sys"),
+  api: debug("api:file_categories"),
 };
 
 // 创建文件分类路由
@@ -29,7 +29,7 @@ export function createFileCategoryRoutes(withAuth: WithAuth) {
 
       const search = c.req.query("search") || "";
 
-      let query = apiClient.database.table("file_category").orderBy("id", "desc");
+      let query = apiClient.database.table("file_categories").orderBy("id", "desc");
 
       if (search) {
         query = query.where("name", "like", `%${search}%`);
@@ -66,7 +66,7 @@ export function createFileCategoryRoutes(withAuth: WithAuth) {
       }
 
       // 插入文件分类
-      const [id] = await apiClient.database.table("file_category").insert({
+      const [id] = await apiClient.database.table("file_categories").insert({
         ...data,
         created_at: apiClient.database.fn.now(),
         updated_at: apiClient.database.fn.now(),
@@ -99,7 +99,7 @@ export function createFileCategoryRoutes(withAuth: WithAuth) {
 
       // 更新文件分类
       await apiClient.database
-        .table("file_category")
+        .table("file_categories")
         .where("id", id)
         .update({
           ...data,
@@ -129,7 +129,7 @@ export function createFileCategoryRoutes(withAuth: WithAuth) {
         return c.json({ error: "无效的分类ID" }, 400);
       }
 
-      await apiClient.database.table("file_category").where("id", id).update({
+      await apiClient.database.table("file_categories").where("id", id).update({
         is_deleted: DeleteStatus.DELETED,
         updated_at: apiClient.database.fn.now(),
       });