feat: aggregate cmpp template mismatch reviews
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
|
||||
import { BadRequestException, Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { TenantId } from '../common/tenant-id.decorator';
|
||||
import { ConfirmImportDto, CreateBatchTaskDto, ImportPreviewDto, SendChainService } from './send-chain.service';
|
||||
@@ -25,21 +25,28 @@ export class ClientSendChainController {
|
||||
|
||||
@Get('batch-tasks')
|
||||
listBatchTasks(@TenantId() tenantId?: string, @Query('status') status?: string) {
|
||||
return this.sendChain.listBatchTasks(tenantId, status);
|
||||
return this.sendChain.listBatchTasks(requireTenantId(tenantId), status, 'client');
|
||||
}
|
||||
|
||||
@Get('batch-tasks/:id')
|
||||
getBatchTask(@Param('id') taskId: string) {
|
||||
return this.sendChain.getBatchTask(taskId);
|
||||
getBatchTask(@TenantId() tenantId: string | undefined, @Param('id') taskId: string) {
|
||||
return this.sendChain.getBatchTask(taskId, requireTenantId(tenantId), 'client');
|
||||
}
|
||||
|
||||
@Get('batch-tasks/:id/messages')
|
||||
listTaskMessages(@Param('id') taskId: string) {
|
||||
return this.sendChain.listMessages({ taskId });
|
||||
listTaskMessages(@TenantId() tenantId: string | undefined, @Param('id') taskId: string) {
|
||||
return this.sendChain.listClientTaskMessages(taskId, requireTenantId(tenantId));
|
||||
}
|
||||
|
||||
@Post('batch-tasks/:id/cancel')
|
||||
cancelBatchTask(@Param('id') taskId: string) {
|
||||
return this.sendChain.cancelBatchTask(taskId);
|
||||
cancelBatchTask(@TenantId() tenantId: string | undefined, @Param('id') taskId: string) {
|
||||
return this.sendChain.cancelBatchTask(taskId, requireTenantId(tenantId), 'client');
|
||||
}
|
||||
}
|
||||
|
||||
function requireTenantId(tenantId?: string) {
|
||||
if (!tenantId) {
|
||||
throw new BadRequestException('Tenant context is required');
|
||||
}
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user