2022-03-25 19:17:37 +00:00
|
|
|
import { withValidation } from "next-validations";
|
|
|
|
import { z } from "zod";
|
|
|
|
|
2022-03-30 12:17:55 +00:00
|
|
|
import { baseApiParams } from "./baseApiParams";
|
|
|
|
|
2022-03-25 19:17:37 +00:00
|
|
|
// Extracted out as utility function so can be reused
|
|
|
|
// at different endpoints that require this validation.
|
2022-03-30 12:17:55 +00:00
|
|
|
export const schemaQueryIdAsString = baseApiParams
|
|
|
|
.extend({
|
|
|
|
id: z.string(),
|
2022-03-25 19:17:37 +00:00
|
|
|
})
|
|
|
|
.strict();
|
|
|
|
|
2022-03-30 12:17:55 +00:00
|
|
|
export const withValidQueryIdString = withValidation({
|
2022-03-26 00:40:43 +00:00
|
|
|
schema: schemaQueryIdAsString,
|
2022-03-25 19:17:37 +00:00
|
|
|
type: "Zod",
|
|
|
|
mode: "query",
|
|
|
|
});
|