refactor: add server side validation schema for apiKeys (#4859)

* refactor: add tests for apiKey api routes

* refactor: move files to subfolder

* refactor: schema for apiKeys.create and apiKeys.delete
This commit is contained in:
Mohamed ELIDRISSI
2023-02-12 00:02:52 +01:00
committed by GitHub
parent 9302beb630
commit 492beedf00
4 changed files with 104 additions and 6 deletions

View File

@@ -0,0 +1,20 @@
import { z } from "zod";
import BaseSchema from "@server/routes/api/BaseSchema";
export const APIKeysCreateSchema = BaseSchema.extend({
body: z.object({
/** API Key name */
name: z.string(),
}),
});
export type APIKeysCreateReq = z.infer<typeof APIKeysCreateSchema>;
export const APIKeysDeleteSchema = BaseSchema.extend({
body: z.object({
/** API Key Id */
id: z.string().uuid(),
}),
});
export type APIKeysDeleteReq = z.infer<typeof APIKeysDeleteSchema>;