kaneo (minimalist kanban) fork to experiment adding a tangled integration
github.com/usekaneo/kaneo
1import { and, eq } from "drizzle-orm";
2import { HTTPException } from "hono/http-exception";
3import db from "../../database";
4import { integrationTable } from "../../database/schema";
5
6async function deleteGiteaIntegration(projectId: string) {
7 const integration = await db.query.integrationTable.findFirst({
8 where: and(
9 eq(integrationTable.projectId, projectId),
10 eq(integrationTable.type, "gitea"),
11 ),
12 });
13
14 if (!integration) {
15 throw new HTTPException(404, { message: "Gitea integration not found" });
16 }
17
18 await db
19 .delete(integrationTable)
20 .where(
21 and(
22 eq(integrationTable.projectId, projectId),
23 eq(integrationTable.type, "gitea"),
24 ),
25 );
26
27 return { success: true, message: "Gitea integration deleted" };
28}
29
30export default deleteGiteaIntegration;