fix: channels removed

pull/9078/head
Agusti Fernandez Pardo 2022-04-30 19:46:04 +02:00
parent 4321fec734
commit 005d0f8040
5 changed files with 21 additions and 3 deletions

View File

@ -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",

View File

@ -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());

View File

@ -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

View File

@ -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

1
types.d.ts vendored Normal file
View File

@ -0,0 +1 @@
declare module "modify-response-middleware";