From 75c0743e84e6b88383bccf336c4a987a624a4767 Mon Sep 17 00:00:00 2001 From: seaerchin Date: Wed, 19 Oct 2022 20:38:40 +0800 Subject: [PATCH] chore(routes/review): updaterr api --- src/routes/v2/authenticated/review.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/routes/v2/authenticated/review.ts b/src/routes/v2/authenticated/review.ts index 8d91eb6bb..2e146e496 100644 --- a/src/routes/v2/authenticated/review.ts +++ b/src/routes/v2/authenticated/review.ts @@ -17,13 +17,13 @@ import CollaboratorsService from "@root/services/identity/CollaboratorsService" import SitesService from "@root/services/identity/SitesService" import UsersService from "@root/services/identity/UsersService" import { isIsomerError, RequestHandler } from "@root/types" -import { ResponseErrorBody } from "@root/types/dto /error" +import { ResponseErrorBody } from "@root/types/dto/error" import { DashboardReviewRequestDto, EditedItemDto, - RequestChangeDto, + UpdateReviewRequestDto, ReviewRequestDto, -} from "@root/types/dto /review" +} from "@root/types/dto/review" import ReviewRequestService from "@services/review/ReviewRequestService" // eslint-disable-next-line import/prefer-default-export export class ReviewsRouter { @@ -333,7 +333,7 @@ export class ReviewsRouter { updateReviewRequest: RequestHandler< { siteName: string; requestId: number }, ResponseErrorBody, - RequestChangeDto, + UpdateReviewRequestDto, unknown, { userWithSiteSessionData: UserWithSiteSessionData } > = async (req, res) => { @@ -397,7 +397,7 @@ export class ReviewsRouter { } // Step 4: Check that all new reviewers are admins of the site - const { reviewers, title, description } = req.body + const { reviewers } = req.body const collaborators = await this.collaboratorsService.list(siteName) const collaboratorMappings = Object.fromEntries( reviewers.map((reviewer) => [reviewer, true]) @@ -420,14 +420,11 @@ export class ReviewsRouter { } // Step 5: Update the rr with the appropriate details - return this.reviewRequestService.updateReviewRequest( - possibleReviewRequest, - { - title, - description, - reviewers: verifiedReviewers, - } - ) + await this.reviewRequestService.updateReviewRequest(possibleReviewRequest, { + reviewers: verifiedReviewers, + }) + + return res.status(200).send() } mergeReviewRequest: RequestHandler<