Skip to content

Commit

Permalink
πŸ› User and Upvotes Relation
Browse files Browse the repository at this point in the history
/comment API Responses now include user and upvote information
  • Loading branch information
sanmoh-hombal committed Aug 17, 2022
1 parent 0c7a589 commit 6b0a3fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/services/comment.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import { UserService } from "@server/services";
*/
export async function get(): Promise<Array<IComment>> {
try {
return await PrismaClient.comment.findMany({ orderBy: { created: "desc" } });
return await PrismaClient.comment.findMany({
orderBy: { created: "desc" },
include: { user: true, upvotes: true },
});
} catch (e) {
throw e;
} finally {
Expand Down

0 comments on commit 6b0a3fa

Please sign in to comment.