feat: 更新sheet类型校验为SheetProxy类型
This commit is contained in:
parent
af2ee9a775
commit
0c6ab743db
@ -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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
export namespace Sheet {
|
||||
export namespace SheetProxy {
|
||||
export enum Type {
|
||||
Insert = "insert",
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user