Fixes for console
This commit is contained in:
@@ -2,12 +2,10 @@ import { z } from "zod";
|
||||
|
||||
// Extracted out as utility function so can be reused
|
||||
// at different endpoints that require this validation.
|
||||
export const baseApiParams = z
|
||||
.object({
|
||||
// since we added apiKey as query param this is required by next-validations helper
|
||||
// for query params to work properly and not fail.
|
||||
apiKey: z.string().optional(),
|
||||
// version required for supporting /v1/ redirect to query in api as *?version=1
|
||||
version: z.string().optional(),
|
||||
})
|
||||
.strict();
|
||||
export const baseApiParams = z.object({
|
||||
// since we added apiKey as query param this is required by next-validations helper
|
||||
// for query params to work properly and not fail.
|
||||
apiKey: z.string().optional(),
|
||||
// version required for supporting /v1/ redirect to query in api as *?version=1
|
||||
version: z.string().optional(),
|
||||
});
|
||||
|
||||
@@ -7,11 +7,9 @@ import { baseApiParams } from "./baseApiParams";
|
||||
|
||||
// Extracted out as utility function so can be reused
|
||||
// at different endpoints that require this validation.
|
||||
export const schemaQueryUserId = baseApiParams
|
||||
.extend({
|
||||
userId: stringOrNumber,
|
||||
})
|
||||
.strict();
|
||||
export const schemaQueryUserId = baseApiParams.extend({
|
||||
userId: stringOrNumber,
|
||||
});
|
||||
|
||||
export const schemaQuerySingleOrMultipleUserIds = z.object({
|
||||
userId: z.union([stringOrNumber, z.array(stringOrNumber)]),
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import { defaultHandler } from "@calcom/lib/server";
|
||||
|
||||
import { withMiddleware } from "~/lib/helpers/withMiddleware";
|
||||
import { withValidQueryUserId } from "~/lib/validations/shared/queryUserId";
|
||||
|
||||
export default withMiddleware()(
|
||||
withValidQueryUserId(
|
||||
defaultHandler({
|
||||
GET: import("./_get"),
|
||||
PATCH: import("./_patch"),
|
||||
DELETE: import("./_delete"),
|
||||
})
|
||||
)
|
||||
defaultHandler({
|
||||
GET: import("./_get"),
|
||||
PATCH: import("./_patch"),
|
||||
DELETE: import("./_delete"),
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user