From 89149bc50b3c9cfec12dba9e03f649c923a3b3ad Mon Sep 17 00:00:00 2001 From: Farai Mutambara Date: Wed, 20 Nov 2024 09:32:39 +0000 Subject: [PATCH] add validation for proposal scientist comments --- package-lock.json | 2 +- packages/validation/package.json | 2 +- packages/validation/src/Proposal/index.ts | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 96c6583..9f29910 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18683,7 +18683,7 @@ }, "packages/validation": { "name": "@user-office-software/duo-validation", - "version": "5.1.8", + "version": "5.1.9", "license": "ISC", "dependencies": { "luxon": "^2.5.0", diff --git a/packages/validation/package.json b/packages/validation/package.json index 5c0be92..5fcbc0f 100644 --- a/packages/validation/package.json +++ b/packages/validation/package.json @@ -1,6 +1,6 @@ { "name": "@user-office-software/duo-validation", - "version": "5.1.8", + "version": "5.1.9", "description": "Duo frontend and backend validation in one place.", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/validation/src/Proposal/index.ts b/packages/validation/src/Proposal/index.ts index e3949ba..4058819 100644 --- a/packages/validation/src/Proposal/index.ts +++ b/packages/validation/src/Proposal/index.ts @@ -53,3 +53,20 @@ export const generalInfoUpdateValidationSchema = Yup.object().shape({ .max(MAX_ABSTRACT_LEN, 'Abstract must be at most 1500 characters') .required('Abstract is required'), }); + +export const createProposalScientistCommentValidationSchema = + Yup.object().shape({ + comment: Yup.string().min(1).required('Comment is required'), + proposalPk: Yup.number().required(), + }); + +export const updateProposalScientistCommentValidationSchema = + Yup.object().shape({ + commentId: Yup.number().required(), + comment: Yup.string().min(1).required('Comment is required'), + }); + +export const deleteProposalScientistCommentValidationSchema = + Yup.object().shape({ + commentId: Yup.number().required(), + });