Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
plan changed to team
Aashish-Upadhyay-1017a85753e9aa5
diff --git a/components/Sidebar.tsx b/components/Sidebar.tsxindex 57356d15..34e87eb0 100644--- a/components/Sidebar.tsx+++ b/components/Sidebar.tsx@@ -10,7 +10,6 @@ import ChevronUp from "@/components/shared/icons/chevron-up";import X from "@/components/shared/icons/x";import Link from "next/link";import { cn } from "@/lib/utils";-import { cn } from "@/lib/utils";import { useRouter } from "next/router";import { ModeToggle } from "./theme-toggle";import LoadingSpinner from "./ui/loading-spinner";@@ -138,6 +137,12 @@ export default function Sidebar() {</p></div><nav className="flex flex-1 flex-col">+ <SelectTeam+ currentTeam={currentTeam}+ teams={teams}+ isLoading={isLoading}+ setCurrentTeam={() => {}}+ /><ul role="list" className="flex flex-1 flex-col gap-y-7"><li><ul role="list" className="-mx-2 space-y-1">diff --git a/pages/api/teams/[teamId]/billing/plan.ts b/pages/api/teams/[teamId]/billing/plan.tsindex 2e2dec71..137f9f98 100644--- a/pages/api/teams/[teamId]/billing/plan.ts+++ b/pages/api/teams/[teamId]/billing/plan.ts@@ -2,22 +2,23 @@ import { NextApiRequest, NextApiResponse } from "next";import { getServerSession } from "next-auth/next";import prisma from "@/lib/prisma";import { authOptions } from "../../../auth/[...nextauth]";-import { CustomUser } from "@/lib/types";export default async function handle(req: NextApiRequest,res: NextApiResponse) {if (req.method === "GET") {- // GET /api/billing/plan+ // GET /api/teams/:teamId/billing/planconst session = await getServerSession(req, res, authOptions);if (!session) {return res.status(401).end("Unauthorized");}- const user = await prisma.user.findUnique({+ const { teamId } = req.query as { teamId: string };++ const team = await prisma.team.findUnique({where: {- id: (session.user as CustomUser).id,+ id: teamId,},select: {plan: true,@@ -25,7 +26,7 @@ export default async function handle(});// console.log("Domains from GET", domains)- return res.status(200).json(user);+ return res.status(200).json(team);} else {// We only allow GET and POST requestsres.setHeader("Allow", ["GET"]);