From dbeadc64984b9a8ea90eacd4f62b30118f030b58 Mon Sep 17 00:00:00 2001 From: Alexander Lee Date: Mon, 11 Mar 2024 18:38:12 +0800 Subject: [PATCH 1/3] fix: schema --- src/routes/v2/authenticated/sites.ts | 2 +- src/validators/RequestSchema.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/v2/authenticated/sites.ts b/src/routes/v2/authenticated/sites.ts index b94fc524c..8aeafc5df 100644 --- a/src/routes/v2/authenticated/sites.ts +++ b/src/routes/v2/authenticated/sites.ts @@ -179,7 +179,7 @@ export class SitesRouter { getPreviewInfo: RequestHandler< { siteName: string }, PreviewInfo[] | ResponseErrorBody, - { sites: string[]; email: string }, + { sites: string[] }, never, { userSessionData: UserSessionData } > = async (req, res) => { diff --git a/src/validators/RequestSchema.js b/src/validators/RequestSchema.js index 24c9d8704..9d65aade5 100644 --- a/src/validators/RequestSchema.js +++ b/src/validators/RequestSchema.js @@ -450,6 +450,9 @@ const CreateCollaboratorRequestSchema = Joi.object().keys({ const CollateUserFeedbackRequestSchema = Joi.object().keys({ userType: Joi.string().valid(...Object.values(UserTypes)), + rating: Joi.number().required(), + feedback: Joi.string().required(), + email: Joi.string().required(), }) const CreateReviewRequestSchema = Joi.object().keys({ @@ -473,7 +476,6 @@ const LaunchSiteSchema = Joi.object().keys({ const GetPreviewInfoSchema = Joi.object().keys({ sites: Joi.array().items(Joi.string()).required(), - email: EmailSchema, }) const VerifyEmailOtpSchema = Joi.object().keys({ From 2aeed4fcbd0be1c42eefae35d0a1cc8adbc70fb9 Mon Sep 17 00:00:00 2001 From: Alexander Lee Date: Mon, 11 Mar 2024 18:58:17 +0800 Subject: [PATCH 2/3] fix: make feedback optional --- src/validators/RequestSchema.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validators/RequestSchema.js b/src/validators/RequestSchema.js index 9d65aade5..ce2726ce2 100644 --- a/src/validators/RequestSchema.js +++ b/src/validators/RequestSchema.js @@ -451,7 +451,7 @@ const CreateCollaboratorRequestSchema = Joi.object().keys({ const CollateUserFeedbackRequestSchema = Joi.object().keys({ userType: Joi.string().valid(...Object.values(UserTypes)), rating: Joi.number().required(), - feedback: Joi.string().required(), + feedback: Joi.string().optional(), email: Joi.string().required(), }) From e2d4d5e216bb7f66a00e5eddb8c2664498506302 Mon Sep 17 00:00:00 2001 From: Alexander Lee Date: Mon, 11 Mar 2024 19:03:51 +0800 Subject: [PATCH 3/3] chore: make feedback optional --- src/types/dto/feedback.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/dto/feedback.ts b/src/types/dto/feedback.ts index df62abc91..79fee3bf0 100644 --- a/src/types/dto/feedback.ts +++ b/src/types/dto/feedback.ts @@ -2,7 +2,7 @@ import { UserType } from "../user" export interface FeedbackDto { rating: number - feedback: string + feedback?: string email: string userType: UserType }