Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

687 B
Raw Blame
import { withWorkspace } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
import { NextResponse } from "next/server";

// GET /api/folders/access-requests - get access requests made by the authenticated user
export const GET = withWorkspace(
  async ({ headers, session, workspace }) => {
    const accessRequests = await prisma.folderAccessRequest.findMany({
      where: {
        userId: session.user.id,
        folder: {
          projectId: workspace.id,
        },
      },
    });

    return NextResponse.json(accessRequests, {
      headers,
    });
  },
  {
    requiredPermissions: ["folders.read"],
    requiredPlan: ["business", "advanced", "enterprise"],
  },
);