(params: { userId: string; workspaceId?: string })
| 109 | } |
| 110 | |
| 111 | export async function listCustomTools(params: { userId: string; workspaceId?: string }) { |
| 112 | const { userId, workspaceId } = params |
| 113 | return workspaceId |
| 114 | ? db |
| 115 | .select() |
| 116 | .from(customTools) |
| 117 | .where( |
| 118 | or( |
| 119 | eq(customTools.workspaceId, workspaceId), |
| 120 | and(isNull(customTools.workspaceId), eq(customTools.userId, userId)) |
| 121 | ) |
| 122 | ) |
| 123 | .orderBy(desc(customTools.createdAt)) |
| 124 | : db |
| 125 | .select() |
| 126 | .from(customTools) |
| 127 | .where(and(isNull(customTools.workspaceId), eq(customTools.userId, userId))) |
| 128 | .orderBy(desc(customTools.createdAt)) |
| 129 | } |
| 130 | |
| 131 | export async function getCustomToolById(params: { |
| 132 | toolId: string |
no test coverage detected