add @lib and @api paths for cleaner imports
This commit is contained in:
1 parent
737a8897ba
commit
f4d889e87b
10 files changed
+232
-38
No files matched your search
@@ -1,15 +0,0 @@
|
||||
import { z } from "zod";
|
||||
|
||||
// Extracted out as utility function so can be reused
|
||||
// at different endpoints that require this validation.
|
||||
const schema = z
|
||||
.object({
|
||||
// since nextjs parses query params as strings,
|
||||
// we need to cast them to numbers using z.transform() and parseInt()
|
||||
id: z
|
||||
.string()
|
||||
.regex(/^\d+$/)
|
||||
.transform((id) => parseInt(id)),
|
||||
})
|
||||
.strict();
|
||||
export default schema;
|
||||
Reference in new issue
Block a user