kaneo (minimalist kanban) fork to experiment adding a tangled integration
github.com/usekaneo/kaneo
1import { eq } from "drizzle-orm";
2import { HTTPException } from "hono/http-exception";
3import db from "../../database";
4import { taskTable, userTable } from "../../database/schema";
5
6async function getTask(taskId: string) {
7 const task = await db
8 .select({
9 id: taskTable.id,
10 title: taskTable.title,
11 number: taskTable.number,
12 description: taskTable.description,
13 status: taskTable.status,
14 priority: taskTable.priority,
15 dueDate: taskTable.dueDate,
16 position: taskTable.position,
17 createdAt: taskTable.createdAt,
18 userId: taskTable.userId,
19 assigneeName: userTable.name,
20 assigneeId: userTable.id,
21 projectId: taskTable.projectId,
22 })
23 .from(taskTable)
24 .leftJoin(userTable, eq(taskTable.userId, userTable.id))
25 .where(eq(taskTable.id, taskId))
26 .limit(1);
27
28 if (!task.length || !task[0]) {
29 throw new HTTPException(404, {
30 message: "Task not found",
31 });
32 }
33
34 return task[0];
35}
36
37export default getTask;