kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 39e2dfae265f26c8d6d888a560f50ab2d5d58b3f 44 lines 1.1 kB view raw
1import db from "../../database"; 2import { columnTable, projectTable } from "../../database/schema"; 3 4export const DEFAULT_PROJECT_COLUMNS = [ 5 { name: "To Do", slug: "to-do", position: 0, isFinal: false }, 6 { name: "In Progress", slug: "in-progress", position: 1, isFinal: false }, 7 { name: "In Review", slug: "in-review", position: 2, isFinal: false }, 8 { name: "Done", slug: "done", position: 3, isFinal: true }, 9] as const; 10 11async function createProject( 12 workspaceId: string, 13 name: string, 14 icon: string, 15 slug: string, 16) { 17 return db.transaction(async (tx) => { 18 const [createdProject] = await tx 19 .insert(projectTable) 20 .values({ 21 workspaceId, 22 name, 23 icon, 24 slug, 25 }) 26 .returning(); 27 28 if (createdProject) { 29 for (const col of DEFAULT_PROJECT_COLUMNS) { 30 await tx.insert(columnTable).values({ 31 projectId: createdProject.id, 32 name: col.name, 33 slug: col.slug, 34 position: col.position, 35 isFinal: col.isFinal, 36 }); 37 } 38 } 39 40 return createdProject; 41 }); 42} 43 44export default createProject;