Skip to content

Scheduling infrastructure for absolutely everyone.

fix: channels removed

Agusti Fernandez Pardo005d0f804046
diff --git a/package.json b/package.json
index 0c1cb9556ec..42f655236a3 100644
--- a/package.json
+++ b/package.json
@@ -26,6 +26,7 @@
"dependencies": {
"@calcom/prisma": "*",
"@sentry/nextjs": "^6.19.3",
+ "modify-response-middleware": "^1.1.0",
"next": "^12.1.4",
"next-api-middleware": "^1.0.1",
"next-swagger-doc": "^0.2.1",
diff --git a/pages/api/docs.ts b/pages/api/docs.ts
index e87c6c1f5c5..1e8bcf21759 100644
--- a/pages/api/docs.ts
+++ b/pages/api/docs.ts
@@ -1,6 +1,9 @@
-import jsonSchema from "@/json-schema/json-schema.json";
import pjson from "@/package.json";
+// import cors from "cors";
+import modifyRes from "modify-response-middleware";
+import { use } from "next-api-middleware";
import { withSwagger } from "next-swagger-doc";
+import { NextApiRequest, NextApiResponse } from "next/types";
const swaggerHandler = withSwagger({
definition: {
@@ -25,4 +28,13 @@ const swaggerHandler = withSwagger({
},
apiFolder: "pages/api",
});
-export default swaggerHandler();
+
+export default use(
+ modifyRes((content: string, _req: NextApiRequest, _res: NextApiResponse) => {
+ if (content) {
+ const parsed = JSON.parse(content);
+ delete parsed.channels;
+ return Buffer.from(JSON.stringify(parsed));
+ }
+ })
+)(swaggerHandler());
diff --git a/pages/api/users/[id].ts b/pages/api/users/[id].ts
index 58d0b41d366..6b3e7ec7840 100644
--- a/pages/api/users/[id].ts
+++ b/pages/api/users/[id].ts
@@ -15,6 +15,7 @@ import { schemaUserEditBodyParams, schemaUserReadPublic } from "@lib/validations
* /users/{id}:
* get:
* summary: Find a user, returns your user if regular user.
+ * operationId: getUserById
* parameters:
* - in: path
* name: id
@@ -33,6 +34,7 @@ import { schemaUserEditBodyParams, schemaUserReadPublic } from "@lib/validations
* description: User was not found
* patch:
* summary: Edit an existing user
+ * operationId: editUserById
* parameters:
* - in: path
* name: id
@@ -51,6 +53,7 @@ import { schemaUserEditBodyParams, schemaUserReadPublic } from "@lib/validations
* description: Authorization information is missing or invalid.
* delete:
* summary: Remove an existing user
+ * operationId: deleteUserById
* parameters:
* - in: path
* name: id
diff --git a/pages/api/users/index.ts b/pages/api/users/index.ts
index 4ef860e18f6..5f6c64d6041 100644
--- a/pages/api/users/index.ts
+++ b/pages/api/users/index.ts
@@ -10,9 +10,10 @@ import { schemaUserReadPublic } from "@lib/validations/user";
* @swagger
* /users:
* get:
- * summary: Find all users (admin only), returns your user if regular user.
+ * summary: Find all users.
* tags:
* - users
+ * operationId: listUsers
* responses:
* 200:
* description: OK
diff --git a/types.d.ts b/types.d.ts
new file mode 100644
index 00000000000..9a7af651d13
--- /dev/null
+++ b/types.d.ts
@@ -0,0 +1 @@
+declare module "modify-response-middleware";