import { Controller, Get, HttpCode, Post, UseGuards } from "@nestjs/common"; import { Throttle } from "@nestjs/throttler"; import { QueueService } from "../../queue/queue.service"; import { OrchestratorApiKeyGuard } from "../../common/guards/api-key.guard"; import { OrchestratorThrottlerGuard } from "../../common/guards/throttler.guard"; @Controller("queue") @UseGuards(OrchestratorApiKeyGuard, OrchestratorThrottlerGuard) export class QueueController { constructor(private readonly queueService: QueueService) {} @Get("stats") @Throttle({ status: { limit: 200, ttl: 60000 } }) async getStats(): Promise<{ pending: number; active: number; completed: number; failed: number; delayed: number; }> { return this.queueService.getStats(); } @Post("pause") @Throttle({ strict: { limit: 10, ttl: 60000 } }) @HttpCode(200) async pause(): Promise<{ message: string }> { await this.queueService.pause(); return { message: "Queue processing paused" }; } @Post("resume") @Throttle({ strict: { limit: 10, ttl: 60000 } }) @HttpCode(200) async resume(): Promise<{ message: string }> { await this.queueService.resume(); return { message: "Queue processing resumed" }; } }