qwen_2.5_model / src /modules /integration /redrive.controller.ts
Muhammad Noman
Deploy OpenWA to Hugging Face Spaces
46252cd
Raw
History Blame Contribute Delete
1.16 kB
import { Controller, Param, Post } from '@nestjs/common';
import { ApiTags, ApiResponse } from '@nestjs/swagger';
import { RequireRole } from '../auth/decorators/auth.decorators';
import { ApiKeyRole } from '../auth/entities/api-key.entity';
import { RedriveService } from './redrive.service';
// Re-dispatching DLQ'd inbound payloads can cause real downstream sends, so this operator action is
// ADMIN-gated — matching the sibling IntegrationInstanceController. (A bare API key, even VIEWER,
// must NOT be able to trigger it.)
@ApiTags('integration')
@Controller('integration/instances')
@RequireRole(ApiKeyRole.ADMIN)
export class RedriveController {
constructor(private readonly redrive: RedriveService) {}
@Post(':pluginId/:instanceId/redrive')
@ApiResponse({
status: 201,
description: 'One bounded batch of dead-lettered ingress deliveries re-dispatched, with remaining depth.',
})
redriveInstance(
@Param('pluginId') pluginId: string,
@Param('instanceId') instanceId: string,
): Promise<{ redriven: number; remaining: number; batchSize: number }> {
return this.redrive.redriveInstance(pluginId, instanceId);
}
}