zhishi 020c971ad7 Merge branch '108' of https://github.com/HBAI-Ltd/Toonflow-app into 108
# Conflicts:
#	src/routes/project/editProject.ts
#	src/types/database.d.ts
2026-03-28 17:19:39 +08:00

41 lines
983 B
TypeScript

import express from "express";
import u from "@/utils";
import { z } from "zod";
import { success } from "@/lib/responseFormat";
import { validateFields } from "@/middleware/middleware";
const router = express.Router();
// 新增项目
export default router.post(
"/",
validateFields({
id: z.number(),
name: z.string(),
intro: z.string(),
type: z.string(),
artStyle: z.string(),
videoRatio: z.string(),
imageModel: z.string(),
videoModel: z.string(),
projectType: z.string(),
imageQuality: z.string()
}),
async (req, res) => {
const { id, name, intro, type, artStyle, videoRatio, imageModel, videoModel,imageQuality, projectType } = req.body;
await u.db("o_project").where("id", id).update({
name,
intro,
type,
artStyle,
videoRatio,
imageModel,
videoModel,
imageQuality,
projectType,
});
res.status(200).send(success({ message: "新增项目成功" }));
},
);