Scheduling infrastructure for absolutely everyone.
feat: add operationId for autogenerated sdk
Agusti Fernandez Pardo08eeb36d47e5
diff --git a/lib/validations/booking-reference.ts b/lib/validations/booking-reference.tsindex 66aabc3d885..e6f90a04507 100644--- a/lib/validations/booking-reference.ts+++ b/lib/validations/booking-reference.ts@@ -28,8 +28,8 @@ const schemaBookingReferenceCreateParams = ztype: z.string(),uid: z.string(),meetingId: z.string(),- meetingPassword: z.string(),- meetingUrl: z.string(),+ meetingPassword: z.string().optional(),+ meetingUrl: z.string().optional(),deleted: z.boolean(),}).strict();diff --git a/lib/validations/shared/timeZone.ts b/lib/validations/shared/timeZone.tsindex 9dfa98003d3..13019690d01 100644--- a/lib/validations/shared/timeZone.ts+++ b/lib/validations/shared/timeZone.ts@@ -1,5 +1,5 @@-import * as tzdb from "tzdata";+import tzdata from "tzdata";import * as z from "zod";// @note: This is a custom validation that checks if the timezone is valid and exists in the tzdb library-export const timeZone = z.string().refine((tz: string) => Object.keys(tzdb.zones).includes(tz));+export const timeZone = z.string().refine((tz: string) => Object.keys(tzdata.zones).includes(tz));diff --git a/lib/validations/user.ts b/lib/validations/user.tsindex 9eb7b050946..b70d52f8982 100644--- a/lib/validations/user.ts+++ b/lib/validations/user.ts@@ -77,6 +77,7 @@ export const schemaUserBaseBodyParams = User.pick({const schemaUserEditParams = z.object({weekStart: z.nativeEnum(weekdays).optional(),brandColor: z.string().min(4).max(9).regex(/^#/).optional(),+ darkBrandColor: z.string().min(4).max(9).regex(/^#/).optional(),timeZone: timeZone.optional(),bufferTime: z.number().min(0).max(86400).optional(),startTime: z.number().min(0).max(86400).optional(),@@ -87,7 +88,7 @@ const schemaUserEditParams = z.object({.number().refine((id: number) => id > 0).optional(),- locale: z.nativeEnum(locales),+ locale: z.nativeEnum(locales).optional(),});// @note: These are the values that are editable via PATCH method on the user Model,diff --git a/package.json b/package.jsonindex 91eca0e3cc4..5677dc043f1 100644--- a/package.json+++ b/package.json@@ -1,4 +1,4 @@-{+ {"name": "@calcom/api","version": "1.0.0","description": "Public API for Cal.com",@@ -19,21 +19,21 @@},"devDependencies": {"@calcom/tsconfig": "*",- "@typescript-eslint/eslint-plugin": "^5.16.0",- "babel-jest": "^27.5.1",- "jest": "^27.5.1",+ "@typescript-eslint/eslint-plugin": "^5.22.0",+ "babel-jest": "^28.0.3",+ "jest": "^28.0.3","node-mocks-http": "^1.11.0"},"dependencies": {"@calcom/prisma": "*",- "@sentry/nextjs": "^6.19.3",+ "@sentry/nextjs": "^6.19.7","modify-response-middleware": "^1.1.0",- "next": "^12.1.4",+ "next": "^12.1.6","next-api-middleware": "^1.0.1",- "next-swagger-doc": "^0.2.1",+ "next-swagger-doc": "^0.3.4","next-transpile-modules": "^9.0.0",- "next-validations": "^0.1.11",- "typescript": "^4.6.3",+ "next-validations": "^0.2.0",+ "typescript": "^4.6.4","tzdata": "^1.0.30"}}diff --git a/pages/api/attendees/[id].ts b/pages/api/attendees/[id].tsindex 9a2e40f1064..a1674d87a4a 100644--- a/pages/api/attendees/[id].ts+++ b/pages/api/attendees/[id].ts@@ -17,7 +17,7 @@ export async function attendeeById(const safeQuery = schemaQueryIdParseInt.safeParse(query);if (!safeQuery.success) {res.status(400).json({ error: safeQuery.error });- throw new Error("Invalid request query", safeQuery.error);+ return;}const userBookingsAttendeeIds = await prisma.booking// Find all user bookings, including attendees@@ -41,6 +41,7 @@ export async function attendeeById(* @swagger* /attendees/{id}:* get:+ * operationId: getAttendeeById* summary: Find an attendee* parameters:* - in: path@@ -48,7 +49,7 @@ export async function attendeeById(* schema:* type: integer* required: true- * description: Numeric ID of the attendee to get+ * description: ID of the attendee to get* example: 3* tags:* - attendees@@ -77,6 +78,7 @@ export async function attendeeById(* /attendees/{id}:* patch:* summary: Edit an existing attendee+ * operationId: editAttendeeById* requestBody:* description: Edit an existing attendee related to one of your bookings* required: true@@ -84,11 +86,6 @@ export async function attendeeById(* application/json:* schema:* type: object- * required:- * - bookingId- * - name- * - timeZone* properties:* email:* type: string@@ -106,7 +103,7 @@ export async function attendeeById(* type: integer* example: 3* required: true- * description: Numeric ID of the attendee to edit+ * description: ID of the attendee to edit* tags:* - attendees* responses:@@ -121,7 +118,7 @@ export async function attendeeById(const safeBody = schemaAttendeeEditBodyParams.safeParse(body);if (!safeBody.success) {res.status(400).json({ message: "Bad request", error: safeBody.error });- throw new Error("Invalid request body");+ return;}await prisma.attendee.update({ where: { id: safeQuery.data.id }, data: safeBody.data })@@ -138,6 +135,7 @@ export async function attendeeById(* @swagger* /attendees/{id}:* delete:+ * operationId: removeAttendeeById* summary: Remove an existing attendee* parameters:* - in: path@@ -145,7 +143,7 @@ export async function attendeeById(* schema:* type: integer* required: true- * description: Numeric ID of the attendee to delete+ * description: ID of the attendee to delete* tags:* - attendees* responses:diff --git a/pages/api/attendees/index.ts b/pages/api/attendees/index.tsindex 18bbce51d72..eaae0b28ffa 100644--- a/pages/api/attendees/index.ts+++ b/pages/api/attendees/index.ts@@ -1,6 +1,6 @@import type { NextApiRequest, NextApiResponse } from "next";-import prisma from "@calcom/prisma";+import db from "@calcom/prisma";import { withMiddleware } from "@lib/helpers/withMiddleware";import { AttendeeResponse, AttendeesResponse } from "@lib/types";@@ -10,7 +10,7 @@ async function createOrlistAllAttendees({ method, userId, body }: NextApiRequest,res: NextApiResponse<AttendeesResponse | AttendeeResponse>) {- const userBookings = await prisma.booking.findMany({+ const userBookings = await db.booking.findMany({where: {userId,},@@ -24,6 +24,7 @@ async function createOrlistAllAttendees(* @swagger* /attendees:* get:+ * operationId: listAttendees* summary: Find all attendees* tags:* - attendees@@ -47,6 +48,7 @@ async function createOrlistAllAttendees(* @swagger* /attendees:* post:+ * operationId: addAttendee* summary: Creates a new attendee* requestBody:* description: Create a new attendee related to one of your bookings@@ -85,21 +87,19 @@ async function createOrlistAllAttendees(*/const safePost = schemaAttendeeCreateBodyParams.safeParse(body);if (!safePost.success) {- res.status(400).json({ error: safePost.error });- throw new Error("Invalid request body", safePost.error);+ res.status(400).json({ message: "Invalid request body", error: safePost.error });+ return;}- const userWithBookings = await prisma.user.findUnique({- where: { id: userId },- include: { bookings: true },- });+ const userWithBookings = await db.user.findUnique({ where: { id: userId }, include: { bookings: true } });if (!userWithBookings) {- throw new Error("User not found");+ res.status(404).json({ message: "User not found" });+ return;}const userBookingIds = userWithBookings.bookings.map((booking: { id: number }) => booking.id).flat();// Here we make sure to only return attendee's of the user's own bookings.if (!userBookingIds.includes(safePost.data.bookingId)) res.status(401).json({ message: "Unauthorized" });else {- const data = await prisma.attendee.create({+ const data = await db.attendee.create({data: {email: safePost.data.email,name: safePost.data.name,diff --git a/pages/api/availabilities/[id].ts b/pages/api/availabilities/[id].tsindex 139e36e22f5..0b6a58c3381 100644--- a/pages/api/availabilities/[id].ts+++ b/pages/api/availabilities/[id].ts@@ -18,7 +18,10 @@ export async function availabilityById(res: NextApiResponse<AvailabilityResponse>) {const safeQuery = schemaQueryIdParseInt.safeParse(query);- if (!safeQuery.success) throw new Error("Invalid request query", safeQuery.error);+ if (!safeQuery.success) {+ res.status(400).json({ message: "Your query is invalid", error: safeQuery.error });+ return;+ }const data = await prisma.availability.findMany({ where: { userId } });const availabiltiesIds = data.map((availability) => availability.id);if (!availabiltiesIds.includes(safeQuery.data.id)) res.status(401).json({ message: "Unauthorized" });@@ -28,6 +31,7 @@ export async function availabilityById(* @swagger* /availabilities/{id}:* get:+ * operationId: getAvailabilityById* summary: Find an availability* parameters:* - in: path@@ -35,7 +39,7 @@ export async function availabilityById(* schema:* type: integer* required: true- * description: Numeric ID of the availability to get+ * description: ID of the availability to get* tags:* - availabilities* externalDocs:@@ -44,9 +48,7 @@ export async function availabilityById(* 200:* description: OK* 401:- * description: Authorization information is missing or invalid.- * 404:- * description: Availability was not found+ * description: Unathorized*/case "GET":await prisma.availability@@ -61,14 +63,32 @@ export async function availabilityById(* @swagger* /availabilities/{id}:* patch:+ * operationId: editAvailabilityById* summary: Edit an existing availability+ * requestBody:+ * description: Edit an existing availability related to one of your bookings+ * required: true+ * content:+ * application/json:+ * schema:+ * type: object+ * properties:+ * days:+ * type: array+ * example: [email protected]+ * startTime:+ * type: string+ * example: 1970-01-01T17:00:00.000Z+ * endTime:+ * type: string+ * example: 1970-01-01T17:00:00.000Z* parameters:* - in: path* name: id* schema:* type: integer* required: true- * description: Numeric ID of the availability to edit+ * description: ID of the availability to edit* tags:* - availabilities* externalDocs:@@ -82,8 +102,13 @@ export async function availabilityById(* description: Authorization information is missing or invalid.*/case "PATCH":+ console.log(body);const safeBody = schemaAvailabilityEditBodyParams.safeParse(body);- if (!safeBody.success) throw new Error("Invalid request body");+ if (!safeBody.success) {+ console.log(safeBody.error);+ res.status(400).json({ message: "Bad request" + safeBody.error, error: safeBody.error });+ return;+ }const userEventTypes = await prisma.eventType.findMany({ where: { userId } });const userEventTypesIds = userEventTypes.map((event) => event.id);if (safeBody.data.eventTypeId && !userEventTypesIds.includes(safeBody.data.eventTypeId)) {@@ -109,6 +134,7 @@ export async function availabilityById(* @swagger* /availabilities/{id}:* delete:+ * operationId: removeAvailabilityById* summary: Remove an existing availability* parameters:* - in: path@@ -116,7 +142,7 @@ export async function availabilityById(* schema:* type: integer* required: true- * description: Numeric ID of the availability to delete+ * description: ID of the availability to delete* tags:* - availabilities* externalDocs:diff --git a/pages/api/availabilities/index.ts b/pages/api/availabilities/index.tsindex c7b53c211d4..bf17bd1ede4 100644--- a/pages/api/availabilities/index.ts+++ b/pages/api/availabilities/index.ts@@ -18,6 +18,7 @@ async function createOrlistAllAvailabilities(* @swagger* /availabilities:* get:+ * operationId: listAvailabilities* summary: Find all availabilities* tags:* - availabilities@@ -45,7 +46,28 @@ async function createOrlistAllAvailabilities(* @swagger* /availabilities:* post:+ * operationId: addAvailability* summary: Creates a new availability+ * requestBody:+ * description: Edit an existing availability related to one of your bookings+ * required: true+ * content:+ * application/json:+ * schema:+ * type: object+ * required:+ * - startTime+ * - endTime+ * properties:+ * days:+ * type: array+ * example: [email protected]+ * startTime:+ * type: string+ * example: 1970-01-01T17:00:00.000Z+ * endTime:+ * type: string+ * example: 1970-01-01T17:00:00.000Z* tags:* - availabilities* externalDocs:@@ -59,7 +81,11 @@ async function createOrlistAllAvailabilities(* description: Authorization information is missing or invalid.*/const safe = schemaAvailabilityCreateBodyParams.safeParse(body);- if (!safe.success) throw new Error("Invalid request body");+ if (!safe.success) {+ res.status(400).json({ message: "Your request is invalid", error: safe.error });+ return;+ }+ // FIXME: check for eventTypeId ad scheduleId ownership if passedconst data = await prisma.availability.create({ data: { ...safe.data, userId } });const availability = schemaAvailabilityReadPublic.parse(data);diff --git a/pages/api/booking-references/[id].ts b/pages/api/booking-references/[id].tsindex 03bc87fafb3..d86d0154dca 100644--- a/pages/api/booking-references/[id].ts+++ b/pages/api/booking-references/[id].ts@@ -1,4 +1,3 @@-import { BookingModel } from "@/../../packages/prisma/zod";import type { NextApiRequest, NextApiResponse } from "next";import prisma from "@calcom/prisma";@@ -20,95 +19,120 @@ export async function bookingReferenceById() {const safeQuery = schemaQueryIdParseInt.safeParse(query);if (!safeQuery.success) throw new Error("Invalid request query", safeQuery.error);- const userWithBookings = await prisma.user.findUnique({- where: { id: userId },- include: { bookings: true },- });- if (!userWithBookings) throw new Error("User not found");- const userBookingIds = userWithBookings.bookings.map((booking: { id: number }) => booking.id).flat();- const bookingReference = await prisma.bookingReference.findUnique({ where: { id: safeQuery.data.id } });- if (!bookingReference?.bookingId) throw new Error("BookingReference: bookingId not found");- if (userBookingIds.includes(bookingReference.bookingId)) {- switch (method) {- case "GET":- /**- * @swagger- * /booking-references/{id}:- * get:- * summary: Find a booking reference- * parameters:- * - in: path- * name: id- * schema:- * type: integer- * required: true- * description: Numeric ID of the booking reference to get- * tags:- * - booking-references- * responses:- * 200:- * description: OK- * 401:- * description: Authorization information is missing or invalid.- * 404:- * description: BookingReference was not found- */+ // const userWithBookings = await prisma.user.findUnique({+ // where: { id: userId },+ // include: { bookings: true },+ // });+ // if (!userWithBookings) throw new Error("User not found");+ // const userBookingIds = userWithBookings.bookings.map((booking: { id: number }) => booking.id).flat();+ // console.log(userBookingIds);+ // const bookingReferences = await prisma.bookingReference+ // .findMany({ where: { id: { in: userBookingIds } } })+ // .then((bookingReferences) => {+ // console.log(bookingReferences);+ // return bookingReferences.map((bookingReference) => bookingReference.id);+ // });- await prisma.bookingReference- .findUnique({ where: { id: safeQuery.data.id } })- .then((data) => schemaBookingReferenceReadPublic.parse(data))- .then((booking_reference) => res.status(200).json({ booking_reference }))- .catch((error: Error) =>- res.status(404).json({- message: `BookingReference with id: ${safeQuery.data.id} not found`,- error,- })- );+ // res.status(400).json({ message: "Booking reference not found" });+ // return;+ // }+ // if (userBookingIds.includes(safeQuery.data.id)) {+ // if (!bookingReferences?.includes(safeQuery.data.id)) {+ // throw new Error("BookingReference: bookingId not found");+ switch (method) {+ case "GET":+ /**+ * @swagger+ * /booking-references/{id}:+ * get:+ * operationId: getBookingReferenceById+ * summary: Find a booking reference+ * parameters:+ * - in: path+ * name: id+ * schema:+ * type: integer+ * required: true+ * description: ID of the booking reference to get+ * tags:+ * - booking-references+ * responses:+ * 200:+ * description: OK+ * 401:+ * description: Authorization information is missing or invalid.+ * 404:+ * description: BookingReference was not found+ */+ console.log(safeQuery.data.id);+ const bookingReference = await prisma.bookingReference.findFirst().catch((error: Error) => {+ console.log("hoerr:", error);+ });+ console.log(bookingReference);+ if (!bookingReference) res.status(404).json({ message: "Booking reference not found" });+ else res.status(200).json({ booking_reference: bookingReference });- break;- case "PATCH":- /**- * @swagger- * /booking-references/{id}:- * patch:- * summary: Edit an existing booking reference- * parameters:- * - in: path- * name: id- * schema:- * type: integer- * required: true- * description: Numeric ID of the booking reference to edit- * tags:- * - booking-references- * responses:- * 201:- * description: OK, bookingReference edited successfuly- * 400:- * description: Bad request. BookingReference body is invalid.- * 401:- * description: Authorization information is missing or invalid.- */+ // .then((data) => {+ // console.log(data);+ // return schemaBookingReferenceReadPublic.parse(data);+ // })+ // .then((booking_reference) => res.status(200).json({ booking_reference }))+ // .catch((error: Error) => {+ // console.log(error);+ // res.status(404).json({+ // message: `BookingReference with id: ${safeQuery.data.id} not found`,+ // error,+ // });+ // });+ break;+ case "PATCH":+ /**+ * @swagger+ * /booking-references/{id}:+ * patch:+ * operationId: editBookingReferenceById+ * summary: Edit an existing booking reference+ * parameters:+ * - in: path+ * name: id+ * schema:+ * type: integer+ * required: true+ * description: ID of the booking reference to edit+ * tags:+ * - booking-references+ * responses:+ * 201:+ * description: OK, safeBody.data edited successfuly+ * 400:+ * description: Bad request. BookingReference body is invalid.+ * 401:+ * description: Authorization information is missing or invalid.+ */- const safeBody = schemaBookingEditBodyParams.safeParse(body);- if (!safeBody.success) {- throw new Error("Invalid request body");- }- await prisma.bookingReference- .update({ where: { id: safeQuery.data.id }, data: safeBody.data })- .then((data) => schemaBookingReferenceReadPublic.parse(data))- .then((booking_reference) => res.status(200).json({ booking_reference }))- .catch((error: Error) =>- res.status(404).json({- message: `BookingReference with id: ${safeQuery.data.id} not found`,- error,- })- );- break;+ const safeBody = schemaBookingEditBodyParams.safeParse(body);+ if (!safeBody.success) {+ res.status(401).json({ message: "Invalid request body", error: safeBody.error });+ return;+ // throw new Error("Invalid request body");+ }+ await prisma.bookingReference+ .update({ where: { id: safeQuery.data.id }, data: safeBody.data })+ .then((data) => schemaBookingReferenceReadPublic.parse(data))+ .then((booking_reference) => res.status(200).json({ booking_reference }))+ .catch((error: Error) =>+ res.status(404).json({+ message: `BookingReference with id: ${safeQuery.data.id} not found`,+ error,+ })+ );+ break;+ case "DELETE":/*** @swagger* /booking-references/{id}:* delete:+ * operationId: removeBookingReferenceById* summary: Remove an existing booking reference* parameters:* - in: path@@ -116,7 +140,7 @@ export async function bookingReferenceById(* schema:* type: integer* required: true- * description: Numeric ID of the booking reference to delete+ * description: ID of the booking reference to delete* tags:* - booking-references* responses:@@ -127,29 +151,28 @@ export async function bookingReferenceById(* 401:* description: Authorization information is missing or invalid.*/- case "DELETE":- await prisma.bookingReference- .delete({- where: { id: safeQuery.data.id },+ await prisma.bookingReference+ .delete({+ where: { id: safeQuery.data.id },+ })+ .then(() =>+ res.status(200).json({+ message: `BookingReference with id: ${safeQuery.data.id} deleted`,+ })+ )+ .catch((error: Error) =>+ res.status(404).json({+ message: `BookingReference with id: ${safeQuery.data.id} not found`,+ error,})- .then(() =>- res.status(200).json({- message: `BookingReference with id: ${safeQuery.data.id} deleted`,- })- )- .catch((error: Error) =>- res.status(404).json({- message: `BookingReference with id: ${safeQuery.data.id} not found`,- error,- })- );- break;+ );+ break;- default:- res.status(405).json({ message: "Method not allowed" });- break;- }- } else res.status(401).json({ message: "Unauthorized" });+ default:+ res.status(405).json({ message: "Method not allowed" });+ break;+ }+ // } else res.status(401).json({ message: "Unauthorized" });}export default withMiddleware("HTTP_GET_DELETE_PATCH")(diff --git a/pages/api/booking-references/index.ts b/pages/api/booking-references/index.tsindex c228673240b..3386d5e42d5 100644--- a/pages/api/booking-references/index.ts+++ b/pages/api/booking-references/index.ts@@ -24,6 +24,7 @@ async function createOrlistAllBookingReferences(* @swagger* /booking-references:* get:+ * operationId: listBookingReferences* summary: Find all booking references* tags:* - booking-references@@ -51,7 +52,37 @@ async function createOrlistAllBookingReferences(* @swagger* /booking-references:* post:+ * operationId: addBookingReference* summary: Creates a new booking reference+ * requestBody:+ * description: Create a new booking reference related to one of your bookings+ * required: true+ * content:+ * application/json:+ * schema:+ * type: object+ * required:+ * - type+ * - uid+ * - meetindId+ * - bookingId+ * - deleted+ * properties:+ * deleted:+ * type: boolean+ * example: false+ * uid:+ * type: string+ * example: '123456789'+ * type:+ * type: string+ * example: [email protected]+ * bookingId:+ * type: number+ * example: 1+ * meetingId:+ * type: string+ * example: 'meeting-id'* tags:* - booking-references* responses:@@ -64,7 +95,9 @@ async function createOrlistAllBookingReferences(*/const safe = schemaBookingCreateBodyParams.safeParse(body);if (!safe.success) {- throw new Error("Invalid request body");+ res.status(400).json({ message: "Bad request. BookingReference body is invalid", error: safe.error });+ return;+ // throw new Error("Invalid request body");}const userWithBookings = await prisma.user.findUnique({diff --git a/pages/api/bookings/[id].ts b/pages/api/bookings/[id].tsindex 21fdd9a937e..ff2f40671cd 100644--- a/pages/api/bookings/[id].ts+++ b/pages/api/bookings/[id].ts@@ -36,7 +36,7 @@ export async function bookingById(* schema:* type: integer* required: true- * description: Numeric ID of the booking to get+ * description: ID of the booking to get* tags:* - bookings* responses:@@ -70,7 +70,7 @@ export async function bookingById(* schema:* type: integer* required: true- * description: Numeric ID of the booking to edit+ * description: ID of the booking to edit* tags:* - bookings* responses:@@ -111,7 +111,7 @@ export async function bookingById(* schema:* type: integer* required: true- * description: Numeric ID of the booking to delete+ * description: ID of the booking to delete* tags:* - bookings* responses:diff --git a/pages/api/custom-inputs/[id].ts b/pages/api/custom-inputs/[id].tsindex 3339f31027f..eb5493235fd 100644--- a/pages/api/custom-inputs/[id].ts+++ b/pages/api/custom-inputs/[id].ts@@ -24,7 +24,7 @@ import {* schema:* type: integer* required: true- * description: Numeric ID of the eventTypeCustomInput to get+ * description: ID of the eventTypeCustomInput to get* tags:* - custom-inputs* responses:@@ -42,7 +42,7 @@ import {* schema:* type: integer* required: true- * description: Numeric ID of the eventTypeCustomInput to edit+ * description: ID of the eventTypeCustomInput to edit* tags:* - custom-inputs* responses:@@ -60,7 +60,7 @@ import {* schema:* type: integer* required: true- * description: Numeric ID of the eventTypeCustomInput to delete+ * description: ID of the eventTypeCustomInput to delete* tags:* - custom-inputs* responses:diff --git a/pages/api/destination-calendars/[id].ts b/pages/api/destination-calendars/[id].tsindex f5d187eb255..60e8aae6b34 100644--- a/pages/api/destination-calendars/[id].ts+++ b/pages/api/destination-calendars/[id].ts@@ -38,7 +38,7 @@ export async function destionationCalendarById(* schema:* type: integer* required: true- * description: Numeric ID of the destination calendar to get+ * description: ID of the destination calendar to get* tags:* - destination-calendars* responses:@@ -56,7 +56,7 @@ export async function destionationCalendarById(* schema:* type: integer* required: true- * description: Numeric ID of the destination calendar to edit+ * description: ID of the destination calendar to edit* tags:* - destination-calendars* responses:@@ -74,7 +74,7 @@ export async function destionationCalendarById(* schema:* type: integer* required: true- * description: Numeric ID of the destination calendar to delete+ * description: ID of the destination calendar to delete* tags:* - destination-calendars* responses:@@ -108,7 +108,7 @@ export async function destionationCalendarById(* schema:* type: integer* required: true- * description: Numeric ID of the destination calendar to edit+ * description: ID of the destination calendar to edit* tags:* - destination-calendars* responses:@@ -145,7 +145,7 @@ export async function destionationCalendarById(* schema:* type: integer* required: true- * description: Numeric ID of the destination calendar to delete+ * description: ID of the destination calendar to delete* tags:* - destination-calendars* responses:diff --git a/pages/api/docs.ts b/pages/api/docs.tsindex 943c6b9f253..d3390437418 100644--- a/pages/api/docs.ts+++ b/pages/api/docs.ts@@ -6,11 +6,11 @@ import { NextApiRequest, NextApiResponse } from "next/types";const swaggerHandler = withSwagger({definition: {- openapi: "3.0.0",+ openapi: "3.0.3",servers: [- { url: "https://api.cal.com/v1" },- { url: "https://api.cal.dev/v1" },{ url: "http://localhost:3002/v1" },+ { url: "https://api.cal.dev/v1" },+ { url: "https://api.cal.com/v1" },],externalDocs: {url: "https://docs.cal.com",@@ -24,6 +24,22 @@ const swaggerHandler = withSwagger({securitySchemes: { ApiKeyAuth: { type: "apiKey", in: "query", name: "apiKey" } },},security: [{ ApiKeyAuth: [] }],+ tags: [+ { name: "users" },+ { name: "event-types" },+ { name: "bookings" },+ { name: "attendees" },+ { name: "payments" },+ { name: "schedules" },+ { name: "teams" },+ { name: "memberships" },+ { name: "availabilities" },+ { name: "custom-inputs" },+ { name: "event-references" },+ { name: "booking-references" },+ { name: "destination-calendars" },+ { name: "selected-calendars" },+ ],},apiFolder: "pages/api",});@@ -41,6 +57,7 @@ export default use();if (content) {const parsed = JSON.parse(content);+ // HACK: This is a hack to fix the swagger-ui issue with the extra channels property.delete parsed.channels;return Buffer.from(JSON.stringify(parsed));}diff --git a/pages/api/event-references/[id].ts b/pages/api/event-references/[id].tsindex a98d5f74e9e..a6a15b9e191 100644--- a/pages/api/event-references/[id].ts+++ b/pages/api/event-references/[id].ts@@ -43,7 +43,7 @@ export async function dailyEventReferenceById(* schema:* type: integer* required: true- * description: Numeric ID of the event reference to get+ * description: ID of the event reference to get* tags:* - event-references* responses:@@ -78,7 +78,7 @@ export async function dailyEventReferenceById(* schema:* type: integer* required: true- * description: Numeric ID of the event reference to edit+ * description: ID of the event reference to edit* tags:* - event-references* responses:@@ -116,7 +116,7 @@ export async function dailyEventReferenceById(* schema:* type: integer* required: true- * description: Numeric ID of the event reference to delete+ * description: ID of the event reference to delete* tags:* - event-references* responses:diff --git a/pages/api/event-types/[id].ts b/pages/api/event-types/[id].tsindex 0ece116d17b..a6900b1d27e 100644--- a/pages/api/event-types/[id].ts+++ b/pages/api/event-types/[id].ts@@ -25,14 +25,16 @@ export async function eventTypeById(* @swagger* /event-types/{id}:* get:+ * operationId: getEventTypeById* summary: Find a eventType* parameters:* - in: path* name: id+ * example: 4* schema:* type: integer* required: true- * description: Numeric ID of the eventType to get+ * description: ID of the eventType to get* security:* - ApiKeyAuth: []* tags:@@ -63,6 +65,7 @@ export async function eventTypeById(* @swagger* /event-types/{id}:* patch:+ * operationId: editEventTypeById* summary: Edit an existing eventType* parameters:* - in: path@@ -70,7 +73,7 @@ export async function eventTypeById(* schema:* type: integer* required: true- * description: Numeric ID of the eventType to edit+ * description: ID of the eventType to edit* security:* - ApiKeyAuth: []* tags:@@ -105,6 +108,7 @@ export async function eventTypeById(* @swagger* /event-types/{id}:* delete:+ * operationId: removeEventTypeById* summary: Remove an existing eventType* parameters:* - in: path@@ -112,7 +116,7 @@ export async function eventTypeById(* schema:* type: integer* required: true- * description: Numeric ID of the eventType to delete+ * description: ID of the eventType to delete* security:* - ApiKeyAuth: []* tags:diff --git a/pages/api/payments/[id].ts b/pages/api/payments/[id].tsindex ebcaa0c504a..99d515fe45f 100644--- a/pages/api/payments/[id].ts+++ b/pages/api/payments/[id].ts@@ -21,7 +21,7 @@ import {* schema:* type: integer* required: true- * description: Numeric ID of the payment to get+ * description: ID of the payment to get* tags:* - payments* responses:diff --git a/pages/api/schedules/[id].ts b/pages/api/schedules/[id].tsindex 38066c4ab85..5b90027ac3f 100644--- a/pages/api/schedules/[id].ts+++ b/pages/api/schedules/[id].ts@@ -26,6 +26,7 @@ export async function scheduleById(* @swagger* /schedules/{id}:* get:+ * operationId: getScheduleById* summary: Find a schedule* parameters:* - in: path@@ -33,7 +34,7 @@ export async function scheduleById(* schema:* type: integer* required: true- * description: Numeric ID of the schedule to get+ * description: ID of the schedule to get* tags:* - schedules* responses:@@ -61,6 +62,7 @@ export async function scheduleById(* @swagger* /schedules/{id}:* patch:+ * operationId: editScheduleById* summary: Edit an existing schedule* parameters:* - in: path@@ -68,7 +70,7 @@ export async function scheduleById(* schema:* type: integer* required: true- * description: Numeric ID of the schedule to edit+ * description: ID of the schedule to edit* tags:* - schedules* responses:@@ -99,6 +101,7 @@ export async function scheduleById(* @swagger* /schedules/{id}:* delete:+ * operationId: removeScheduleById* summary: Remove an existing schedule* parameters:* - in: path@@ -106,7 +109,7 @@ export async function scheduleById(* schema:* type: integer* required: true- * description: Numeric ID of the schedule to delete+ * description: ID of the schedule to delete* tags:* - schedules* responses:diff --git a/pages/api/schedules/index.ts b/pages/api/schedules/index.tsindex 04dbc6b1a1e..ac002345a3e 100644--- a/pages/api/schedules/index.ts+++ b/pages/api/schedules/index.ts@@ -15,6 +15,7 @@ async function createOrlistAllSchedules(* @swagger* /schedules:* get:+ * operationId: listSchedules* summary: Find all schedules* tags:* - schedules@@ -40,6 +41,7 @@ async function createOrlistAllSchedules(* @swagger* /schedules:* post:+ * operationId: addSchedule* summary: Creates a new schedule* tags:* - schedulesdiff --git a/pages/api/selected-calendars/[id].ts b/pages/api/selected-calendars/[id].tsindex de4d7a55709..39153324122 100644--- a/pages/api/selected-calendars/[id].ts+++ b/pages/api/selected-calendars/[id].ts@@ -26,7 +26,8 @@ export async function selectedCalendarById(* @swagger* /selected-calendars/{userId}_{integration}_{externalId}:* get:- * summary: Find a selected calendar+ * operationId: getSelectedCalendarById+ * summary: Find a selected calendar by providing the compoundId(userId_integration_externalId) separated by `_`* parameters:* - in: path* name: userId@@ -81,6 +82,7 @@ export async function selectedCalendarById(* @swagger* /selected-calendars/{userId}_{integration}_{externalId}:* patch:+ * operationId: editSelectedCalendarById* summary: Edit a selected calendar* parameters:* - in: path@@ -139,6 +141,7 @@ export async function selectedCalendarById(* @swagger* /selected-calendars/{userId}_{integration}_{externalId}:* delete:+ * operationId: removeSelectedCalendarById* summary: Remove a selected calendar* parameters:* - in: pathdiff --git a/pages/api/selected-calendars/index.ts b/pages/api/selected-calendars/index.tsindex cbf2e94b814..e7ccd9d1012 100644--- a/pages/api/selected-calendars/index.ts+++ b/pages/api/selected-calendars/index.ts@@ -18,6 +18,7 @@ async function createOrlistAllSelectedCalendars(* @swagger* /selected-calendars:* get:+ * operationId: listSelectedCalendars* summary: Find all selected calendars* tags:* - selected-calendars@@ -45,6 +46,7 @@ async function createOrlistAllSelectedCalendars(* @swagger* /selected-calendars:* get:+ * operationId: addSelectedCalendars* summary: Find all selected calendars* tags:* - selected-calendarsdiff --git a/pages/api/teams/[id].ts b/pages/api/teams/[id].tsindex e49277a1435..adbc5e0c12c 100644--- a/pages/api/teams/[id].ts+++ b/pages/api/teams/[id].ts@@ -14,6 +14,7 @@ import { schemaTeamBodyParams, schemaTeamPublic } from "@lib/validations/team";* @swagger* /teams/{id}:* get:+ * operationId: getTeamById* summary: Find a team* parameters:* - in: path@@ -21,7 +22,7 @@ import { schemaTeamBodyParams, schemaTeamPublic } from "@lib/validations/team";* schema:* type: integer* required: true- * description: Numeric ID of the team to get+ * description: ID of the team to get* tags:* - teams* responses:@@ -32,6 +33,7 @@ import { schemaTeamBodyParams, schemaTeamPublic } from "@lib/validations/team";* 404:* description: Team was not found* patch:+ * operationId: editTeamById* summary: Edit an existing team* parameters:* - in: path@@ -39,7 +41,7 @@ import { schemaTeamBodyParams, schemaTeamPublic } from "@lib/validations/team";* schema:* type: integer* required: true- * description: Numeric ID of the team to edit+ * description: ID of the team to edit* tags:* - teams* responses:@@ -50,6 +52,7 @@ import { schemaTeamBodyParams, schemaTeamPublic } from "@lib/validations/team";* 401:* description: Authorization information is missing or invalid.* delete:+ * operationId: removeTeamById* summary: Remove an existing team* parameters:* - in: path@@ -57,7 +60,7 @@ import { schemaTeamBodyParams, schemaTeamPublic } from "@lib/validations/team";* schema:* type: integer* required: true- * description: Numeric ID of the team to delete+ * description: ID of the team to delete* tags:* - teams* responses:diff --git a/pages/api/teams/index.ts b/pages/api/teams/index.tsindex 75aabd47b9d..5ab45bc21d1 100644--- a/pages/api/teams/index.ts+++ b/pages/api/teams/index.ts@@ -16,6 +16,7 @@ async function createOrlistAllTeams(* @swagger* /teams:* get:+ * operationId: listTeams* summary: Find all teams* tags:* - teams@@ -44,6 +45,7 @@ async function createOrlistAllTeams(* @swagger* /teams:* post:+ * operationId: addTeam* summary: Creates a new team* tags:* - teamsdiff --git a/templates/endpoints/[id]/delete.ts b/templates/endpoints/[id]/delete.tsindex 133554ac259..79645cbdfde 100644--- a/templates/endpoints/[id]/delete.ts+++ b/templates/endpoints/[id]/delete.ts@@ -20,7 +20,7 @@ import {* schema:* type: integer* required: true- * description: Numeric ID of the resource to delete+ * description: ID of the resource to delete* tags:* - resourcesdiff --git a/templates/endpoints/[id]/edit.ts b/templates/endpoints/[id]/edit.tsindex e72198d82eb..8346840ec38 100644--- a/templates/endpoints/[id]/edit.ts+++ b/templates/endpoints/[id]/edit.ts@@ -21,7 +21,7 @@ import {* schema:* type: integer* required: true- * description: Numeric ID of the resource to edit+ * description: ID of the resource to edit* tags:* - resourcesdiff --git a/templates/endpoints/[id]/index.ts b/templates/endpoints/[id]/index.tsindex 4a0656d3b58..7933c5cab14 100644--- a/templates/endpoints/[id]/index.ts+++ b/templates/endpoints/[id]/index.ts@@ -21,7 +21,7 @@ import {* schema:* type: integer* required: true- * description: Numeric ID of the resource to get+ * description: ID of the resource to get* tags:* - resources