* adds filter by email on users get for admins * swagger update * Update apps/api/pages/api/users/_get.ts Co-authored-by: Omar López <zomars@me.com> * .parse is required, also fixed some other issues --------- Co-authored-by: Omar López <zomars@me.com> Co-authored-by: Alex van Andel <me@alexvanandel.com>
21 lines
592 B
TypeScript
21 lines
592 B
TypeScript
import { withValidation } from "next-validations";
|
|
import { z } from "zod";
|
|
|
|
import { baseApiParams } from "./baseApiParams";
|
|
|
|
// Extracted out as utility function so can be reused
|
|
// at different endpoints that require this validation.
|
|
export const schemaQueryUserEmail = baseApiParams.extend({
|
|
email: z.string().email(),
|
|
});
|
|
|
|
export const schemaQuerySingleOrMultipleUserEmails = z.object({
|
|
email: z.union([z.string().email(), z.array(z.string().email())]),
|
|
});
|
|
|
|
export const withValidQueryUserEmail = withValidation({
|
|
schema: schemaQueryUserEmail,
|
|
type: "Zod",
|
|
mode: "query",
|
|
});
|