修正文件分类后端api路由查询表名为file_categories

将react版本降为18.3.1
This commit is contained in:
yourname
2025-05-15 03:36:20 +00:00
parent 2232e90b2a
commit ae2ba8a916
3 changed files with 21 additions and 19 deletions

View File

@@ -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(),
});