feat: Adds teams endpoints and zod validations

This commit is contained in:
Agusti Fernandez Pardo committed 2022-03-26 01:53:56 +01:00
1 parent f2be36f89c
commit 8b8629f37a
6 files changed
+172

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import { withValidation } from "next-validations";
import { z } from "zod";
const schemaTeam = z
.object({
slug: z.string().min(3),
name: z.string().min(3),
hideBranding: z.boolean().default(false),
bio: z.string().min(3).optional(),
logo: z.string().optional(),
})
.strict(); // Adding strict so that we can disallow passing in extra fields
const withValidTeam = withValidation({
schema: schemaTeam,
type: "Zod",
mode: "body",
});
export { schemaTeam, withValidTeam };