diff --git a/pages/api/event-types/_post.ts b/pages/api/event-types/_post.ts index 417bbfdf7f..1868a35529 100644 --- a/pages/api/event-types/_post.ts +++ b/pages/api/event-types/_post.ts @@ -4,10 +4,7 @@ import type { NextApiRequest } from "next"; import { HttpError } from "@calcom/lib/http-error"; import { defaultResponder } from "@calcom/lib/server"; -import { - schemaEventTypeCreateBodyParams, - schemaEventTypeReadPublic, -} from "~/lib/validations/event-type"; +import { schemaEventTypeCreateBodyParams, schemaEventTypeReadPublic } from "~/lib/validations/event-type"; /** * @swagger @@ -62,8 +59,7 @@ async function postHandler(req: NextApiRequest) { await checkPermissions(req); - if (isAdmin && body.userId) - args = { data: { ...body, users: { connect: { id: body.userId } } } }; + if (isAdmin && body.userId) args = { data: { ...body, users: { connect: { id: body.userId } } } }; if (body.teamId) { const hasMembership = await prisma.membership.findFirst({ @@ -74,10 +70,7 @@ async function postHandler(req: NextApiRequest) { }, }); - if ( - !hasMembership?.role || - !["ADMIN", "OWNER"].includes(hasMembership.role) - ) { + if (!hasMembership?.role || !["ADMIN", "OWNER"].includes(hasMembership.role)) { throw new HttpError({ statusCode: 401, message: "No permission to create an event-type for this team`", @@ -103,8 +96,7 @@ async function checkPermissions(req: NextApiRequest) { message: "ADMIN required for `userId`", }); /* Admin users are required to pass in a userId */ - if (isAdmin && !body.userId) - throw new HttpError({ statusCode: 400, message: "`userId` required" }); + if (isAdmin && !body.userId) throw new HttpError({ statusCode: 400, message: "`userId` required" }); } export default defaultResponder(postHandler); diff --git a/pages/api/memberships/[id]/_patch.ts b/pages/api/memberships/[id]/_patch.ts index 4b8996c11c..98115eff39 100644 --- a/pages/api/memberships/[id]/_patch.ts +++ b/pages/api/memberships/[id]/_patch.ts @@ -67,10 +67,7 @@ async function checkPermissions(req: NextApiRequest) { const membership = await prisma.membership.findFirst({ where: { userId, teamId, role: { in: ["ADMIN", "OWNER"] } }, }); - if ( - !membership || - (membership.role !== "OWNER" && req.body.role === "OWNER") - ) + if (!membership || (membership.role !== "OWNER" && req.body.role === "OWNER")) throw new HttpError({ statusCode: 403, message: "Forbidden" }); } }