feat: adds api keys endpoints, new QueryIdAsString as apiKey has a UUID string-like ID unlike the numbers of event-type or others
This commit is contained in:
1 parent
c2234593db
commit
d9c34f67e6
13 files changed
+86
-65
No files matched your search
@@ -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 schemaQueryId = z
|
||||
.object({
|
||||
// since nextjs parses query params as strings,
|
||||
// we need to cast them to numbers using z.transform() and parseInt()
|
||||
id: z.string().uuid()
|
||||
})
|
||||
.strict();
|
||||
|
||||
const withValidQueryIdString = withValidation({
|
||||
schema: schemaQueryId,
|
||||
type: "Zod",
|
||||
mode: "query",
|
||||
});
|
||||
|
||||
export { schemaQueryId, withValidQueryIdString };
|
||||
@@ -14,10 +14,10 @@ const schemaQueryId = z
|
||||
})
|
||||
.strict();
|
||||
|
||||
const withValidQueryId = withValidation({
|
||||
const withValidQueryIdTransformParseInt = withValidation({
|
||||
schema: schemaQueryId,
|
||||
type: "Zod",
|
||||
mode: "query",
|
||||
});
|
||||
|
||||
export { schemaQueryId, withValidQueryId };
|
||||
export { schemaQueryId, withValidQueryIdTransformParseInt };
|
||||
Reference in new issue
Block a user