[questions][feat] update add vote query params

pull/331/head
hpkoh 3 years ago
parent 665c4e6a26
commit 8e6a8f12be

@ -146,12 +146,15 @@ export const questionsAnswerRouter = createProtectedRouter()
}) })
.query('getVote', { .query('getVote', {
input: z.object({ input: z.object({
id: z.string(), answerId: z.string(),
}), }),
async resolve({ ctx, input }) { async resolve({ ctx, input }) {
const userId = ctx.session?.user?.id;
const {answerId} = input
return await ctx.prisma.questionsAnswerVote.findUnique({ return await ctx.prisma.questionsAnswerVote.findUnique({
where: { where: {
...input, answerId_userId : { answerId, userId },
}, },
}); });
}, },

Loading…
Cancel
Save