feat: 更新sheet类型校验为SheetProxy类型
All checks were successful
Egg CI/CD / build-image (push) Successful in 28s
Egg CI/CD / deploy (push) Successful in 21s

This commit is contained in:
zhaoyingbo 2024-07-12 10:13:23 +00:00
parent af2ee9a775
commit 0c6ab743db
2 changed files with 5 additions and 5 deletions

View File

@ -1,9 +1,9 @@
import db from "../../db";
import service from "../../services";
import netTool from "../../services/netTool";
import { Sheet } from "../../types/sheet";
import { SheetProxy } from "../../types/sheetProxy";
const validateSheetReq = async (body: Sheet.Body) => {
const validateSheetReq = async (body: SheetProxy.Body) => {
if (!body.api_key) {
return netTool.badRequest("api_key is required");
}
@ -17,14 +17,14 @@ const validateSheetReq = async (body: Sheet.Body) => {
return netTool.badRequest("values is required");
}
if (!Sheet.isType(body.type)) {
if (!SheetProxy.isType(body.type)) {
return netTool.badRequest("type is invalid");
}
return false;
};
export const manageSheetReq = async (req: Request) => {
const body = (await req.json()) as Sheet.Body;
const body = (await req.json()) as SheetProxy.Body;
// 校验参数
const validateRes = await validateSheetReq(body);
if (validateRes) return validateRes;

View File

@ -1,4 +1,4 @@
export namespace Sheet {
export namespace SheetProxy {
export enum Type {
Insert = "insert",
}