feat: strengthen risk controls and review workflows

This commit is contained in:
hectorzhao
2026-07-26 13:08:12 +08:00
parent b461532075
commit 2ce682c3fc
34 changed files with 2167 additions and 390 deletions
@@ -1,4 +1,4 @@
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import { Body, Controller, Get, Param, Post, Put, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { CurrentSessionUserId } from '../auth/current-session-user.decorator';
import { SendChainService } from '../send-chain/send-chain.service';
@@ -15,8 +15,8 @@ export class AdminRiskReviewController {
constructor(private readonly riskReview: RiskReviewService, private readonly sendChain: SendChainService) {}
@Get('rules')
listRules(@Query('tenantId') tenantId?: string) {
return this.riskReview.listRules(tenantId);
listRules(@Query('applicationId') applicationId?: string) {
return this.riskReview.listRules(applicationId);
}
@Post('rules')
@@ -24,6 +24,11 @@ export class AdminRiskReviewController {
return this.riskReview.createRule(body);
}
@Put('rules/:id')
updateRule(@Param('id') ruleId: string, @Body() body: Partial<CreateRiskRuleDto>) {
return this.riskReview.updateRule(ruleId, body);
}
@Get('hits')
listHits(@Query('tenantId') tenantId?: string, @Query('taskId') taskId?: string) {
return this.riskReview.listHits(tenantId, taskId);
@@ -39,6 +44,16 @@ export class AdminRiskReviewController {
return this.riskReview.listPendingTasks();
}
@Get('tasks/:id/messages')
listTaskMessages(
@Param('id') taskId: string,
@Query('phone') phone?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.riskReview.listTaskMessages(taskId, phone, Number(page ?? 1), Number(pageSize ?? 20));
}
@Post('tasks/:id/approve')
async approveTask(@Param('id') taskId: string, @Body() body: ReviewSmsTaskDto, @CurrentSessionUserId() reviewerId?: string) {
const review = { ...body, reviewerId };