[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 { LogRequestMiddleware } from './middlewares/logRequest.middleware';
|
||||||
import { XiaojuSurveyPluginManager } from './securityPlugin/pluginManager';
|
import { XiaojuSurveyPluginManager } from './securityPlugin/pluginManager';
|
||||||
import { Logger } from './logger';
|
import { Logger } from './logger';
|
||||||
|
import { WhitelistVerify } from './models/whitelistVerify.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@ -81,6 +82,7 @@ import { Logger } from './logger';
|
|||||||
Workspace,
|
Workspace,
|
||||||
WorkspaceMember,
|
WorkspaceMember,
|
||||||
Collaborator,
|
Collaborator,
|
||||||
|
WhitelistVerify,
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -70,10 +70,7 @@ export class ResponseSchemaController {
|
|||||||
// 白名单验证
|
// 白名单验证
|
||||||
@Post('/:surveyPath/validate')
|
@Post('/:surveyPath/validate')
|
||||||
@HttpCode(200)
|
@HttpCode(200)
|
||||||
async whitelistValidate(
|
async whitelistValidate(@Param('surveyPath') surveyPath, @Body() body) {
|
||||||
@Param('surveyPath') surveyPath,
|
|
||||||
@Body() body,
|
|
||||||
): Promise<string> {
|
|
||||||
const { value, error } = Joi.object({
|
const { value, error } = Joi.object({
|
||||||
password: Joi.string().allow(null, ''),
|
password: Joi.string().allow(null, ''),
|
||||||
value: Joi.string().allow(null, ''),
|
value: Joi.string().allow(null, ''),
|
||||||
@ -130,6 +127,12 @@ export class ResponseSchemaController {
|
|||||||
|
|
||||||
// 返回verifyId
|
// 返回verifyId
|
||||||
const res = await this.whitelistService.create(surveyPath);
|
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