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.

641 B
Raw Blame
import createProject from "@/fetchers/project/create-project";
import importTasks, { type TaskToImport } from "@/fetchers/task/import-tasks";
import generateProjectSlug from "@/lib/generate-project-id";

export const FALLBACK_PROJECT_SLUG = "PRJ";

export async function createStarterProject({
  workspaceId,
  name,
  tasks,
}: {
  workspaceId: string;
  name: string;
  tasks: TaskToImport[];
}) {
  const project = await createProject({
    name,
    slug: generateProjectSlug(name) || FALLBACK_PROJECT_SLUG,
    workspaceId,
    icon: "Layout",
  });
  await importTasks(project.id, tasks).catch(() => undefined);
  return project.id;
}