[Fix] 白名单问题调整 (#310)
* feat: 添加问卷信息字段、去掉C端获取问卷信息的敏感字段 * feat: 白名单验证接口 * test: 白名单验证单元测试、参数类型优化 * test: 增加白名单验证单元测试 * feat: 提交问卷时校验白名单 * test: 提交问卷验证verifyId * test: verifyId不匹配测试 * feat: 注册entity、出参调整 * style: lint
This commit is contained in:
parent
f6569a3899
commit
01ce20570f
@ -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,
|
||||
],
|
||||
};
|
||||
},
|
||||
|
@ -70,10 +70,7 @@ export class ResponseSchemaController {
|
||||
// 白名单验证
|
||||
@Post('/:surveyPath/validate')
|
||||
@HttpCode(200)
|
||||
async whitelistValidate(
|
||||
@Param('surveyPath') surveyPath,
|
||||
@Body() body,
|
||||
): Promise<string> {
|
||||
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(),
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user