diff --git a/src/lib/initDB.ts b/src/lib/initDB.ts index 385cac1..3c1d951 100644 --- a/src/lib/initDB.ts +++ b/src/lib/initDB.ts @@ -97,6 +97,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise => name: "t_project", builder: (table) => { table.integer("id"); + table.string("projectType"); table.text("name"); table.text("intro"); table.text("type"); diff --git a/src/routes/project/addProject.ts b/src/routes/project/addProject.ts index c004500..9c81870 100644 --- a/src/routes/project/addProject.ts +++ b/src/routes/project/addProject.ts @@ -9,6 +9,7 @@ const router = express.Router(); export default router.post( "/", validateFields({ + projectType: z.string(), name: z.string(), intro: z.string(), type: z.string(), @@ -16,9 +17,10 @@ export default router.post( videoRatio: z.string(), }), async (req, res) => { - const { name, intro, type, artStyle, videoRatio } = req.body; + const { projectType, name, intro, type, artStyle, videoRatio } = req.body; await u.db("t_project").insert({ + projectType, name, intro, type, @@ -29,5 +31,5 @@ export default router.post( }); res.status(200).send(success({ message: "新增项目成功" })); - } + }, ); diff --git a/src/types/database.d.ts b/src/types/database.d.ts index 5afeacc..de87fc0 100644 --- a/src/types/database.d.ts +++ b/src/types/database.d.ts @@ -1,4 +1,4 @@ -// @db-hash 4073740ecb78a07f69489a53512e9b4d +// @db-hash dc7a91d1bfdbd1024a03543cfd93dfb9 //该文件由脚本自动生成,请勿手动修改 export interface t_aiModelMap { @@ -95,6 +95,7 @@ export interface t_project { 'id'?: number | null; 'intro'?: string | null; 'name'?: string | null; + 'projectType'?: string | null; 'type'?: string | null; 'userId'?: number | null; 'videoRatio'?: string | null;