From 4c02bb960bc36af175294976e85ae30635f037e2 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Fri, 12 May 2023 00:22:24 +0200 Subject: [PATCH] Remove sessionGetter as it's deprecated (#265) Fixes API build, error introduced in https://github.com/calcom/cal.com/pull/8419 --- pages/api/teams/[teamId]/publish.ts | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/pages/api/teams/[teamId]/publish.ts b/pages/api/teams/[teamId]/publish.ts index 25f1c74785..4cf45e12fd 100644 --- a/pages/api/teams/[teamId]/publish.ts +++ b/pages/api/teams/[teamId]/publish.ts @@ -2,7 +2,7 @@ import type { NextApiRequest, NextApiResponse } from "next"; import { HttpError } from "@calcom/lib/http-error"; import { defaultHandler, defaultResponder } from "@calcom/lib/server"; -import { MembershipRole, UserPermissionRole } from "@calcom/prisma/enums"; +import { MembershipRole } from "@calcom/prisma/enums"; import { createContext } from "@calcom/trpc/server/createContext"; import { publishHandler } from "@calcom/trpc/server/routers/viewer/teams/publish.handler"; @@ -15,24 +15,9 @@ import { schemaQueryTeamId } from "~/lib/validations/shared/queryTeamId"; import authMiddleware, { checkPermissions } from "./_auth-middleware"; const patchHandler = async (req: NextApiRequest, res: NextApiResponse) => { - const { isAdmin } = req; await checkPermissions(req, { in: [MembershipRole.OWNER, MembershipRole.ADMIN] }); - - /** We shape the session as required by tRPC rounter */ - async function sessionGetter() { - return { - user: { - id: req.userId, - username: "" /* Not used in this context */, - role: isAdmin ? UserPermissionRole.ADMIN : UserPermissionRole.USER, - }, - hasValidLicense: true, - expires: "" /* Not used in this context */, - }; - } - /** @see https://trpc.io/docs/server-side-calls */ - const ctx = await createContext({ req, res }, sessionGetter); + const ctx = await createContext({ req, res }); const user = ctx.user; if (!user) { throw new Error("Internal Error.");