diff --git a/apps/portal/prisma/schema.prisma b/apps/portal/prisma/schema.prisma index 95c4381f..668b5ba6 100644 --- a/apps/portal/prisma/schema.prisma +++ b/apps/portal/prisma/schema.prisma @@ -146,6 +146,8 @@ model ResumesCommentVote { updatedAt DateTime @updatedAt user User @relation(fields: [userId], references: [id], onDelete: Cascade) comment ResumesComment @relation(fields: [commentId], references: [id], onDelete: Cascade) + + @@unique([commentId, userId]) } // Start of Offers project models. diff --git a/apps/portal/src/components/resumes/comments/CommentsForm.tsx b/apps/portal/src/components/resumes/comments/CommentsForm.tsx index 97cbb34f..c21314f2 100644 --- a/apps/portal/src/components/resumes/comments/CommentsForm.tsx +++ b/apps/portal/src/components/resumes/comments/CommentsForm.tsx @@ -20,9 +20,8 @@ type IFormInput = { type InputKeys = keyof IFormInput; -// TODO: Retrieve resumeId and remove default export default function CommentsForm({ - resumeId = '', + resumeId, setShowCommentsForm, }: CommentsFormProps) { const [showDialog, setShowDialog] = useState(false); diff --git a/apps/portal/src/components/resumes/comments/CommentsList.tsx b/apps/portal/src/components/resumes/comments/CommentsList.tsx index 397c9551..c9521380 100644 --- a/apps/portal/src/components/resumes/comments/CommentsList.tsx +++ b/apps/portal/src/components/resumes/comments/CommentsList.tsx @@ -1,17 +1,28 @@ import { useState } from 'react'; import { Button, Tabs } from '@tih/ui'; +import { trpc } from '~/utils/trpc'; + import { COMMENTS_SECTIONS } from './constants'; type CommentsListProps = Readonly<{ + resumeId: string; setShowCommentsForm: (show: boolean) => void; }>; export default function CommentsList({ + resumeId, setShowCommentsForm, }: CommentsListProps) { const [tab, setTab] = useState(COMMENTS_SECTIONS[0].value); + // TODO: Render comments + const commentsQuery = trpc.useQuery(['resumes.reviews.list', { resumeId }]); + + /* eslint-disable no-console */ + console.log(commentsQuery); + /* eslint-enable no-console */ + return ( <>