Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
fix: use zod validated data instead of body
Marc Seitzbc2d93970036
diff --git a/pages/api/teams/[teamId]/survey.ts b/pages/api/teams/[teamId]/survey.tsindex bfdf6f80..fa8e440c 100644--- a/pages/api/teams/[teamId]/survey.ts+++ b/pages/api/teams/[teamId]/survey.ts@@ -77,14 +77,7 @@ export default async function handler(if (req.method === "POST") {try {- const { dealType, dealTypeOther, dealSize } = req.body;-- // Validate with Zod- const validationResult = surveyDataSchema.safeParse({- dealType,- dealTypeOther,- dealSize,- });+ const validationResult = surveyDataSchema.safeParse(req.body);if (!validationResult.success) {return res.status(400).json({@@ -93,6 +86,8 @@ export default async function handler(});}+ const { dealType, dealTypeOther, dealSize } = validationResult.data;+// Get current survey data to merge with new dataconst team = await prisma.team.findUnique({where: { id: teamId },@@ -101,7 +96,6 @@ export default async function handler(const currentSurveyData = (team?.surveyData as SurveyData) || {};- // Merge new data with existing dataconst updatedSurveyData: SurveyData = {...currentSurveyData,...(dealType !== undefined && { dealType }),