feat: complete reporting and filing workflows
This commit is contained in:
@@ -178,8 +178,8 @@ export class ChannelsController {
|
||||
|
||||
@Post('report-tasks/status-change')
|
||||
@RequireRecentAuthentication()
|
||||
changeReportTaskStatuses(@Body() body: ChangeReportTaskStatusesDto) {
|
||||
return this.channels.changeReportTaskStatuses(body);
|
||||
changeReportTaskStatuses(@Body() body: ChangeReportTaskStatusesDto, @CurrentSessionUserId() operatorId?: string) {
|
||||
return this.channels.changeReportTaskStatuses({ ...body, operatorId });
|
||||
}
|
||||
|
||||
@Post('report-tasks/:id/export')
|
||||
|
||||
@@ -213,8 +213,24 @@ describe('ChannelsService', () => {
|
||||
await service.listReportTasks(undefined, undefined, 'channel-1');
|
||||
|
||||
expect(prisma.channelSignatureReportTask.findMany).toHaveBeenCalledWith({
|
||||
where: { tenantId: undefined, status: undefined, channelId: 'channel-1', reportType: undefined },
|
||||
include: { signature: true, channel: true, drainageInfo: true },
|
||||
where: {
|
||||
tenantId: undefined,
|
||||
status: undefined,
|
||||
channelId: 'channel-1',
|
||||
reportType: undefined,
|
||||
signature: { auditStatus: { not: 'deleted' } },
|
||||
},
|
||||
include: {
|
||||
signature: { include: { tenant: true, application: true } },
|
||||
channel: true,
|
||||
drainageInfo: true,
|
||||
exportItems: {
|
||||
include: { exportFile: true, batchItem: { include: { batch: true } } },
|
||||
orderBy: { id: 'desc' },
|
||||
take: 1,
|
||||
},
|
||||
records: { orderBy: { createdAt: 'desc' }, take: 20 },
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1155,8 +1155,24 @@ export class ChannelsService implements OnModuleInit, OnModuleDestroy {
|
||||
|
||||
async listReportTasks(tenantId?: string, status?: string, channelId?: string, reportType?: string) {
|
||||
const tasks = await this.prisma.channelSignatureReportTask.findMany({
|
||||
where: { tenantId, status, channelId, reportType },
|
||||
include: { signature: true, channel: true, drainageInfo: true },
|
||||
where: {
|
||||
tenantId,
|
||||
status,
|
||||
channelId,
|
||||
reportType,
|
||||
signature: { auditStatus: { not: 'deleted' } },
|
||||
},
|
||||
include: {
|
||||
signature: { include: { tenant: true, application: true } },
|
||||
channel: true,
|
||||
drainageInfo: true,
|
||||
exportItems: {
|
||||
include: { exportFile: true, batchItem: { include: { batch: true } } },
|
||||
orderBy: { id: 'desc' },
|
||||
take: 1,
|
||||
},
|
||||
records: { orderBy: { createdAt: 'desc' }, take: 20 },
|
||||
},
|
||||
orderBy: { createdAt: 'desc' },
|
||||
});
|
||||
if (tasks.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user