[offers][fix] fix get comments bug

pull/390/head
Stuart Long Chay Boon 3 years ago
parent 3eb568dc51
commit 699d563902

@ -3,8 +3,6 @@ import * as trpc from '@trpc/server';
import { createProtectedRouter } from '../context'; import { createProtectedRouter } from '../context';
import type { Reply } from '~/types/offers';
export const offersCommentsRouter = createProtectedRouter() export const offersCommentsRouter = createProtectedRouter()
.query('getComments', { .query('getComments', {
input: z.object({ input: z.object({
@ -38,8 +36,8 @@ export const offersCommentsRouter = createProtectedRouter()
if (result) { if (result) {
return result.discussion return result.discussion
.filter((x: Reply) => x.replyingToId === null) .filter((x) => x.replyingToId === null)
.map((x: Reply) => { .map((x) => {
if (x.user == null) { if (x.user == null) {
x.user = { x.user = {
email: '', email: '',

Loading…
Cancel
Save