mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-11-02 22:04:20 +00:00
Drop the dual-licensed `ee/` tree entirely. All features previously
locked behind the Hanzo Dataroom Commercial License are now part of the
AGPL-3.0 core and freely available — custom domains, branded viewing,
advanced analytics, watermarks, access controls, Q&A, AI vector stores,
workflows, SAML SSO, dataroom invitations, conversations, templates.
Layout changes:
* `ee/features/{ai,conversations,workflows,permissions,storage,templates,
dataroom-invitations,access-notifications,security,conversions}/` →
`features/<name>/` (AGPL).
* `ee/limits/` → `lib/billing/limits/` with every plan resolving to an
unlimited profile (no users/links/documents/domains/datarooms cap,
conversations and watermarks always on).
* `ee/stripe/` → `lib/billing/legacy/` (already a compat shim over
`@hanzoai/commerce`; renewal-reminder webhook is now a no-op).
* `ee/features/billing/cancellation/` deleted. Pause/unpause/cancel/
retention routes now compile against `lib/billing/cancellation.ts`
stubs that return 410 Gone; `isTeamPaused`/`isTeamPausedById` in
`lib/billing/paused.ts` always report active. `CancellationModal` is
a no-op shim in `components/billing/`.
* `app/(ee)/api/*` route group folded into `app/api/*` (SAML auth,
SCIM, AI chat, workflows, FAQ, link-upload).
Build: `npm run build` green.
89 lines
2.2 KiB
TypeScript
89 lines
2.2 KiB
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
|
|
import { getVectorStoreInfo } from "@/features/ai/lib/vector-stores/get-vector-store-info";
|
|
import { authOptions } from "@/pages/api/auth/[...nextauth]";
|
|
import { getServerSession } from "next-auth";
|
|
|
|
import { getFeatureFlags } from "@/lib/featureFlags";
|
|
import prisma from "@/lib/prisma";
|
|
import { CustomUser } from "@/lib/types";
|
|
|
|
/**
|
|
* GET /api/ai/store/teams/[teamId]
|
|
* Get team vector store information
|
|
*/
|
|
export async function GET(
|
|
req: NextRequest,
|
|
{ params }: { params: { teamId: string } },
|
|
) {
|
|
try {
|
|
const { teamId } = params;
|
|
const session = await getServerSession(authOptions);
|
|
|
|
if (!session) {
|
|
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
}
|
|
|
|
const userId = (session.user as CustomUser).id;
|
|
|
|
// Verify user is member of team
|
|
const userTeam = await prisma.userTeam.findUnique({
|
|
where: {
|
|
userId_teamId: {
|
|
userId,
|
|
teamId,
|
|
},
|
|
},
|
|
});
|
|
|
|
if (!userTeam) {
|
|
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
}
|
|
|
|
// Check if AI feature is enabled for this team
|
|
const features = await getFeatureFlags({ teamId });
|
|
if (!features.ai) {
|
|
return NextResponse.json(
|
|
{ error: "AI features are not available for this team" },
|
|
{ status: 403 },
|
|
);
|
|
}
|
|
|
|
// Get team with vector store ID
|
|
const team = await prisma.team.findUnique({
|
|
where: { id: teamId },
|
|
select: {
|
|
vectorStoreId: true,
|
|
agentsEnabled: true,
|
|
},
|
|
});
|
|
|
|
if (!team) {
|
|
return NextResponse.json({ error: "Team not found" }, { status: 404 });
|
|
}
|
|
|
|
if (!team.vectorStoreId) {
|
|
return NextResponse.json({
|
|
agentsEnabled: team.agentsEnabled,
|
|
vectorStoreId: null,
|
|
info: null,
|
|
});
|
|
}
|
|
|
|
// Get vector store info
|
|
const info = await getVectorStoreInfo(team.vectorStoreId);
|
|
|
|
return NextResponse.json({
|
|
agentsEnabled: team.agentsEnabled,
|
|
vectorStoreId: team.vectorStoreId,
|
|
info,
|
|
});
|
|
} catch (error) {
|
|
console.error("Error fetching team vector store info:", error);
|
|
return NextResponse.json(
|
|
{ error: "Internal server error" },
|
|
{ status: 500 },
|
|
);
|
|
}
|
|
}
|