Skip to content

Commit ccfa81f

Browse files
committed
fix: correct SQL query in getComments function to return comments properly
1 parent 32bffc1 commit ccfa81f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/services/comment.action.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ export const getComments = async (
1313
const input = CommentActionInput.getComments.parse(_input);
1414

1515
const query = sql`
16-
SELECT get_comments($1, $2);
16+
SELECT get_comments($1, $2) as comments
1717
`;
1818

1919
const execution_response: any = await pgClient?.executeSQL(query, [
2020
input.resource_id,
2121
input.resource_type,
2222
]);
23-
return execution_response?.rows?.[0]?.get_comments;
23+
return execution_response?.rows?.[0]?.comments || [];
2424
};
2525

2626
export const createMyComment = async (

0 commit comments

Comments
 (0)