feat: adds bookings and more tests

This commit is contained in:
Agusti Fernandez Pardo
2022-03-26 22:29:30 +01:00
parent c0d7623beb
commit ac307f7161
38 changed files with 515 additions and 285 deletions
+20
View File
@@ -0,0 +1,20 @@
import { withValidation } from "next-validations";
import { z } from "zod";
// Extracted out as utility function so can be reused
// at different endpoints that require this validation.
const schemaQueryIdAsString = z
.object({
// since nextjs parses query params as strings,
// we need to cast them to numbers using z.transform() and parseInt()
id: z.string()
})
.strict();
const withValidQueryIdString = withValidation({
schema: schemaQueryIdAsString,
type: "Zod",
mode: "query",
});
export { schemaQueryIdAsString, withValidQueryIdString };