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 36 lines 973 B view raw
1import { asc, eq } from "drizzle-orm"; 2import db from "../../database"; 3import { commentTable, userTable } from "../../database/schema"; 4 5async function getComments(taskId: string) { 6 const comments = await db 7 .select({ 8 id: commentTable.id, 9 taskId: commentTable.taskId, 10 userId: commentTable.userId, 11 content: commentTable.content, 12 createdAt: commentTable.createdAt, 13 updatedAt: commentTable.updatedAt, 14 userName: userTable.name, 15 userImage: userTable.image, 16 }) 17 .from(commentTable) 18 .leftJoin(userTable, eq(commentTable.userId, userTable.id)) 19 .where(eq(commentTable.taskId, taskId)) 20 .orderBy(asc(commentTable.createdAt)); 21 22 return comments.map((c) => ({ 23 id: c.id, 24 taskId: c.taskId, 25 userId: c.userId, 26 content: c.content, 27 createdAt: c.createdAt, 28 updatedAt: c.updatedAt, 29 user: { 30 name: c.userName ?? "", 31 image: c.userImage, 32 }, 33 })); 34} 35 36export default getComments;