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.

486 B
Raw Blame
import {
  ALL_PROJECTS_ACCESS,
  type ProjectAccessValue,
} from "./project-access-value";

export function toProjectAccessRequest(
  value: ProjectAccessValue,
  availableProjectIds: readonly string[],
): ProjectAccessValue {
  if (value.projectAccess === "all") return ALL_PROJECTS_ACCESS;
  const available = new Set(availableProjectIds);
  return {
    projectAccess: "selected",
    projectIds: [...new Set(value.projectIds)].filter((id) =>
      available.has(id),
    ),
  };
}