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 9a620ba2f31238f03cd28f1da5ef3838d67e4e8a 36 lines 919 B view raw
1import { and, eq } from "drizzle-orm"; 2import { HTTPException } from "hono/http-exception"; 3import db from "../../database"; 4import { projectTable } from "../../database/schema"; 5 6async function archiveProject(id: string, workspaceId: string) { 7 const [existingProject] = await db 8 .select() 9 .from(projectTable) 10 .where( 11 and(eq(projectTable.id, id), eq(projectTable.workspaceId, workspaceId)), 12 ); 13 14 if (!existingProject) { 15 throw new HTTPException(404, { 16 message: 17 "Project doesn't exist or doesn't belong to the specified workspace", 18 }); 19 } 20 21 const [archivedProject] = await db 22 .update(projectTable) 23 .set({ archivedAt: new Date() }) 24 .where(eq(projectTable.id, id)) 25 .returning(); 26 27 if (!archivedProject) { 28 throw new HTTPException(500, { 29 message: "Failed to archive project", 30 }); 31 } 32 33 return archivedProject; 34} 35 36export default archiveProject;