From da14ead136a0e594b59e7d63e3be13782fa1fc68 Mon Sep 17 00:00:00 2001 From: Jonathan Chen Date: Sun, 17 Mar 2024 15:29:06 -0400 Subject: [PATCH] finished --- apps/backend/src/reviews/review.entity.ts | 5 ++++- apps/backend/src/reviews/reviews.controller.ts | 1 + apps/backend/src/reviews/reviews.service.ts | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/backend/src/reviews/review.entity.ts b/apps/backend/src/reviews/review.entity.ts index 6cd5b3b8..49e28c92 100644 --- a/apps/backend/src/reviews/review.entity.ts +++ b/apps/backend/src/reviews/review.entity.ts @@ -1,6 +1,6 @@ import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm'; import { Application } from '../applications/application.entity'; -import { Rating } from './types'; +import { Rating, Stage } from './types'; @Entity() export class Review { @@ -21,6 +21,9 @@ export class Review { @Column({ nullable: false }) reviewerId: number; + @Column({ type: 'varchar', nullable: false }) + stage: Stage; + @Column({ type: 'varchar', nullable: false }) rating: Rating; diff --git a/apps/backend/src/reviews/reviews.controller.ts b/apps/backend/src/reviews/reviews.controller.ts index ad99b0ab..f09bc238 100644 --- a/apps/backend/src/reviews/reviews.controller.ts +++ b/apps/backend/src/reviews/reviews.controller.ts @@ -34,6 +34,7 @@ export class ReviewsController { return this.reviewsService.createReview( req.user, createReviewDTO.applicantId, + createReviewDTO.stage, createReviewDTO.rating, createReviewDTO.content, ); diff --git a/apps/backend/src/reviews/reviews.service.ts b/apps/backend/src/reviews/reviews.service.ts index 6caa4d7e..71234dbb 100644 --- a/apps/backend/src/reviews/reviews.service.ts +++ b/apps/backend/src/reviews/reviews.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { MongoRepository } from 'typeorm'; import { Review } from './review.entity'; -import { Rating } from './types'; +import { Rating, Stage } from './types'; import { ApplicationsService } from '../applications/applications.service'; import { User } from '../users/user.entity'; @@ -20,6 +20,7 @@ export class ReviewsService { async createReview( currentUser: User, applicantId: number, + stage: Stage, rating: Rating, content: string, ): Promise { @@ -30,6 +31,7 @@ export class ReviewsService { createdAt: new Date(), updatedAt: new Date(), application, + stage, rating, content, });