46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { 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';
|
|
|
|
@ApiTags('client-send-chain')
|
|
@Controller('client/send')
|
|
export class ClientSendChainController {
|
|
constructor(private readonly sendChain: SendChainService) {}
|
|
|
|
@Post('batch-tasks')
|
|
createBatchTask(@Body() body: CreateBatchTaskDto) {
|
|
return this.sendChain.createBatchTask(body);
|
|
}
|
|
|
|
@Post('imports/preview')
|
|
previewImport(@Body() body: ImportPreviewDto) {
|
|
return this.sendChain.previewImport(body);
|
|
}
|
|
|
|
@Post('imports/confirm')
|
|
confirmImport(@Body() body: ConfirmImportDto) {
|
|
return this.sendChain.confirmImport(body);
|
|
}
|
|
|
|
@Get('batch-tasks')
|
|
listBatchTasks(@TenantId() tenantId?: string, @Query('status') status?: string) {
|
|
return this.sendChain.listBatchTasks(tenantId, status);
|
|
}
|
|
|
|
@Get('batch-tasks/:id')
|
|
getBatchTask(@Param('id') taskId: string) {
|
|
return this.sendChain.getBatchTask(taskId);
|
|
}
|
|
|
|
@Get('batch-tasks/:id/messages')
|
|
listTaskMessages(@Param('id') taskId: string) {
|
|
return this.sendChain.listMessages({ taskId });
|
|
}
|
|
|
|
@Post('batch-tasks/:id/cancel')
|
|
cancelBatchTask(@Param('id') taskId: string) {
|
|
return this.sendChain.cancelBatchTask(taskId);
|
|
}
|
|
}
|