From 01ce20570fe1af4879a5555b6c296288acd54459 Mon Sep 17 00:00:00 2001 From: Stahsf <30379566+50431040@users.noreply.github.com> Date: Thu, 27 Jun 2024 20:31:39 +0800 Subject: [PATCH] =?UTF-8?q?[Fix]=20=E7=99=BD=E5=90=8D=E5=8D=95=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E8=B0=83=E6=95=B4=20(#310)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 添加问卷信息字段、去掉C端获取问卷信息的敏感字段 * feat: 白名单验证接口 * test: 白名单验证单元测试、参数类型优化 * test: 增加白名单验证单元测试 * feat: 提交问卷时校验白名单 * test: 提交问卷验证verifyId * test: verifyId不匹配测试 * feat: 注册entity、出参调整 * style: lint --- server/src/app.module.ts | 2 ++ .../controllers/responseSchema.controller.ts | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/server/src/app.module.ts b/server/src/app.module.ts index 3faa2987..a030386f 100644 --- a/server/src/app.module.ts +++ b/server/src/app.module.ts @@ -41,6 +41,7 @@ import { PluginManagerProvider } from './securityPlugin/pluginManager.provider'; import { LogRequestMiddleware } from './middlewares/logRequest.middleware'; import { XiaojuSurveyPluginManager } from './securityPlugin/pluginManager'; import { Logger } from './logger'; +import { WhitelistVerify } from './models/whitelistVerify.entity'; @Module({ imports: [ @@ -81,6 +82,7 @@ import { Logger } from './logger'; Workspace, WorkspaceMember, Collaborator, + WhitelistVerify, ], }; }, diff --git a/server/src/modules/surveyResponse/controllers/responseSchema.controller.ts b/server/src/modules/surveyResponse/controllers/responseSchema.controller.ts index 9cd8f452..6755f09d 100644 --- a/server/src/modules/surveyResponse/controllers/responseSchema.controller.ts +++ b/server/src/modules/surveyResponse/controllers/responseSchema.controller.ts @@ -70,10 +70,7 @@ export class ResponseSchemaController { // 白名单验证 @Post('/:surveyPath/validate') @HttpCode(200) - async whitelistValidate( - @Param('surveyPath') surveyPath, - @Body() body, - ): Promise { + async whitelistValidate(@Param('surveyPath') surveyPath, @Body() body) { const { value, error } = Joi.object({ password: Joi.string().allow(null, ''), value: Joi.string().allow(null, ''), @@ -130,6 +127,12 @@ export class ResponseSchemaController { // 返回verifyId const res = await this.whitelistService.create(surveyPath); - return res._id.toString(); + + return { + code: 200, + data: { + verifyId: res._id.toString(), + }, + }; } }