Files
devops-platform-api/src/notifications/wecom/notification-outbox-manual-retry.controller.ts
T
2026-06-12 03:53:19 +08:00

33 lines
1.4 KiB
TypeScript

/**
* 通知 outbox 手动重发入口只允许超级管理员触发真实 provider 投递。
*/
import { Controller, Param, Post, UseGuards } from '@nestjs/common';
import { ApiOkResponse, ApiTags } from '@nestjs/swagger';
import { AdminOnlyMessage } from '../../auth/admin-only-message.decorator';
import { AuthGuard } from '../../auth/auth.guard';
import { AuthenticatedUser } from '../../auth/auth.types';
import { CurrentUser } from '../../auth/current-user.decorator';
import { PasswordChangeGuard } from '../../auth/password-change.guard';
import { SuperAdminGuard } from '../../auth/super-admin.guard';
import { NotificationOutboxMessage } from '../outbox/notification-outbox.types';
import { NotificationOutboxManualRetryService } from './notification-outbox-manual-retry.service';
@ApiTags('通知 outbox')
@Controller('notification-outbox')
@UseGuards(AuthGuard, PasswordChangeGuard, SuperAdminGuard)
@AdminOnlyMessage('无权限操作通知 outbox')
export class NotificationOutboxManualRetryController {
constructor(
private readonly manualRetryService: NotificationOutboxManualRetryService,
) {}
@Post(':id/retry')
@ApiOkResponse({ description: '手动重发失败或已终止的通知 outbox。' })
async retryMessage(
@Param('id') id: string,
@CurrentUser() user: AuthenticatedUser,
): Promise<NotificationOutboxMessage> {
return this.manualRetryService.retryMessage(id, user);
}
}