创建项目添加项目类型

This commit is contained in:
小帅 2026-03-03 11:47:36 +08:00
parent 3153b2b79d
commit 3d3a1b4a41
3 changed files with 7 additions and 3 deletions

View File

@ -97,6 +97,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
name: "t_project", name: "t_project",
builder: (table) => { builder: (table) => {
table.integer("id"); table.integer("id");
table.string("projectType");
table.text("name"); table.text("name");
table.text("intro"); table.text("intro");
table.text("type"); table.text("type");

View File

@ -9,6 +9,7 @@ const router = express.Router();
export default router.post( export default router.post(
"/", "/",
validateFields({ validateFields({
projectType: z.string(),
name: z.string(), name: z.string(),
intro: z.string(), intro: z.string(),
type: z.string(), type: z.string(),
@ -16,9 +17,10 @@ export default router.post(
videoRatio: z.string(), videoRatio: z.string(),
}), }),
async (req, res) => { 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({ await u.db("t_project").insert({
projectType,
name, name,
intro, intro,
type, type,
@ -29,5 +31,5 @@ export default router.post(
}); });
res.status(200).send(success({ message: "新增项目成功" })); res.status(200).send(success({ message: "新增项目成功" }));
} },
); );

View File

@ -1,4 +1,4 @@
// @db-hash 4073740ecb78a07f69489a53512e9b4d // @db-hash dc7a91d1bfdbd1024a03543cfd93dfb9
//该文件由脚本自动生成,请勿手动修改 //该文件由脚本自动生成,请勿手动修改
export interface t_aiModelMap { export interface t_aiModelMap {
@ -95,6 +95,7 @@ export interface t_project {
'id'?: number | null; 'id'?: number | null;
'intro'?: string | null; 'intro'?: string | null;
'name'?: string | null; 'name'?: string | null;
'projectType'?: string | null;
'type'?: string | null; 'type'?: string | null;
'userId'?: number | null; 'userId'?: number | null;
'videoRatio'?: string | null; 'videoRatio'?: string | null;