You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

18 lines
652 B

import { z } from "zod";
import { validate } from "#server/utils/validation";
import { createProject } from "../../service/projects";
const createSchema = z.object({
name: z.string().min(1, "项目名不能为空").max(100, "项目名不能超过 100 字"),
tags: z.string().max(500).nullable().optional(),
description: z.string().max(1000).nullable().optional(),
path: z.string().max(500).nullable().optional(),
});
export default defineWrappedResponseHandler(async (event) => {
const body = await readBody(event);
const data = validate(createSchema, body);
const project = await createProject(data);
return R.success(project);
});