diff --git a/apps/portal/src/components/resumes/comments/CommentsSection.tsx b/apps/portal/src/components/resumes/comments/CommentsSection.tsx
index 60a7a5f5..b4e5f535 100644
--- a/apps/portal/src/components/resumes/comments/CommentsSection.tsx
+++ b/apps/portal/src/components/resumes/comments/CommentsSection.tsx
@@ -7,10 +7,7 @@ type ICommentsSectionProps = {
resumeId: string;
};
-// TODO: Retrieve resumeId for CommentsSection
-export default function CommentsSection({
- resumeId = '',
-}: ICommentsSectionProps) {
+export default function CommentsSection({ resumeId }: ICommentsSectionProps) {
const [showCommentsForm, setShowCommentsForm] = useState(false);
return showCommentsForm ? (
diff --git a/apps/portal/src/pages/resumes/review.tsx b/apps/portal/src/pages/resumes/review.tsx
index 3cd1cf0b..f75ae519 100644
--- a/apps/portal/src/pages/resumes/review.tsx
+++ b/apps/portal/src/pages/resumes/review.tsx
@@ -73,7 +73,8 @@ export default function ResumeReviewPage() {
-
+ {/* TODO: Update resumeId */}
+
diff --git a/apps/portal/src/server/router/resumes-reviews-router.ts b/apps/portal/src/server/router/resumes-reviews-router.ts
index 8e681326..2f983c92 100644
--- a/apps/portal/src/server/router/resumes-reviews-router.ts
+++ b/apps/portal/src/server/router/resumes-reviews-router.ts
@@ -7,9 +7,18 @@ export const resumeReviewsRouter = createRouter().query('list', {
resumeId: z.string(),
}),
async resolve({ ctx, input }) {
- const userId = ctx.session?.user?.id;
const { resumeId } = input;
+ const { resumesProfileId } =
+ await ctx.prisma.resumesResume.findUniqueOrThrow({
+ select: {
+ resumesProfileId: true,
+ },
+ where: {
+ id: resumeId,
+ },
+ });
+
// For this resume, we retrieve every comment's information, along with:
// The user's name and image to render
// Number of votes, and whether the user (if-any) has voted
@@ -20,16 +29,20 @@ export const resumeReviewsRouter = createRouter().query('list', {
votes: true,
},
},
- user: {
- select: {
- image: true,
- name: true,
+ resumesProfile: {
+ include: {
+ user: {
+ select: {
+ image: true,
+ name: true,
+ },
+ },
},
},
votes: {
take: 1,
where: {
- userId,
+ resumesProfileId,
},
},
},
diff --git a/apps/portal/src/server/router/resumes-reviews-user-router.ts b/apps/portal/src/server/router/resumes-reviews-user-router.ts
index ec42a36b..b13e2a00 100644
--- a/apps/portal/src/server/router/resumes-reviews-user-router.ts
+++ b/apps/portal/src/server/router/resumes-reviews-user-router.ts
@@ -6,8 +6,8 @@ import { createProtectedRouter } from './context';
type IResumeCommentInput = Readonly<{
description: string;
resumeId: string;
+ resumesProfileId: string;
section: ResumesSection;
- userId: string;
}>;
export const resumesReviewsUserRouter = createProtectedRouter().mutation(
@@ -22,10 +22,19 @@ export const resumesReviewsUserRouter = createProtectedRouter().mutation(
skills: z.string(),
}),
async resolve({ ctx, input }) {
- const userId = ctx.session?.user.id;
const { resumeId, education, experience, general, projects, skills } =
input;
+ const { resumesProfileId } =
+ await ctx.prisma.resumesResume.findUniqueOrThrow({
+ select: {
+ resumesProfileId: true,
+ },
+ where: {
+ id: resumeId,
+ },
+ });
+
// For each section, convert them into ResumesComment model if provided
const comments: Array = [
{ description: education, section: ResumesSection.EDUCATION },
@@ -41,8 +50,8 @@ export const resumesReviewsUserRouter = createProtectedRouter().mutation(
return {
description,
resumeId,
+ resumesProfileId,
section,
- userId,
};
});