feat: build reporting workbench workflow
This commit is contained in:
@@ -27,10 +27,19 @@ import { ChannelsService } from './channels.service';
|
||||
@ApiTags('channels')
|
||||
@Controller('admin')
|
||||
export class ChannelsController {
|
||||
constructor(private readonly channels: ChannelsService, private readonly deletions: DeletionGovernanceService) {}
|
||||
constructor(
|
||||
private readonly channels: ChannelsService,
|
||||
private readonly deletions: DeletionGovernanceService,
|
||||
) {}
|
||||
|
||||
@Get('channels')
|
||||
listChannels(@Query('keyword') keyword?: string, @Query('carrier') carrier?: string, @Query('status') status?: string, @Query('page') page?: string, @Query('pageSize') pageSize?: string) {
|
||||
listChannels(
|
||||
@Query('keyword') keyword?: string,
|
||||
@Query('carrier') carrier?: string,
|
||||
@Query('status') status?: string,
|
||||
@Query('page') page?: string,
|
||||
@Query('pageSize') pageSize?: string,
|
||||
) {
|
||||
return page || pageSize
|
||||
? this.channels.listChannelsPage({ keyword, carrier, status, page: Number(page), pageSize: Number(pageSize) })
|
||||
: this.channels.listChannels();
|
||||
@@ -68,7 +77,11 @@ export class ChannelsController {
|
||||
|
||||
@Delete('channels/:id')
|
||||
@RequireRecentAuthentication()
|
||||
deleteChannel(@Param('id') channelId: string, @Body() body: DeleteTargetDto, @CurrentSessionUserId() operatorId?: string) {
|
||||
deleteChannel(
|
||||
@Param('id') channelId: string,
|
||||
@Body() body: DeleteTargetDto,
|
||||
@CurrentSessionUserId() operatorId?: string,
|
||||
) {
|
||||
return this.deletions.delete('channel', channelId, { ...body, operatorId });
|
||||
}
|
||||
|
||||
@@ -159,7 +172,11 @@ export class ChannelsController {
|
||||
|
||||
@Put('channels/:channelId/report-fields/:reportType')
|
||||
@RequireRecentAuthentication()
|
||||
replaceReportFields(@Param('channelId') channelId: string, @Param('reportType') reportType: 'signature' | 'drainage', @Body() body: ReplaceReportFieldsDto) {
|
||||
replaceReportFields(
|
||||
@Param('channelId') channelId: string,
|
||||
@Param('reportType') reportType: 'signature' | 'drainage',
|
||||
@Body() body: ReplaceReportFieldsDto,
|
||||
) {
|
||||
return this.channels.replaceReportFields(channelId, reportType, body);
|
||||
}
|
||||
|
||||
@@ -174,12 +191,82 @@ export class ChannelsController {
|
||||
}
|
||||
|
||||
@Get('report-tasks')
|
||||
listReportTasks(@Query('tenantId') tenantId?: string, @Query('status') status?: string, @Query('channelId') channelId?: string, @Query('reportType') reportType?: string, @Query('keyword') keyword?: string, @Query('createdAtFrom') createdAtFrom?: string, @Query('createdAtTo') createdAtTo?: string, @Query('page') page?: string, @Query('pageSize') pageSize?: string) {
|
||||
return page || pageSize || keyword || createdAtFrom || createdAtTo
|
||||
? this.channels.listReportTasksPage({ tenantId, status, channelId, reportType, keyword, createdAtFrom, createdAtTo, page: Number(page), pageSize: Number(pageSize) })
|
||||
listReportTasks(
|
||||
@Query('tenantId') tenantId?: string,
|
||||
@Query('applicationId') applicationId?: string,
|
||||
@Query('status') status?: string,
|
||||
@Query('channelId') channelId?: string,
|
||||
@Query('reportType') reportType?: string,
|
||||
@Query('keyword') keyword?: string,
|
||||
@Query('carrier') carrier?: string,
|
||||
@Query('todaySendMin') todaySendMin?: string,
|
||||
@Query('todaySendMax') todaySendMax?: string,
|
||||
@Query('sort') sort?: string,
|
||||
@Query('createdAtFrom') createdAtFrom?: string,
|
||||
@Query('createdAtTo') createdAtTo?: string,
|
||||
@Query('page') page?: string,
|
||||
@Query('pageSize') pageSize?: string,
|
||||
) {
|
||||
return page ||
|
||||
pageSize ||
|
||||
keyword ||
|
||||
applicationId ||
|
||||
carrier ||
|
||||
todaySendMin ||
|
||||
todaySendMax ||
|
||||
sort ||
|
||||
createdAtFrom ||
|
||||
createdAtTo
|
||||
? this.channels.listReportTasksPage({
|
||||
tenantId,
|
||||
applicationId,
|
||||
status,
|
||||
channelId,
|
||||
reportType,
|
||||
keyword,
|
||||
carrier,
|
||||
todaySendMin: Number(todaySendMin),
|
||||
todaySendMax: Number(todaySendMax),
|
||||
sort,
|
||||
createdAtFrom,
|
||||
createdAtTo,
|
||||
page: Number(page),
|
||||
pageSize: Number(pageSize),
|
||||
})
|
||||
: this.channels.listReportTasks(tenantId, status, channelId, reportType);
|
||||
}
|
||||
|
||||
@Get('report-details')
|
||||
listReportDetails(
|
||||
@Query('tenantId') tenantId?: string,
|
||||
@Query('applicationId') applicationId?: string,
|
||||
@Query('signatureId') signatureId?: string,
|
||||
@Query('channelId') channelId?: string,
|
||||
@Query('carrier') carrier?: string,
|
||||
@Query('status') status?: string,
|
||||
@Query('reportType') reportType?: string,
|
||||
@Query('keyword') keyword?: string,
|
||||
@Query('createdAtFrom') createdAtFrom?: string,
|
||||
@Query('createdAtTo') createdAtTo?: string,
|
||||
@Query('page') page?: string,
|
||||
@Query('pageSize') pageSize?: string,
|
||||
) {
|
||||
return this.channels.listReportDetailsPage({
|
||||
tenantId,
|
||||
applicationId,
|
||||
signatureId,
|
||||
channelId,
|
||||
carrier,
|
||||
status,
|
||||
reportType,
|
||||
keyword,
|
||||
createdAtFrom,
|
||||
createdAtTo,
|
||||
page: Number(page),
|
||||
pageSize: Number(pageSize),
|
||||
});
|
||||
}
|
||||
|
||||
@Post('report-tasks/generate')
|
||||
createReportTask(@Body() body: CreateReportTaskDto) {
|
||||
return this.channels.createReportTask(body);
|
||||
@@ -202,9 +289,47 @@ export class ChannelsController {
|
||||
}
|
||||
|
||||
@Get('report-records')
|
||||
listReportRecords(@Query('taskId') taskId?: string, @Query('channelId') channelId?: string, @Query('keyword') keyword?: string, @Query('reportType') reportType?: string, @Query('createdAtFrom') createdAtFrom?: string, @Query('createdAtTo') createdAtTo?: string, @Query('page') page?: string, @Query('pageSize') pageSize?: string) {
|
||||
return page || pageSize || keyword || reportType || createdAtFrom || createdAtTo
|
||||
? this.channels.listReportRecordsPage({ taskId, channelId, keyword, reportType, createdAtFrom, createdAtTo, page: Number(page), pageSize: Number(pageSize) })
|
||||
listReportRecords(
|
||||
@Query('taskId') taskId?: string,
|
||||
@Query('channelId') channelId?: string,
|
||||
@Query('batchNo') batchNo?: string,
|
||||
@Query('statusAfter') statusAfter?: string,
|
||||
@Query('action') action?: string,
|
||||
@Query('sourceEntry') sourceEntry?: string,
|
||||
@Query('operatorKeyword') operatorKeyword?: string,
|
||||
@Query('keyword') keyword?: string,
|
||||
@Query('reportType') reportType?: string,
|
||||
@Query('createdAtFrom') createdAtFrom?: string,
|
||||
@Query('createdAtTo') createdAtTo?: string,
|
||||
@Query('page') page?: string,
|
||||
@Query('pageSize') pageSize?: string,
|
||||
) {
|
||||
return page ||
|
||||
pageSize ||
|
||||
keyword ||
|
||||
batchNo ||
|
||||
statusAfter ||
|
||||
action ||
|
||||
sourceEntry ||
|
||||
operatorKeyword ||
|
||||
reportType ||
|
||||
createdAtFrom ||
|
||||
createdAtTo
|
||||
? this.channels.listReportRecordsPage({
|
||||
taskId,
|
||||
channelId,
|
||||
batchNo,
|
||||
statusAfter,
|
||||
action,
|
||||
sourceEntry,
|
||||
operatorKeyword,
|
||||
keyword,
|
||||
reportType,
|
||||
createdAtFrom,
|
||||
createdAtTo,
|
||||
page: Number(page),
|
||||
pageSize: Number(pageSize),
|
||||
})
|
||||
: this.channels.listReportRecords(taskId, channelId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user