From 5b3f9ee95ccfd24f47c155e154e65fa569079211 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Mon, 4 Apr 2022 21:53:03 +0200 Subject: [PATCH] fix availabilities spelling --- lib/types.ts | 2 +- lib/validations/api-key.ts | 23 ----------------------- pages/api/availabilities/index.ts | 20 ++++++++++---------- pages/api/availabilities/new.ts | 4 ++-- 4 files changed, 13 insertions(+), 36 deletions(-) delete mode 100644 lib/validations/api-key.ts diff --git a/lib/types.ts b/lib/types.ts index d5a179f7b3..55c36392bb 100644 --- a/lib/types.ts +++ b/lib/types.ts @@ -70,7 +70,7 @@ export type AttendeesResponse = BaseResponse & { export type AvailabilityResponse = BaseResponse & { data?: Partial; }; -export type AvailabilitysResponse = BaseResponse & { +export type AvailabilitiesResponse = BaseResponse & { data?: Partial[]; }; diff --git a/lib/validations/api-key.ts b/lib/validations/api-key.ts deleted file mode 100644 index c0ffd6c9b3..0000000000 --- a/lib/validations/api-key.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { withValidation } from "next-validations"; -import { z } from "zod"; - -import { _ApiKeyModel as ApiKey } from "@calcom/prisma/zod"; - -export const schemaApiKeyBaseBodyParams = ApiKey.omit({ id: true, userId: true, createdAt: true }).partial(); - -const schemaApiKeyRequiredParams = z.object({ - email: z.string().email(), -}); - -export const schemaApiKeyBodyParams = schemaApiKeyBaseBodyParams.merge(schemaApiKeyRequiredParams); - -export const schemaApiKeyPublic = ApiKey.omit({ - id: true, - userId: true, -}); - -export const withValidApiKey = withValidation({ - schema: schemaApiKeyBodyParams, - type: "Zod", - mode: "body", -}); diff --git a/pages/api/availabilities/index.ts b/pages/api/availabilities/index.ts index d3a2168565..5449162d95 100644 --- a/pages/api/availabilities/index.ts +++ b/pages/api/availabilities/index.ts @@ -3,35 +3,35 @@ import type { NextApiRequest, NextApiResponse } from "next"; import prisma from "@calcom/prisma"; import { withMiddleware } from "@lib/helpers/withMiddleware"; -import { AvailabilitysResponse } from "@lib/types"; +import { AvailabilitiesResponse } from "@lib/types"; import { schemaAvailabilityPublic } from "@lib/validations/availability"; /** * @swagger - * /api/availabilites: + * /api/availabilities: * get: - * summary: Get all availabilites + * summary: Get all availabilities * tags: - * - availabilites + * - availabilities * responses: * 200: * description: OK * 401: * description: Authorization information is missing or invalid. * 404: - * description: No availabilites were found + * description: No availabilities were found */ -async function allAvailabilitys(_: NextApiRequest, res: NextApiResponse) { - const availabilites = await prisma.availability.findMany(); - const data = availabilites.map((availability) => schemaAvailabilityPublic.parse(availability)); +async function allAvailabilities(_: NextApiRequest, res: NextApiResponse) { + const availabilities = await prisma.availability.findMany(); + const data = availabilities.map((availability) => schemaAvailabilityPublic.parse(availability)); if (data) res.status(200).json({ data }); else (error: Error) => res.status(404).json({ - message: "No Availabilitys were found", + message: "No Availabilities were found", error, }); } -export default withMiddleware("HTTP_GET")(allAvailabilitys); +export default withMiddleware("HTTP_GET")(allAvailabilities); diff --git a/pages/api/availabilities/new.ts b/pages/api/availabilities/new.ts index d049a42ded..d7461ba803 100644 --- a/pages/api/availabilities/new.ts +++ b/pages/api/availabilities/new.ts @@ -12,7 +12,7 @@ import { /** * @swagger - * /api/availabilites/new: + * /api/availabilities/new: * post: * summary: Creates a new availability * requestBody: @@ -23,7 +23,7 @@ import { * schema: * $ref: '#/components/schemas/Availability' * tags: - * - availabilites + * - availabilities * responses: * 201: * description: OK, availability created