diff --git a/apps/portal/prisma/migrations/20221013032033_update_resume_vote_to_enum/migration.sql b/apps/portal/prisma/migrations/20221013032033_update_resume_vote_to_enum/migration.sql new file mode 100644 index 00000000..935df922 --- /dev/null +++ b/apps/portal/prisma/migrations/20221013032033_update_resume_vote_to_enum/migration.sql @@ -0,0 +1,9 @@ +/* + Warnings: + + - Changed the type of `value` on the `ResumesCommentVote` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. + +*/ +-- AlterTable +ALTER TABLE "ResumesCommentVote" DROP COLUMN "value", +ADD COLUMN "value" "Vote" NOT NULL; diff --git a/apps/portal/prisma/schema.prisma b/apps/portal/prisma/schema.prisma index 27a1d7c5..9ce74736 100644 --- a/apps/portal/prisma/schema.prisma +++ b/apps/portal/prisma/schema.prisma @@ -159,7 +159,7 @@ model ResumesCommentVote { id String @id @default(cuid()) userId String commentId String - value Int + value Vote createdAt DateTime @default(now()) updatedAt DateTime @updatedAt comment ResumesComment @relation(fields: [commentId], references: [id], onDelete: Cascade) diff --git a/apps/portal/src/components/resumes/comments/CommentListItems.tsx b/apps/portal/src/components/resumes/comments/CommentListItems.tsx deleted file mode 100644 index 5e3e154d..00000000 --- a/apps/portal/src/components/resumes/comments/CommentListItems.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { useSession } from 'next-auth/react'; -import { Spinner } from '@tih/ui'; - -import Comment from './comment/Comment'; - -import type { ResumeComment } from '~/types/resume-comments'; - -type Props = Readonly<{ - comments: Array; - isLoading: boolean; -}>; - -export default function CommentListItems({ comments, isLoading }: Props) { - const { data: session } = useSession(); - - if (isLoading) { - return ( -
- -
- ); - } - - return ( -
- {comments.map((comment) => ( - - ))} -
- ); -} diff --git a/apps/portal/src/components/resumes/comments/CommentsList.tsx b/apps/portal/src/components/resumes/comments/CommentsList.tsx deleted file mode 100644 index e4f842cb..00000000 --- a/apps/portal/src/components/resumes/comments/CommentsList.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { useSession } from 'next-auth/react'; -import { useState } from 'react'; -import { Tabs } from '@tih/ui'; -import { Button } from '@tih/ui'; - -import { trpc } from '~/utils/trpc'; - -import CommentListItems from './CommentListItems'; -import { COMMENTS_SECTIONS } from './constants'; -import ResumeSignInButton from '../shared/ResumeSignInButton'; - -type CommentsListProps = Readonly<{ - resumeId: string; - setShowCommentsForm: (show: boolean) => void; -}>; - -export default function CommentsList({ - resumeId, - setShowCommentsForm, -}: CommentsListProps) { - const { data: sessionData } = useSession(); - const [tab, setTab] = useState(COMMENTS_SECTIONS[0].value); - - const commentsQuery = trpc.useQuery(['resumes.reviews.list', { resumeId }]); - const renderButton = () => { - if (sessionData === null) { - return ; - } - return ( -