Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

581 B
Raw Blame
import { schema } from "../database";
import type { DbOrTx } from "./db-or-tx";
import { getMemberProjectAccess } from "./get-member-project-access";

export async function grantProjectToRestrictedMember(
  database: DbOrTx,
  grant: { workspaceId: string; userId: string; projectId: string },
): Promise<void> {
  const access = await getMemberProjectAccess(
    grant.workspaceId,
    grant.userId,
    database,
  );
  if (access.projectAccess === "all") return;

  await database
    .insert(schema.workspaceMemberProjectTable)
    .values(grant)
    .onConflictDoNothing();
}